ant_ai.core.events
EventSource
EventSource = Literal['agent', 'action', 'workflow']
Sources where events are generated during a run.
EventOrigin
pydantic-model
Bases: BaseModel
Describes the origin of an event, used for tracing back to the source of an event in the system.
Show JSON schema:
{
"$defs": {
"EventSource": {
"enum": [
"agent",
"action",
"workflow"
],
"type": "string"
}
},
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"run_step": {
"default": 0,
"description": "Step index within the current run.",
"title": "Run Step",
"type": "integer"
}
},
"title": "EventOrigin",
"type": "object"
}
Fields:
-
layer(EventSource) -
node(str | None) -
agent(str | None) -
run_step(int)
Source code in src/ant_ai/core/events.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
layer
pydantic-field
layer: EventSource = 'agent'
The layer that emitted the event: agent, action, or workflow.
node
pydantic-field
node: str | None = None
Name of the workflow node where the event originated.
agent
pydantic-field
agent: str | None = None
Name of the agent that emitted the event, when it came from one.
run_step
pydantic-field
run_step: int = 0
Step index within the current run.
BaseEvent
pydantic-model
Bases: BaseModel
Fields shared by every event emitted during the execution of a workflow, action, or agent.
Carries no kind tag: each concrete event class declares its own, so
AnyEvent can discriminate on it. Annotate with BaseEvent wherever any
event is accepted.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"description": "Fields shared by every event emitted during the execution of a workflow, action, or agent.\n\nCarries no `kind` tag: each concrete event class declares its own, so\n`AnyEvent` can discriminate on it. Annotate with `BaseEvent` wherever any\nevent is accepted.",
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
}
},
"title": "BaseEvent",
"type": "object"
}
Fields:
-
origin(EventOrigin) -
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None)
Source code in src/ant_ai/core/events.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
origin
pydantic-field
origin: EventOrigin
Tracing information identifying where in the system the event was emitted.
content
pydantic-field
content: str = ''
Textual description of the event.
metadata
pydantic-field
metadata: dict[str, Any]
Additional information relevant to the event.
task_id
pydantic-field
task_id: str | None = None
A2A task ID populated from the raw transport event.
session_id
pydantic-field
session_id: str | None = None
Session ID of the conversation: from the raw transport event over A2A, from the ctx of a direct run.
Event
pydantic-model
Bases: BaseEvent
A generic event with no more specific type.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"description": "A generic event with no more specific type.",
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
},
"kind": {
"const": "event",
"default": "event",
"title": "Kind",
"type": "string"
}
},
"title": "Event",
"type": "object"
}
Fields:
-
origin(EventOrigin) -
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
kind(Literal['event'])
Source code in src/ant_ai/core/events.py
70 71 72 73 | |
AgentEvent
pydantic-model
Bases: BaseEvent
Base class for events emitted by the agent layer.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"description": "Base class for events emitted by the agent layer.",
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
}
},
"title": "AgentEvent",
"type": "object"
}
Fields:
-
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
origin(EventOrigin)
Source code in src/ant_ai/core/events.py
76 77 78 79 80 81 82 | |
origin
pydantic-field
origin: EventOrigin
Tracing information identifying where in the system the event was emitted.
ActionEvent
pydantic-model
Bases: BaseEvent
Base class for events emitted by the action layer.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"description": "Base class for events emitted by the action layer.",
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
}
},
"title": "ActionEvent",
"type": "object"
}
Fields:
-
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
origin(EventOrigin)
Source code in src/ant_ai/core/events.py
85 86 87 88 89 90 91 | |
origin
pydantic-field
origin: EventOrigin
Tracing information identifying where in the system the event was emitted.
WorkflowEvent
pydantic-model
Bases: BaseEvent
Base class for events emitted by the workflow layer.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"description": "Base class for events emitted by the workflow layer.",
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
}
},
"title": "WorkflowEvent",
"type": "object"
}
Fields:
-
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
origin(EventOrigin)
Source code in src/ant_ai/core/events.py
94 95 96 97 98 99 100 | |
origin
pydantic-field
origin: EventOrigin
Tracing information identifying where in the system the event was emitted.
StartEvent
pydantic-model
Bases: WorkflowEvent
Emitted when a workflow begins execution.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
},
"kind": {
"const": "start",
"default": "start",
"title": "Kind",
"type": "string"
}
},
"title": "StartEvent",
"type": "object"
}
Fields:
-
origin(EventOrigin) -
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
kind(Literal['start'])
Source code in src/ant_ai/core/events.py
103 104 105 106 | |
FinalAnswerEvent
pydantic-model
Bases: AgentEvent
Emitted when the agent produces its final answer.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
},
"kind": {
"const": "final_answer",
"default": "final_answer",
"title": "Kind",
"type": "string"
},
"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"
}
Fields:
-
origin(EventOrigin) -
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
kind(Literal['final_answer']) -
stream_id(str | None)
Source code in src/ant_ai/core/events.py
109 110 111 112 113 114 115 116 | |
stream_id
pydantic-field
stream_id: str | None = None
Correlates this event with the ContentDeltaEvents that preceded it, when streamed.
MaxStepsReachedEvent
pydantic-model
Bases: AgentEvent
Emitted when the agent exhausts its maximum allowed steps.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
},
"kind": {
"const": "max_steps_reached",
"default": "max_steps_reached",
"title": "Kind",
"type": "string"
}
},
"title": "MaxStepsReachedEvent",
"type": "object"
}
Fields:
-
origin(EventOrigin) -
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
kind(Literal['max_steps_reached'])
Source code in src/ant_ai/core/events.py
119 120 121 122 | |
ClarificationNeededEvent
pydantic-model
Bases: AgentEvent
Emitted when the agent requires human input to continue.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
},
"kind": {
"const": "input_required",
"default": "input_required",
"title": "Kind",
"type": "string"
}
},
"title": "ClarificationNeededEvent",
"type": "object"
}
Fields:
-
origin(EventOrigin) -
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
kind(Literal['input_required'])
Source code in src/ant_ai/core/events.py
125 126 127 128 | |
UpdateEvent
pydantic-model
Bases: WorkflowEvent
Emitted for intermediate status updates during execution.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
},
"kind": {
"const": "update",
"default": "update",
"title": "Kind",
"type": "string"
}
},
"title": "UpdateEvent",
"type": "object"
}
Fields:
-
origin(EventOrigin) -
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
kind(Literal['update'])
Source code in src/ant_ai/core/events.py
131 132 133 134 | |
ToolCallingEvent
pydantic-model
Bases: AgentEvent
Emitted when the agent decides to call one or more tools.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
},
"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"
},
"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"
}
},
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
},
"kind": {
"const": "tool_calling",
"default": "tool_calling",
"title": "Kind",
"type": "string"
},
"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"
}
Fields:
-
origin(EventOrigin) -
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
kind(Literal['tool_calling']) -
tool_calls(tuple[ToolCall, ...]) -
stream_id(str | None)
Source code in src/ant_ai/core/events.py
137 138 139 140 141 142 143 144 145 146 147 148 | |
tool_calls
pydantic-field
tool_calls: tuple[ToolCall, ...] = ()
The tool calls requested by the model.
stream_id
pydantic-field
stream_id: str | None = None
Correlates this event with the ContentDeltaEvents that preceded it, when streamed.
ToolResultEvent
pydantic-model
Bases: AgentEvent
Emitted when a tool call completes and its result is available.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
},
"kind": {
"const": "tool_result",
"default": "tool_result",
"title": "Kind",
"type": "string"
},
"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"
}
Fields:
-
origin(EventOrigin) -
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
kind(Literal['tool_result']) -
tool_call_id(str) -
name(str) -
is_error(bool)
Source code in src/ant_ai/core/events.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
tool_call_id
pydantic-field
tool_call_id: str = ''
ID of the tool call this result corresponds to.
name
pydantic-field
name: str = ''
Name of the tool that was called.
is_error
pydantic-field
is_error: bool = False
Whether the tool call failed (the tool raised).
ReasoningEvent
pydantic-model
Bases: AgentEvent
Emitted when the model produces reasoning/thinking content before its answer.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
},
"kind": {
"const": "reasoning",
"default": "reasoning",
"title": "Kind",
"type": "string"
},
"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"
}
Fields:
-
origin(EventOrigin) -
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
kind(Literal['reasoning']) -
stream_id(str | None)
Source code in src/ant_ai/core/events.py
169 170 171 172 173 174 175 176 | |
stream_id
pydantic-field
stream_id: str | None = None
Correlates this event with the ContentDeltaEvents that preceded it, when streamed.
CompletedEvent
pydantic-model
Bases: WorkflowEvent
Emitted when a workflow completes successfully.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
},
"kind": {
"const": "completed",
"default": "completed",
"title": "Kind",
"type": "string"
}
},
"title": "CompletedEvent",
"type": "object"
}
Fields:
-
origin(EventOrigin) -
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
kind(Literal['completed'])
Source code in src/ant_ai/core/events.py
179 180 181 182 | |
ContentDeltaEvent
pydantic-model
Bases: AgentEvent
Emitted for each incremental text fragment during live token-level streaming.
A generic delta bucket rather than one class per terminal event kind:
the model can interleave narrative text with tool calls, so whether a
fragment ultimately belongs to a FinalAnswerEvent or a
ToolCallingEvent is not knowable until the response finishes. Deltas
from one LLM generation share stream_id, which also appears on the
terminal whole event so consumers can correlate and close out a stream.
Show JSON schema:
{
"$defs": {
"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"
},
"agent": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the agent that emitted the event, when it came from one.",
"title": "Agent"
},
"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"
}
},
"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"
},
"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": "Session ID of the conversation: from the raw transport event over A2A, from the `ctx` of a direct run.",
"title": "Session Id"
},
"kind": {
"const": "content_delta",
"default": "content_delta",
"title": "Kind",
"type": "string"
},
"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"
}
Fields:
-
origin(EventOrigin) -
content(str) -
metadata(dict[str, Any]) -
task_id(str | None) -
session_id(str | None) -
kind(Literal['content_delta']) -
target_kind(Literal['reasoning', 'content', 'tool_calling']) -
delta(str) -
stream_id(str) -
is_first(bool) -
tool_call_index(int | None) -
tool_call_id(str | None) -
tool_call_name(str | None)
Source code in src/ant_ai/core/events.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
target_kind
pydantic-field
target_kind: Literal[
"reasoning", "content", "tool_calling"
] = "content"
Best-effort classification of what this fragment is building toward.
delta
pydantic-field
delta: str = ''
The newly streamed text fragment, not the accumulated content so far.
stream_id
pydantic-field
stream_id: str
Groups all deltas (and the terminal event) from one LLM generation call.
is_first
pydantic-field
is_first: bool = False
True only for the first delta of this stream_id/tool_call_index group.
tool_call_index
pydantic-field
tool_call_index: int | None = None
Index of the tool call this fragment belongs to, when target_kind is 'tool_calling'.
tool_call_id
pydantic-field
tool_call_id: str | None = None
Tool call ID, populated on the first fragment of a tool-call group.
tool_call_name
pydantic-field
tool_call_name: str | None = None
Tool call name, populated on the first fragment of a tool-call group.
event_to_message
event_to_message(event: BaseEvent) -> AnyMessage | None
Return the transcript message an event stands for, if it stands for one.
Replaying these messages after a run rebuilds what the model saw: tool
calls, their results, and the final answer. A run that stopped on a
clarification ends with the clarified call's result (its question), so the
user's reply can follow it directly. Every other event (reasoning, deltas,
status updates, the ClarificationNeededEvent itself) adds nothing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
BaseEvent
|
An event streamed from a run. |
required |
Returns:
| Type | Description |
|---|---|
AnyMessage | None
|
A |
AnyMessage | None
|
for a |
AnyMessage | None
|
|
Source code in src/ant_ai/core/events.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |