Skip to content

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"
    },
    "run_step": {
      "default": 0,
      "description": "Step index within the current run.",
      "title": "Run Step",
      "type": "integer"
    }
  },
  "title": "EventOrigin",
  "type": "object"
}

Fields:

Source code in src/ant_ai/core/events.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class EventOrigin(BaseModel):
    """Describes the origin of an event, used for tracing back to the source of an event in the system."""

    layer: EventSource = Field(
        default="agent",
        description="The layer that emitted the event: agent, action, or workflow.",
    )
    node: str | None = Field(
        default=None,
        description="Name of the workflow node where the event originated.",
    )
    run_step: int = Field(
        default=0,
        description="Step index within the current run.",
    )

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.

run_step pydantic-field

run_step: int = 0

Step index within the current run.

Event pydantic-model

Bases: BaseModel

Represents an event emitted during the execution of a workflow, action, or agent.

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"
        },
        "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": "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"
}

Fields:

Source code in src/ant_ai/core/events.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class Event(BaseModel):
    """Represents an event emitted during the execution of a workflow, action, or agent."""

    origin: EventOrigin = Field(
        default_factory=EventOrigin,
        description="Tracing information identifying where in the system the event was emitted.",
    )
    content: str = Field(
        default="",
        description="Textual description of the event.",
    )
    metadata: dict[str, Any] = Field(
        default_factory=dict,
        description="Additional information relevant to the event.",
    )
    kind: Literal["event"] = "event"
    task_id: str | None = Field(
        default=None,
        description="A2A task ID populated from the raw transport event.",
    )
    session_id: str | None = Field(
        default=None,
        description="A2A context/session ID populated from the raw transport event.",
    )

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

A2A context/session ID populated from the raw transport event.

AgentEvent pydantic-model

Bases: Event

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"
        },
        "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"
    },
    "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": "AgentEvent",
  "type": "object"
}

Fields:

Source code in src/ant_ai/core/events.py
56
57
58
59
60
61
62
class AgentEvent(Event):
    """Base class for events emitted by the agent layer."""

    origin: EventOrigin = Field(
        default_factory=lambda: EventOrigin(layer="agent"),
        description="Tracing information identifying where in the system the event was emitted.",
    )

origin pydantic-field

origin: EventOrigin

Tracing information identifying where in the system the event was emitted.

ActionEvent pydantic-model

Bases: Event

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"
        },
        "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"
    },
    "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": "ActionEvent",
  "type": "object"
}

Fields:

Source code in src/ant_ai/core/events.py
65
66
67
68
69
70
71
class ActionEvent(Event):
    """Base class for events emitted by the action layer."""

    origin: EventOrigin = Field(
        default_factory=lambda: EventOrigin(layer="action"),
        description="Tracing information identifying where in the system the event was emitted.",
    )

origin pydantic-field

origin: EventOrigin

Tracing information identifying where in the system the event was emitted.

WorkflowEvent pydantic-model

Bases: Event

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"
        },
        "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"
    },
    "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": "WorkflowEvent",
  "type": "object"
}

Fields:

Source code in src/ant_ai/core/events.py
74
75
76
77
78
79
80
class WorkflowEvent(Event):
    """Base class for events emitted by the workflow layer."""

    origin: EventOrigin = Field(
        default_factory=lambda: EventOrigin(layer="workflow"),
        description="Tracing information identifying where in the system the event was emitted.",
    )

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"
        },
        "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"
    },
    "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"
}

Fields:

Source code in src/ant_ai/core/events.py
83
84
85
86
class StartEvent(WorkflowEvent):
    """Emitted when a workflow begins execution."""

    kind: Literal["start"] = "start"

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"
        },
        "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"
    },
    "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"
}

Fields:

Source code in src/ant_ai/core/events.py
89
90
91
92
93
94
95
96
class FinalAnswerEvent(AgentEvent):
    """Emitted when the agent produces its final answer."""

    kind: Literal["final_answer"] = "final_answer"
    stream_id: str | None = Field(
        default=None,
        description="Correlates this event with the ContentDeltaEvents that preceded it, when streamed.",
    )

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"
        },
        "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"
    },
    "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"
}

