Skip to main content

Module events

Module events 

Source
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§

AgentMessageEvent
agent.message: text content blocks the agent emitted.
AgentThinkingEvent
agent.thinking: extended-thinking content.
AgentThreadMessageReceivedEvent
agent.thread_message_received. The agent received a message from another thread (typically a sub-agent responding to the coordinator).
AgentThreadMessageSentEvent
agent.thread_message_sent. The agent sent a message to another thread (typically the coordinator delegating to a sub-agent).
AgentToolResultEvent
agent.tool_result.
AgentToolUseEvent
agent.tool_use: agent invokes a pre-built tool.
EventEnvelope
Common envelope fields present on most events. Used as the body of any event that has no additional payload beyond the envelope.
EventStreamstreaming
SSE-backed stream of SessionEvents for a Managed Agents session.
Events
Namespace handle for session-events operations.
SessionErrorEvent
session.error. Includes a typed error payload with retry status.
SessionStatusIdleEvent
session.status_idle. Carries an optional stop_reason describing why the agent paused.
SessionThreadCreatedEvent
session.thread_created. Carries the new thread’s ID and the model the spawned agent runs against.
SpanModelRequestEndEvent
span.model_request_end. Includes model_usage with token counts.
UserCustomToolResultEvent
user.custom_tool_result: caller-side response to an agent.custom_tool_use.
UserDefineOutcomeEvent
user.define_outcome: define an outcome the agent works toward.
UserMessageEvent
user.message: a text user message.
UserToolConfirmationEvent
user.tool_confirmation: allow / deny a pending tool call.

Enums§

AgentEvaluatedPermission
Permission verdict the platform applied to a pending tool call. Returned on AgentToolUseEvent when the agent’s permission policy includes ask.
ConfirmationResult
allow / deny verdict for UserToolConfirmationEvent.
KnownSessionEvent
All event variants this SDK version recognizes.
KnownStopReason
Stop-reason variants this SDK version knows about.
OutcomeRubric
Rubric source for an outcome.
OutgoingUserEvent
One event included in a Events::send call.
SessionEvent
One event on a Managed Agents session.
StopReason
Reason the session went idle. Forward-compatible: unknown type tags fall through to Self::Other.
UserContentBlock
One block of content inside a UserMessageEvent or UserCustomToolResultEvent.

Type Aliases§

AgentCustomToolUseEvent
agent.custom_tool_use: agent invokes one of the caller’s custom tools. The session pauses; respond with an OutgoingUserEvent::CustomToolResult.
AgentMcpToolResultEvent
agent.mcp_tool_result.
AgentMcpToolUseEvent
agent.mcp_tool_use: agent invokes an MCP server tool.