ant_ai.a2a.types
A2AMetadata
pydantic-model
Bases: BaseModel
Metadata for A2A interactions
Show JSON schema:
{
"$defs": {
"AnyEvent": {
"discriminator": {
"mapping": {
"completed": "#/$defs/CompletedEvent",
"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"
}
]
},
"AnyMessage": {
"discriminator": {
"mapping": {
"message": "#/$defs/Message",
"tool_call": "#/$defs/ToolCallMessage",
"tool_call_result": "#/$defs/ToolCallResultMessage"
},
"propertyName": "kind"
},
"oneOf": [
{
"$ref": "#/$defs/Message"
},
{
"$ref": "#/$defs/ToolCallMessage"
},
{
"$ref": "#/$defs/ToolCallResultMessage"
}
]
},
"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"
},
"message": {
"anyOf": [
{
"$ref": "#/$defs/AnyMessage"
},
{
"type": "null"
}
],
"default": null,
"description": "Message associated with the event. Only set for events tied to conversation messages."
},
"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"
},
"message": {
"anyOf": [
{
"$ref": "#/$defs/AnyMessage"
},
{
"type": "null"
}
],
"default": null,
"description": "Message associated with the event. Only set for events tied to conversation messages."
},
"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"
},
"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"
},
"message": {
"anyOf": [
{
"$ref": "#/$defs/AnyMessage"
},
{
"type": "null"
}
],
"default": null,
"description": "Message associated with the event. Only set for events tied to conversation messages."
},
"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"
},
"message": {
"anyOf": [
{
"$ref": "#/$defs/AnyMessage"
},
{
"type": "null"
}
],
"default": null,
"description": "Message associated with the event. Only set for events tied to conversation messages."
},
"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"
}
},
"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"
},
"message": {
"anyOf": [
{
"$ref": "#/$defs/AnyMessage"
},
{
"type": "null"
}
],
"default": null,
"description": "Message associated with the event. Only set for events tied to conversation messages."
},
"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"
},
"Message": {
"description": "Generic message used in a conversation",
"properties": {
"kind": {
"const": "message",
"default": "message",
"title": "Kind",
"type": "string"
},
"role": {
"title": "Role",
"type": "string"
},
"content": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Content"
},
"metadata": {
"additionalProperties": true,
"title": "Metadata",
"type": "object"
}
},
"required": [
"role"
],
"title": "Message",
"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"
},
"message": {
"anyOf": [
{
"$ref": "#/$defs/AnyMessage"
},
{
"type": "null"
}
],
"default": null,
"description": "Message associated with the event. Only set for events tied to conversation messages."
},
"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"
}
},
"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"
},
"message": {
"anyOf": [
{
"$ref": "#/$defs/AnyMessage"
},
{
"type": "null"
}
],
"default": null,
"description": "Message associated with the event. Only set for events tied to conversation messages."
},
"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"
},
"ToolCallMessage": {
"description": "Message representing a tool call in a conversation",
"properties": {
"kind": {
"const": "tool_call",
"default": "tool_call",
"title": "Kind",
"type": "string"
},
"role": {
"default": "assistant",
"title": "Role",
"type": "string"
},
"content": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Content"
},
"metadata": {
"additionalProperties": true,
"title": "Metadata",
"type": "object"
},
"tool_calls": {
"items": {
"$ref": "#/$defs/ToolCall"
},
"title": "Tool Calls",
"type": "array"
}
},
"required": [
"tool_calls"
],
"title": "ToolCallMessage",
"type": "object"
},
"ToolCallResultMessage": {
"description": "Message representing the result of a tool call in a conversation",
"properties": {
"kind": {
"const": "tool_call_result",
"default": "tool_call_result",
"title": "Kind",
"type": "string"
},
"role": {
"default": "tool",
"title": "Role",
"type": "string"
},
"content": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Content"
},
"metadata": {
"additionalProperties": true,
"title": "Metadata",
"type": "object"
},
"tool_call_id": {
"title": "Tool Call Id",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
}
},
"required": [
"tool_call_id",
"name"
],
"title": "ToolCallResultMessage",
"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"
},
"message": {
"anyOf": [
{
"$ref": "#/$defs/AnyMessage"
},
{
"type": "null"
}
],
"default": null,
"description": "Message associated with the event. Only set for events tied to conversation messages."
},
"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"
}
},
"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"
},
"message": {
"anyOf": [
{
"$ref": "#/$defs/AnyMessage"
},
{
"type": "null"
}
],
"default": null,
"description": "Message associated with the event. Only set for events tied to conversation messages."
},
"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"
}
},
"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"
},
"message": {
"anyOf": [
{
"$ref": "#/$defs/AnyMessage"
},
{
"type": "null"
}
],
"default": null,
"description": "Message associated with the event. Only set for events tied to conversation messages."
},
"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 | |