SSE Messages
Server-Sent Event (SSE) message types and models for the Airia API.
This module defines all possible SSE message types that can be received during pipeline execution, including agent lifecycle events, processing steps, model streaming, and tool execution messages.
AgentAgentCardMessage
Bases: BaseStatusMessage
Message indicating that an agent card step is being processed.
Agent cards represent interactive UI components or displays that provide rich information to users during pipeline execution.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_AGENT_CARD for agent card messages. |
agent_id |
str
|
Unique identifier for the agent processing the card. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
step_name |
str
|
The name of the agent card step being processed. |
AgentAgentCardStreamEndMessage
Bases: BaseAgentAgentCardStreamMessage
Message indicating that agent card streaming has completed.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_AGENT_CARD_STREAM_END for card stream end messages. |
agent_id |
str
|
Unique identifier for the agent performing the streaming. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
stream_id |
str
|
Unique identifier for the streaming session. |
content |
Optional[str]
|
Optional final content for the agent card. |
AgentAgentCardStreamErrorMessage
Bases: BaseAgentAgentCardStreamMessage
Message indicating that an error occurred during agent card streaming.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_AGENT_CARD_STREAM_ERROR for card stream error messages. |
agent_id |
str
|
Unique identifier for the agent performing the streaming. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
stream_id |
str
|
Unique identifier for the streaming session. |
error_message |
str
|
Description of the error that occurred during card streaming. |
AgentAgentCardStreamFragmentMessage
Bases: BaseAgentAgentCardStreamMessage
Fragment of streaming agent card content.
These messages contain individual chunks of agent card data as they are generated, allowing for real-time UI updates.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_AGENT_CARD_STREAM_FRAGMENT for card fragment messages. |
agent_id |
str
|
Unique identifier for the agent performing the streaming. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
stream_id |
str
|
Unique identifier for the streaming session. |
index |
int
|
The sequential index of this fragment within the stream. |
content |
Optional[str]
|
The card content of this fragment, or None if no content. |
AgentAgentCardStreamStartMessage
Bases: BaseAgentAgentCardStreamMessage
Message indicating that agent card streaming has begun.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_AGENT_CARD_STREAM_START for card stream start messages. |
agent_id |
str
|
Unique identifier for the agent performing the streaming. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
stream_id |
str
|
Unique identifier for the streaming session. |
content |
Optional[str]
|
Optional initial content for the agent card. |
AgentDatasearchMessage
Bases: BaseStatusMessage
Message indicating that data source search is being performed.
This message is sent when an agent is querying or searching through configured data sources to retrieve relevant information.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_DATASEARCH for data search messages. |
agent_id |
str
|
Unique identifier for the agent performing the search. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
datastore_id |
str
|
Unique identifier for the data source being searched. |
datastore_type |
str
|
The type of data source (e.g., 'database', 'file', 'api'). |
datastore_name |
str
|
Human-readable name of the data source. |
AgentEndMessage
Bases: BaseAgentMessage
Message indicating that an agent has finished processing.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_END for agent end messages. |
agent_id |
str
|
Unique identifier for the agent that finished. |
execution_id |
str
|
Unique identifier for the execution session. |
AgentInputMessage
Bases: BaseAgentMessage
Message indicating that an agent has received input to process.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_INPUT for agent input messages. |
agent_id |
str
|
Unique identifier for the agent receiving input. |
execution_id |
str
|
Unique identifier for the execution session. |
AgentInvocationMessage
Bases: BaseStatusMessage
Message indicating that another agent is being invoked.
This occurs when the current agent calls or delegates work to another specialized agent in the pipeline.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_INVOCATION for agent invocation messages. |
agent_id |
str
|
Unique identifier for the agent making the invocation. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
agent_name |
str
|
The name of the agent being invoked. |
AgentModelMessage
Bases: BaseStatusMessage
Message indicating that a language model is being called.
This message is sent when an agent begins interacting with a language model for text generation or processing.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_MODEL for model messages. |
agent_id |
str
|
Unique identifier for the agent calling the model. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
model_name |
str
|
The name of the language model being called. |
AgentModelStreamEndMessage
Bases: BaseModelStreamMessage
Message indicating that model text streaming has completed.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_MODEL_STREAM_END for stream end messages. |
agent_id |
str
|
Unique identifier for the agent performing the streaming. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
stream_id |
str
|
Unique identifier for the streaming session. |
content_id |
str
|
Unique identifier for the generated content. |
duration |
Optional[float]
|
Optional duration of the streaming session in seconds. |
AgentModelStreamErrorMessage
Bases: BaseModelStreamMessage
Message indicating that an error occurred during model streaming.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_MODEL_STREAM_ERROR for stream error messages. |
agent_id |
str
|
Unique identifier for the agent performing the streaming. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
stream_id |
str
|
Unique identifier for the streaming session. |
error_message |
str
|
Description of the error that occurred during streaming. |
AgentModelStreamFragmentMessage
Bases: BaseModelStreamMessage
Fragment of streaming text content from a language model.
These messages contain individual chunks of text as they are generated by the model, allowing for real-time display of results.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_MODEL_STREAM_FRAGMENT for fragment messages. |
agent_id |
str
|
Unique identifier for the agent performing the streaming. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
stream_id |
str
|
Unique identifier for the streaming session. |
index |
int
|
The sequential index of this fragment within the stream. |
content |
Optional[str]
|
The text content of this fragment, or None if no content. |
AgentModelStreamStartMessage
Bases: BaseModelStreamMessage
Message indicating that model text streaming has begun.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_MODEL_STREAM_START for stream start messages. |
agent_id |
str
|
Unique identifier for the agent performing the streaming. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
stream_id |
str
|
Unique identifier for the streaming session. |
model_name |
str
|
The name of the language model being streamed. |
AgentModelStreamUsageMessage
Bases: BaseModelStreamMessage
Message containing token usage and cost information for model calls.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_MODEL_STREAM_USAGE for usage messages. |
agent_id |
str
|
Unique identifier for the agent performing the streaming. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
stream_id |
str
|
Unique identifier for the streaming session. |
token |
Optional[int]
|
Optional number of tokens used during the model call. |
tokens_cost |
Optional[float]
|
Optional cost in dollars for the tokens used. |
AgentOutputMessage
Bases: BaseStepMessage
Message containing the output result from a completed step.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_OUTPUT for output messages. |
agent_id |
str
|
Unique identifier for the agent that produced the output. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step that generated output. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
step_result |
str
|
The output result or content from the completed step. |
AgentPingMessage
Bases: BaseSSEMessage
Ping message sent periodically to maintain connection health.
These messages help verify that the connection is still active during long-running pipeline executions.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_PING for ping messages. |
timestamp |
datetime
|
The time when the ping message was sent. |
AgentPythonCodeMessage
Bases: BaseStatusMessage
Message indicating that Python code execution is taking place.
This message is sent when an agent executes custom Python code blocks as part of its processing workflow.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_PYTHON_CODE for Python code messages. |
agent_id |
str
|
Unique identifier for the agent executing the code. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
step_name |
str
|
The name of the Python code step being executed. |
AgentStartMessage
Bases: BaseAgentMessage
Message indicating that an agent has started processing.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_START for agent start messages. |
agent_id |
str
|
Unique identifier for the agent that started. |
execution_id |
str
|
Unique identifier for the execution session. |
AgentStepEndMessage
Bases: BaseStepMessage
Message indicating that a processing step has completed.
Includes timing information and the final status of the step.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_STEP_END for step end messages. |
agent_id |
str
|
Unique identifier for the agent performing the step. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step that ended. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
end_time |
datetime
|
The timestamp when the step completed execution. |
duration |
time
|
The total time the step took to execute. |
status |
str
|
The final status of the step (e.g., 'success', 'failed'). |
AgentStepHaltMessage
Bases: BaseStepMessage
Message indicating that a step has been halted pending approval.
This occurs when human approval is required before proceeding with potentially sensitive or high-impact operations.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_STEP_HALT for step halt messages. |
agent_id |
str
|
Unique identifier for the agent performing the step. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step that was halted. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
approval_id |
str
|
Unique identifier for the approval request. |
AgentStepStartMessage
Bases: BaseStepMessage
Message indicating that a processing step has started.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_STEP_START for step start messages. |
agent_id |
str
|
Unique identifier for the agent performing the step. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step that started. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
start_time |
datetime
|
The timestamp when the step began execution. |
AgentToolActionMessage
Bases: BaseStatusMessage
Message indicating that a tool or external service is being called.
This message is sent when an agent invokes an external tool, API, or service to perform a specific action or retrieve data.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_TOOL_ACTION for tool action messages. |
agent_id |
str
|
Unique identifier for the agent calling the tool. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
step_name |
str
|
The name of the tool action step being performed. |
tool_name |
str
|
The name of the external tool being called. |
AgentToolRequestMessage
Bases: BaseAgentToolMessage
Message indicating that a tool request has been initiated.
This message is sent when an agent begins calling an external tool or service to perform a specific operation.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_TOOL_REQUEST for tool request messages. |
agent_id |
str
|
Unique identifier for the agent making the tool request. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
id |
str
|
Unique identifier for the tool execution. |
name |
str
|
The name of the tool being requested. |
AgentToolResponseMessage
Bases: BaseAgentToolMessage
Message indicating that a tool request has completed.
This message contains the results and timing information from a completed tool or service call.
Attributes:
| Name | Type | Description |
|---|---|---|
message_type |
MessageType
|
Always set to AGENT_TOOL_RESPONSE for tool response messages. |
agent_id |
str
|
Unique identifier for the agent that made the tool request. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
id |
str
|
Unique identifier for the tool execution. |
name |
str
|
The name of the tool that was executed. |
duration |
time
|
The time it took for the tool to complete execution. |
success |
bool
|
Whether the tool execution was successful. |
BaseAgentAgentCardStreamMessage
Bases: BaseAgentMessage
Base class for agent card streaming messages.
Agent card streaming allows real-time updates to interactive UI components during their generation or processing.
Attributes:
| Name | Type | Description |
|---|---|---|
agent_id |
str
|
Unique identifier for the agent performing the streaming. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
stream_id |
str
|
Unique identifier for the streaming session. |
BaseAgentMessage
Bases: BaseSSEMessage
Base class for messages related to agent execution.
All agent messages include identifiers for the specific agent and execution session.
Attributes:
| Name | Type | Description |
|---|---|---|
agent_id |
str
|
Unique identifier for the agent generating this message. |
execution_id |
str
|
Unique identifier for the current execution session. |
BaseAgentToolMessage
Bases: BaseStepMessage
Base class for tool execution messages.
Tool messages track the lifecycle of external tool or service calls made by agents during pipeline execution.
Attributes:
| Name | Type | Description |
|---|---|---|
agent_id |
str
|
Unique identifier for the agent performing the step. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
id |
str
|
Unique identifier for the tool execution. |
name |
str
|
The name of the tool being executed. |
BaseModelStreamMessage
Bases: BaseAgentMessage
Base class for language model streaming messages.
Model streaming allows real-time display of text generation as it occurs, providing better user experience for long responses.
Attributes:
| Name | Type | Description |
|---|---|---|
agent_id |
str
|
Unique identifier for the agent performing the streaming. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
stream_id |
str
|
Unique identifier for the streaming session. |
BaseStatusMessage
Bases: BaseStepMessage
Base class for status update messages within processing steps.
Status messages provide real-time updates about what operations are being performed during step execution.
Attributes:
| Name | Type | Description |
|---|---|---|
agent_id |
str
|
Unique identifier for the agent performing the step. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
BaseStepMessage
Bases: BaseAgentMessage
Base class for messages related to individual processing steps within an agent.
Steps represent discrete operations or tasks that an agent performs as part of its overall processing workflow.
Attributes:
| Name | Type | Description |
|---|---|---|
agent_id |
str
|
Unique identifier for the agent performing the step. |
execution_id |
str
|
Unique identifier for the execution session. |
step_id |
str
|
Unique identifier for the processing step. |
step_type |
str
|
The type/category of the processing step. |
step_title |
Optional[str]
|
Optional human-readable title for the step. |
MessageType
Bases: str, Enum
Enumeration of all possible SSE message types from the Airia API.
These message types correspond to different events that occur during pipeline execution, agent processing, and streaming responses.
Attributes:
| Name | Type | Description |
|---|---|---|
AGENT_PING |
str
|
Ping message sent periodically to maintain connection health. |
AGENT_START |
str
|
Message indicating that an agent has started processing. |
AGENT_INPUT |
str
|
Message indicating that an agent has received input to process. |
AGENT_END |
str
|
Message indicating that an agent has finished processing. |
AGENT_STEP_START |
str
|
Message indicating that a processing step has started. |
AGENT_STEP_HALT |
str
|
Message indicating that a step has been halted pending approval. |
AGENT_STEP_END |
str
|
Message indicating that a processing step has completed. |
AGENT_OUTPUT |
str
|
Message containing the output result from a completed step. |
AGENT_AGENT_CARD |
str
|
Message indicating that an agent card step is being processed. |
AGENT_DATASEARCH |
str
|
Message indicating that data source search is being performed. |
AGENT_INVOCATION |
str
|
Message indicating that another agent is being invoked. |
AGENT_MODEL |
str
|
Message indicating that a language model is being called. |
AGENT_PYTHON_CODE |
str
|
Message indicating that Python code execution is taking place. |
AGENT_TOOL_ACTION |
str
|
Message indicating that a tool or external service is being called. |
AGENT_MODEL_STREAM_START |
str
|
Message indicating that model text streaming has begun. |
AGENT_MODEL_STREAM_END |
str
|
Message indicating that model text streaming has completed. |
AGENT_MODEL_STREAM_ERROR |
str
|
Message indicating that an error occurred during model streaming. |
AGENT_MODEL_STREAM_USAGE |
str
|
Message containing token usage and cost information for model calls. |
AGENT_MODEL_STREAM_FRAGMENT |
str
|
Fragment of streaming text content from a language model. |
MODEL_STREAM_FRAGMENT |
str
|
Alternative fragment message type for model streaming. |
AGENT_AGENT_CARD_STREAM_START |
str
|
Message indicating that agent card streaming has begun. |
AGENT_AGENT_CARD_STREAM_ERROR |
str
|
Message indicating that an error occurred during agent card streaming. |
AGENT_AGENT_CARD_STREAM_FRAGMENT |
str
|
Fragment of streaming agent card content. |
AGENT_AGENT_CARD_STREAM_END |
str
|
Message indicating that agent card streaming has completed. |
AGENT_TOOL_REQUEST |
str
|
Message indicating that a tool request has been initiated. |
AGENT_TOOL_RESPONSE |
str
|
Message indicating that a tool request has completed. |