AgentConfig.fromJson constructor

AgentConfig.fromJson(
  1. Object? j
)

Implementation

factory AgentConfig.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return AgentConfig(
    agentId: switch (json['agentId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    agentType: switch (json['agentType']) {
      null => '',
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => '',
      Object $1 => decodeString($1),
    },
    instruction: switch (json['instruction']) {
      null => '',
      Object $1 => decodeString($1),
    },
    tools: switch (json['tools']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Tool.fromJson(i)],
      _ => throw const FormatException('"tools" is not a list'),
    },
    subAgents: switch (json['subAgents']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"subAgents" is not a list'),
    },
  );
}