Fields:

Source code in src/ant_ai/core/events.py
 99
100
101
102
class MaxStepsReachedEvent(AgentEvent):
    """Emitted when the agent exhausts its maximum allowed steps."""

    kind: Literal["max_steps_reached"] = "max_steps_reached"

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"
        },
        "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"
    },
    "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"
}

Fields:

Source code in src/ant_ai/core/events.py
105
106
107
108
class ClarificationNeededEvent(AgentEvent):
    """Emitted when the agent requires human input to continue."""

    kind: Literal["input_required"] = "input_required"

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"
        },
        "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"
    },
    "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"
}

Fields:

Source code in src/ant_ai/core/events.py
111
112
113
114
class UpdateEvent(WorkflowEvent):
    """Emitted for intermediate status updates during execution."""

    kind: Literal["update"] = "update"

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"
        },
        "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"
    },
    "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"
}

Fields:

Source code in src/ant_ai/core/events.py
117
118
119
120
121
122
123
124
125
126
127
128
class ToolCallingEvent(AgentEvent):
    """Emitted when the agent decides to call one or more tools."""

    kind: Literal["tool_calling"] = "tool_calling"
    tool_calls: tuple[ToolCall, ...] = Field(
        default=(),
        description="The tool calls requested by the model.",
    )
    stream_id: str | None = Field(
        default=None,
        description="Correlates this event with the ContentDeltaEvents that preceded it, when streamed.",
    )

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"
        },
        "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"
    },
    "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"
}

Fields:

Source code in src/ant_ai/core/events.py
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
class ToolResultEvent(AgentEvent):
    """Emitted when a tool call completes and its result is available."""

    kind: Literal["tool_result"] = "tool_result"
    tool_call_id: str = Field(
        default="",
        description="ID of the tool call this result corresponds to.",
    )
    name: str = Field(
        default="",
        description="Name of the tool that was called.",
    )
    is_error: bool = Field(
        default=False,
        description="Whether the tool call failed (the tool raised).",
    )

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"
        },
        "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"
    },
    "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"
}

Fields:

Source code in src/ant_ai/core/events.py
149
150
151
152
153
154
155
156
class ReasoningEvent(AgentEvent):
    """Emitted when the model produces reasoning/thinking content before its answer."""

    kind: Literal["reasoning"] = "reasoning"
    stream_id: str | None = Field(
        default=None,
        description="Correlates this event with the ContentDeltaEvents that preceded it, when streamed.",
    )

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"
        },
        "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"
    },
    "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"
}

Fields:

Source code in src/ant_ai/core/events.py
159
160
161
162
class CompletedEvent(WorkflowEvent):
    """Emitted when a workflow completes successfully."""

    kind: Literal["completed"] = "completed"

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"
        },
        "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"
    },
    "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"
}

Fields:

Source code in src/ant_ai/core/events.py
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
class ContentDeltaEvent(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.
    """

    kind: Literal["content_delta"] = "content_delta"
    target_kind: Literal["reasoning", "content", "tool_calling"] = Field(
        default="content",
        description="Best-effort classification of what this fragment is building toward.",
    )
    delta: str = Field(
        default="",
        description="The newly streamed text fragment, not the accumulated content so far.",
    )
    stream_id: str = Field(
        description="Groups all deltas (and the terminal event) from one LLM generation call.",
    )
    is_first: bool = Field(
        default=False,
        description="True only for the first delta of this stream_id/tool_call_index group.",
    )
    tool_call_index: int | None = Field(
        default=None,
        description="Index of the tool call this fragment belongs to, when target_kind is 'tool_calling'.",
    )
    tool_call_id: str | None = Field(
        default=None,
        description="Tool call ID, populated on the first fragment of a tool-call group.",
    )
    tool_call_name: str | None = Field(
        default=None,
        description="Tool call name, populated on the first fragment of a tool-call group.",
    )

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.