ant_ai.a2a.types
A2AMetadata
pydantic-model
Bases: BaseModel
Metadata for A2A interactions
Show JSON schema:
{
"$defs": {
"AnyEvent": {
"discriminator": {
"mapping": {
"completed": "#/$defs/CompletedEvent",
"content_delta": "#/$defs/ContentDeltaEvent",
"event": "#/$defs/Event",
"final_answer": "#/$defs/FinalAnswerEvent",
"input_required": "#/$defs/ClarificationNeededEvent",
"max_steps_reached": "#/$defs/MaxStepsReachedEvent",
"reasoning": "#/$defs/ReasoningEvent",
"start": "#/$defs/StartEvent",
"tool_calling": "#/$defs/ToolCallingEvent",
"tool_result": "#/$defs/ToolResultEvent",
"update": "#/$defs/UpdateEvent"
},
"propertyName": "kind"
},
"oneOf": [
{
"$ref": "#/$defs/Event"
},
{
"$ref": "#/$defs/StartEvent"
},
{
"$ref": "#/$defs/FinalAnswerEvent"
},
{
"$ref": "#/$defs/MaxStepsReachedEvent"
},
{
"$ref": "#/$defs/ClarificationNeededEvent"
},
{
"$ref": "#/$defs/UpdateEvent"
},
{
"$ref": "#/$defs/ToolCallingEvent"
},
{
"$ref": "#/$defs/ToolResultEvent"
},
{
"$ref": "#/$defs/ReasoningEvent"
},
{
"$ref": "#/$defs/CompletedEvent"
},
{
"$ref": "#/$defs/ContentDeltaEvent"
}
]
},
"ClarificationNeededEvent": {
"description": "Emitted when the agent requires human input to continue.",
"properties": {
"origin": {
"$ref": "#/$defs/EventOrigin",
"description": "Tracing information identifying where in the system the event was emitted."
},
"content": {
"default": "",
"description": "Textual description of the event.",
"title": "Content",
"type": "string"
},
"metadata": {
"additionalProperties": true,
"description": "Additional information relevant to the event.",
"title": "Metadata",
"type": "object"
},
"kind": {
"const": "input_required",
"default": "input_required",
"title": "Kind",
"type": "string"
},
"task_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A task ID populated from the raw transport event.",
"title": "Task Id"
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A context/session ID populated from the raw transport event.",
"title": "Session Id"
}
},
"title": "ClarificationNeededEvent",
"type": "object"
},
"CompletedEvent": {
"description": "Emitted when a workflow completes successfully.",
"properties": {
"origin": {
"$ref": "#/$defs/EventOrigin",
"description": "Tracing information identifying where in the system the event was emitted."
},
"content": {
"default": "",
"description": "Textual description of the event.",
"title": "Content",
"type": "string"
},
"metadata": {
"additionalProperties": true,
"description": "Additional information relevant to the event.",
"title": "Metadata",
"type": "object"
},
"kind": {
"const": "completed",
"default": "completed",
"title": "Kind",
"type": "string"
},
"task_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A task ID populated from the raw transport event.",
"title": "Task Id"
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A context/session ID populated from the raw transport event.",
"title": "Session Id"
}
},
"title": "CompletedEvent",
"type": "object"
},
"ContentDeltaEvent": {
"description": "Emitted for each incremental text fragment during live token-level streaming.\n\nA generic delta bucket rather than one class per terminal event kind:\nthe model can interleave narrative text with tool calls, so whether a\nfragment ultimately belongs to a `FinalAnswerEvent` or a\n`ToolCallingEvent` is not knowable until the response finishes. Deltas\nfrom one LLM generation share `stream_id`, which also appears on the\nterminal whole event so consumers can correlate and close out a stream.",
"properties": {
"origin": {
"$ref": "#/$defs/EventOrigin",
"description": "Tracing information identifying where in the system the event was emitted."
},
"content": {
"default": "",
"description": "Textual description of the event.",
"title": "Content",
"type": "string"
},
"metadata": {
"additionalProperties": true,
"description": "Additional information relevant to the event.",
"title": "Metadata",
"type": "object"
},
"kind": {
"const": "content_delta",
"default": "content_delta",
"title": "Kind",
"type": "string"
},
"task_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A task ID populated from the raw transport event.",
"title": "Task Id"
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A context/session ID populated from the raw transport event.",
"title": "Session Id"
},
"target_kind": {
"default": "content",
"description": "Best-effort classification of what this fragment is building toward.",
"enum": [
"reasoning",
"content",
"tool_calling"
],
"title": "Target Kind",
"type": "string"
},
"delta": {
"default": "",
"description": "The newly streamed text fragment, not the accumulated content so far.",
"title": "Delta",
"type": "string"
},
"stream_id": {
"description": "Groups all deltas (and the terminal event) from one LLM generation call.",
"title": "Stream Id",
"type": "string"
},
"is_first": {
"default": false,
"description": "True only for the first delta of this stream_id/tool_call_index group.",
"title": "Is First",
"type": "boolean"
},
"tool_call_index": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Index of the tool call this fragment belongs to, when target_kind is 'tool_calling'.",
"title": "Tool Call Index"
},
"tool_call_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Tool call ID, populated on the first fragment of a tool-call group.",
"title": "Tool Call Id"
},
"tool_call_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Tool call name, populated on the first fragment of a tool-call group.",
"title": "Tool Call Name"
}
},
"required": [
"stream_id"
],
"title": "ContentDeltaEvent",
"type": "object"
},
"Event": {
"description": "Represents an event emitted during the execution of a workflow, action, or agent.",
"properties": {
"origin": {
"$ref": "#/$defs/EventOrigin",
"description": "Tracing information identifying where in the system the event was emitted."
},
"content": {
"default": "",
"description": "Textual description of the event.",
"title": "Content",
"type": "string"
},
"metadata": {
"additionalProperties": true,
"description": "Additional information relevant to the event.",
"title": "Metadata",
"type": "object"
},
"kind": {
"const": "event",
"default": "event",
"title": "Kind",
"type": "string"
},
"task_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A task ID populated from the raw transport event.",
"title": "Task Id"
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A context/session ID populated from the raw transport event.",
"title": "Session Id"
}
},
"title": "Event",
"type": "object"
},
"EventOrigin": {
"description": "Describes the origin of an event, used for tracing back to the source of an event in the system.",
"properties": {
"layer": {
"$ref": "#/$defs/EventSource",
"default": "agent",
"description": "The layer that emitted the event: agent, action, or workflow."
},
"node": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the workflow node where the event originated.",
"title": "Node"
},
"run_step": {
"default": 0,
"description": "Step index within the current run.",
"title": "Run Step",
"type": "integer"
}
},
"title": "EventOrigin",
"type": "object"
},
"EventSource": {
"enum": [
"agent",
"action",
"workflow"
],
"type": "string"
},
"FinalAnswerEvent": {
"description": "Emitted when the agent produces its final answer.",
"properties": {
"origin": {
"$ref": "#/$defs/EventOrigin",
"description": "Tracing information identifying where in the system the event was emitted."
},
"content": {
"default": "",
"description": "Textual description of the event.",
"title": "Content",
"type": "string"
},
"metadata": {
"additionalProperties": true,
"description": "Additional information relevant to the event.",
"title": "Metadata",
"type": "object"
},
"kind": {
"const": "final_answer",
"default": "final_answer",
"title": "Kind",
"type": "string"
},
"task_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A task ID populated from the raw transport event.",
"title": "Task Id"
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A context/session ID populated from the raw transport event.",
"title": "Session Id"
},
"stream_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Correlates this event with the ContentDeltaEvents that preceded it, when streamed.",
"title": "Stream Id"
}
},
"title": "FinalAnswerEvent",
"type": "object"
},
"MaxStepsReachedEvent": {
"description": "Emitted when the agent exhausts its maximum allowed steps.",
"properties": {
"origin": {
"$ref": "#/$defs/EventOrigin",
"description": "Tracing information identifying where in the system the event was emitted."
},
"content": {
"default": "",
"description": "Textual description of the event.",
"title": "Content",
"type": "string"
},
"metadata": {
"additionalProperties": true,
"description": "Additional information relevant to the event.",
"title": "Metadata",
"type": "object"
},
"kind": {
"const": "max_steps_reached",
"default": "max_steps_reached",
"title": "Kind",
"type": "string"
},
"task_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A task ID populated from the raw transport event.",
"title": "Task Id"
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A context/session ID populated from the raw transport event.",
"title": "Session Id"
}
},
"title": "MaxStepsReachedEvent",
"type": "object"
},
"ReasoningEvent": {
"description": "Emitted when the model produces reasoning/thinking content before its answer.",
"properties": {
"origin": {
"$ref": "#/$defs/EventOrigin",
"description": "Tracing information identifying where in the system the event was emitted."
},
"content": {
"default": "",
"description": "Textual description of the event.",
"title": "Content",
"type": "string"
},
"metadata": {
"additionalProperties": true,
"description": "Additional information relevant to the event.",
"title": "Metadata",
"type": "object"
},
"kind": {
"const": "reasoning",
"default": "reasoning",
"title": "Kind",
"type": "string"
},
"task_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A task ID populated from the raw transport event.",
"title": "Task Id"
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A context/session ID populated from the raw transport event.",
"title": "Session Id"
},
"stream_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Correlates this event with the ContentDeltaEvents that preceded it, when streamed.",
"title": "Stream Id"
}
},
"title": "ReasoningEvent",
"type": "object"
},
"StartEvent": {
"description": "Emitted when a workflow begins execution.",
"properties": {
"origin": {
"$ref": "#/$defs/EventOrigin",
"description": "Tracing information identifying where in the system the event was emitted."
},
"content": {
"default": "",
"description": "Textual description of the event.",
"title": "Content",
"type": "string"
},
"metadata": {
"additionalProperties": true,
"description": "Additional information relevant to the event.",
"title": "Metadata",
"type": "object"
},
"kind": {
"const": "start",
"default": "start",
"title": "Kind",
"type": "string"
},
"task_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A task ID populated from the raw transport event.",
"title": "Task Id"
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A context/session ID populated from the raw transport event.",
"title": "Session Id"
}
},
"title": "StartEvent",
"type": "object"
},
"ToolCall": {
"description": "Single tool call object inside assistant.tool_calls (OpenAI schema).",
"properties": {
"id": {
"title": "Id",
"type": "string"
},
"type": {
"default": "function",
"title": "Type",
"type": "string"
},
"function": {
"$ref": "#/$defs/ToolFunction"
}
},
"required": [
"id",
"function"
],
"title": "ToolCall",
"type": "object"
},
"ToolCallingEvent": {
"description": "Emitted when the agent decides to call one or more tools.",
"properties": {
"origin": {
"$ref": "#/$defs/EventOrigin",
"description": "Tracing information identifying where in the system the event was emitted."
},
"content": {
"default": "",
"description": "Textual description of the event.",
"title": "Content",
"type": "string"
},
"metadata": {
"additionalProperties": true,
"description": "Additional information relevant to the event.",
"title": "Metadata",
"type": "object"
},
"kind": {
"const": "tool_calling",
"default": "tool_calling",
"title": "Kind",
"type": "string"
},
"task_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A task ID populated from the raw transport event.",
"title": "Task Id"
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A context/session ID populated from the raw transport event.",
"title": "Session Id"
},
"tool_calls": {
"default": [],
"description": "The tool calls requested by the model.",
"items": {
"$ref": "#/$defs/ToolCall"
},
"title": "Tool Calls",
"type": "array"
},
"stream_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Correlates this event with the ContentDeltaEvents that preceded it, when streamed.",
"title": "Stream Id"
}
},
"title": "ToolCallingEvent",
"type": "object"
},
"ToolFunction": {
"description": "Inner function payload for a tool call (OpenAI schema).",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"arguments": {
"title": "Arguments",
"type": "string"
}
},
"required": [
"name",
"arguments"
],
"title": "ToolFunction",
"type": "object"
},
"ToolResultEvent": {
"description": "Emitted when a tool call completes and its result is available.",
"properties": {
"origin": {
"$ref": "#/$defs/EventOrigin",
"description": "Tracing information identifying where in the system the event was emitted."
},
"content": {
"default": "",
"description": "Textual description of the event.",
"title": "Content",
"type": "string"
},
"metadata": {
"additionalProperties": true,
"description": "Additional information relevant to the event.",
"title": "Metadata",
"type": "object"
},
"kind": {
"const": "tool_result",
"default": "tool_result",
"title": "Kind",
"type": "string"
},
"task_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A task ID populated from the raw transport event.",
"title": "Task Id"
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A context/session ID populated from the raw transport event.",
"title": "Session Id"
},
"tool_call_id": {
"default": "",
"description": "ID of the tool call this result corresponds to.",
"title": "Tool Call Id",
"type": "string"
},
"name": {
"default": "",
"description": "Name of the tool that was called.",
"title": "Name",
"type": "string"
},
"is_error": {
"default": false,
"description": "Whether the tool call failed (the tool raised).",
"title": "Is Error",
"type": "boolean"
}
},
"title": "ToolResultEvent",
"type": "object"
},
"UpdateEvent": {
"description": "Emitted for intermediate status updates during execution.",
"properties": {
"origin": {
"$ref": "#/$defs/EventOrigin",
"description": "Tracing information identifying where in the system the event was emitted."
},
"content": {
"default": "",
"description": "Textual description of the event.",
"title": "Content",
"type": "string"
},
"metadata": {
"additionalProperties": true,
"description": "Additional information relevant to the event.",
"title": "Metadata",
"type": "object"
},
"kind": {
"const": "update",
"default": "update",
"title": "Kind",
"type": "string"
},
"task_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A task ID populated from the raw transport event.",
"title": "Task Id"
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A2A context/session ID populated from the raw transport event.",
"title": "Session Id"
}
},
"title": "UpdateEvent",
"type": "object"
}
},
"description": "Metadata for A2A interactions",
"properties": {
"event": {
"anyOf": [
{
"$ref": "#/$defs/AnyEvent"
},
{
"type": "null"
}
],
"default": null
}
},
"title": "A2AMetadata",
"type": "object"
}
Config:
frozen:True
Fields:
-
event(AnyEvent | None)
Source code in src/ant_ai/a2a/types.py
6 7 8 9 10 11 | |