Skip to content

ant_ai.a2a.config

A2AConfig pydantic-model

Bases: BaseModel

Configuration used to set the connection with the A2A server.

Show JSON schema:
{
  "$defs": {
    "TimeoutTypes": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "maxItems": 4,
          "minItems": 4,
          "prefixItems": [
            {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            }
          ],
          "type": "array"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "description": "Configuration used to set the connection with the A2A server.",
  "properties": {
    "endpoint": {
      "description": "The URL of the A2A server to connect to.",
      "title": "Endpoint",
      "type": "string"
    },
    "timeout": {
      "$ref": "#/$defs/TimeoutTypes",
      "description": "Timeout configuration for the A2A client. Can be a float (total timeout) or a dict with connect/read/write/pool timeouts. See httpx.Timeout for more details."
    },
    "agent_card_path": {
      "default": "/.well-known/agent-card.json",
      "description": "The path, on the remote url, to the agent card.",
      "title": "Agent Card Path",
      "type": "string"
    },
    "supported_protocol_bindings": {
      "default": [
        "JSONRPC",
        "HTTP+JSON"
      ],
      "description": "The supported A2A protocol bindings.",
      "items": {
        "type": "string"
      },
      "title": "Supported Protocol Bindings",
      "type": "array"
    },
    "streaming": {
      "default": true,
      "description": "Whether to enable streaming.",
      "title": "Streaming",
      "type": "boolean"
    },
    "propagate_trace_context": {
      "default": true,
      "description": "Whether to inject the current trace context into outbound A2A requests. Set to False when calling third-party agents you do not own.",
      "title": "Propagate Trace Context",
      "type": "boolean"
    }
  },
  "required": [
    "endpoint"
  ],
  "title": "A2AConfig",
  "type": "object"
}

Config:

  • arbitrary_types_allowed: True

Fields:

Validators:

Source code in src/ant_ai/a2a/config.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class A2AConfig(BaseModel):
    """Configuration used to set the connection with the A2A server."""

    endpoint: str = Field(description="The URL of the A2A server to connect to.")
    timeout: TimeoutTypes = Field(
        default_factory=lambda: Timeout(connect=10, read=None, write=10, pool=10),
        description=(
            "Timeout configuration for the A2A client. Can be a float (total timeout) or a dict with "
            "connect/read/write/pool timeouts. See httpx.Timeout for more details."
        ),
    )

    agent_card_path: str = Field(
        default="/.well-known/agent-card.json",
        description="The path, on the remote url, to the agent card.",
    )
    supported_protocol_bindings: tuple[str, ...] = Field(
        default=("JSONRPC", "HTTP+JSON"),
        description="The supported A2A protocol bindings.",
    )
    streaming: bool = Field(default=True, description="Whether to enable streaming.")
    propagate_trace_context: bool = Field(
        default=True,
        description=(
            "Whether to inject the current trace context into outbound A2A requests. Set to False when calling third-party agents you do not own."
        ),
    )
    model_config = ConfigDict(arbitrary_types_allowed=True)

    @field_validator("timeout", mode="before")
    @classmethod
    def normalize_timeout(cls, value):
        match value:
            case Timeout():
                return value
            case int() | float():
                return Timeout(float(value))
            case tuple():
                return Timeout(value)
            case dict():
                return Timeout(**value)
            case _:
                raise TypeError(f"Invalid timeout value: {value!r}")

endpoint pydantic-field

endpoint: str

The URL of the A2A server to connect to.

timeout pydantic-field

timeout: TimeoutTypes

Timeout configuration for the A2A client. Can be a float (total timeout) or a dict with connect/read/write/pool timeouts. See httpx.Timeout for more details.

agent_card_path pydantic-field

agent_card_path: str = '/.well-known/agent-card.json'

The path, on the remote url, to the agent card.

supported_protocol_bindings pydantic-field

supported_protocol_bindings: tuple[str, ...] = (
    "JSONRPC",
    "HTTP+JSON",
)

The supported A2A protocol bindings.

streaming pydantic-field

streaming: bool = True

Whether to enable streaming.

propagate_trace_context pydantic-field

propagate_trace_context: bool = True

Whether to inject the current trace context into outbound A2A requests. Set to False when calling third-party agents you do not own.