Available on crate feature
managed-agents-preview only.Expand description
Session events: typed user / agent / session / span events.
Communication with a session is event-based. You send user.*
events and receive agent.*, session.*, and span.* events back.
Every event in this module is forward-compatible: an unknown wire
type tag falls through to SessionEvent::Other preserving the
raw JSON, so brand-new server variants don’t break the build.
Structs§
- Agent
Message Event agent.message: text content blocks the agent emitted.- Agent
Thinking Event agent.thinking: extended-thinking content.- Agent
Thread Message Received Event agent.thread_message_received. The agent received a message from another thread (typically a sub-agent responding to the coordinator).- Agent
Thread Message Sent Event agent.thread_message_sent. The agent sent a message to another thread (typically the coordinator delegating to a sub-agent).- Agent
Tool Result Event agent.tool_result.- Agent
Tool UseEvent agent.tool_use: agent invokes a pre-built tool.- Event
Envelope - Common envelope fields present on most events. Used as the body of any event that has no additional payload beyond the envelope.
- Event
Stream streaming - SSE-backed stream of
SessionEvents for a Managed Agents session. - Events
- Namespace handle for session-events operations.
- Session
Error Event session.error. Includes a typed error payload with retry status.- Session
Status Idle Event session.status_idle. Carries an optionalstop_reasondescribing why the agent paused.- Session
Thread Created Event session.thread_created. Carries the new thread’s ID and the model the spawned agent runs against.- Span
Model Request EndEvent span.model_request_end. Includesmodel_usagewith token counts.- User
Custom Tool Result Event user.custom_tool_result: caller-side response to anagent.custom_tool_use.- User
Define Outcome Event user.define_outcome: define an outcome the agent works toward.- User
Message Event user.message: a text user message.- User
Tool Confirmation Event user.tool_confirmation: allow / deny a pending tool call.
Enums§
- Agent
Evaluated Permission - Permission verdict the platform applied to a pending tool call.
Returned on
AgentToolUseEventwhen the agent’s permission policy includesask. - Confirmation
Result allow/denyverdict forUserToolConfirmationEvent.- Known
Session Event - All event variants this SDK version recognizes.
- Known
Stop Reason - Stop-reason variants this SDK version knows about.
- Outcome
Rubric - Rubric source for an outcome.
- Outgoing
User Event - One event included in a
Events::sendcall. - Session
Event - One event on a Managed Agents session.
- Stop
Reason - Reason the session went idle. Forward-compatible: unknown
typetags fall through toSelf::Other. - User
Content Block - One block of content inside a
UserMessageEventorUserCustomToolResultEvent.
Type Aliases§
- Agent
Custom Tool UseEvent agent.custom_tool_use: agent invokes one of the caller’s custom tools. The session pauses; respond with anOutgoingUserEvent::CustomToolResult.- Agent
McpTool Result Event agent.mcp_tool_result.- Agent
McpTool UseEvent agent.mcp_tool_use: agent invokes an MCP server tool.