Skip to main content

class ActionEvent

Bases: LLMConvertibleEvent

Properties

  • action: Action | None
  • kind: Literal[‘ActionEvent’]
  • llm_response_id: str
  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • reasoning_content: str | None
  • responses_reasoning_item: ReasoningItemModel | None
  • security_risk: SecurityRisk
  • source: Literal[‘agent’, ‘user’, ‘environment’]
  • thinking_blocks: list[ThinkingBlock | RedactedThinkingBlock]
  • thought: Sequence[TextContent]
  • tool_call: MessageToolCall
  • tool_call_id: str
  • tool_name: str
  • visualize: Text Return Rich Text representation of this action event.

Methods

to_llm_message()

Individual message - may be incomplete for multi-action batches

class AgentErrorEvent

Bases: ObservationBaseEvent Error triggered by the agent. Note: This event should not contain model “thought” or “reasoning_content”. It represents an error produced by the agent/scaffold, not model output.

Properties

  • error: str
  • kind: Literal[‘AgentErrorEvent’]
  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • source: Literal[‘agent’, ‘user’, ‘environment’]
  • visualize: Text Return Rich Text representation of this agent error event.

Methods

to_llm_message()

class Condensation

Bases: Event This action indicates a condensation of the conversation history is happening.

Properties

  • forgotten_event_ids: list[str]
  • kind: Literal[‘Condensation’]
  • llm_response_id: str
  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • source: Literal[‘agent’, ‘user’, ‘environment’]
  • summary: str | None
  • summary_offset: int | None
  • visualize: Text Return Rich Text representation of this event. This is a fallback implementation for unknown event types. Subclasses should override this method to provide specific visualization.

class CondensationRequest

Bases: Event This action is used to request a condensation of the conversation history.

Properties

  • kind: Literal[‘CondensationRequest’]
  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • source: Literal[‘agent’, ‘user’, ‘environment’]

Methods

action

The action type, namely ActionType.CONDENSATION_REQUEST.
  • Type: str

class CondensationSummaryEvent

Bases: LLMConvertibleEvent This event represents a summary generated by a condenser.

Properties

  • kind: Literal[‘CondensationSummaryEvent’]
  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • source: Literal[‘agent’, ‘user’, ‘environment’]
  • summary: str The summary text.

Methods

to_llm_message()

class ConversationStateUpdateEvent

Bases: Event Event that contains conversation state updates. This event is sent via websocket whenever the conversation state changes, allowing remote clients to stay in sync without making REST API calls. All fields are serialized versions of the corresponding ConversationState fields to ensure compatibility with websocket transmission.

Properties

  • key: str
  • kind: Literal[‘ConversationStateUpdateEvent’]
  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • source: Literal[‘agent’, ‘user’, ‘environment’]
  • value: Any

Methods

classmethod from_conversation_state()

Create a state update event from a ConversationState object. This creates an event containing a snapshot of important state fields.
  • Parameters:
    • state – The ConversationState to serialize
    • conversation_id – The conversation ID for the event
  • Returns: A ConversationStateUpdateEvent with serialized state data

classmethod validate_key()

classmethod validate_value()

class Event

Bases: DiscriminatedUnionMixin, ABC Base class for all events.

Properties

  • id: str
  • kind: str
  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • source: Literal[‘agent’, ‘user’, ‘environment’]
  • timestamp: str
  • visualize: Text Return Rich Text representation of this event. This is a fallback implementation for unknown event types. Subclasses should override this method to provide specific visualization.

class LLMConvertibleEvent

Bases: Event, ABC Base class for events that can be converted to LLM messages.

Properties

  • id: EventID
  • kind: str
  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • source: SourceType
  • timestamp: str

Methods

static events_to_messages()

Convert event stream to LLM message stream, handling multi-action batches

abstractmethod to_llm_message()

class MessageEvent

Bases: LLMConvertibleEvent Message from either agent or user. This is originally the “MessageAction”, but it suppose not to be tool call.

Properties

  • activated_skills: list[str]
  • extended_content: list[TextContent]
  • id: EventID
  • kind: Literal[‘MessageEvent’]
  • llm_message: Message
  • llm_response_id: str | None
  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • reasoning_content: str
  • source: Literal[‘agent’, ‘user’, ‘environment’]
  • thinking_blocks: Sequence[ThinkingBlock | RedactedThinkingBlock] Return the Anthropic thinking blocks from the LLM message.
  • timestamp: str
  • visualize: Text Return Rich Text representation of this message event.

Methods

to_llm_message()

class ObservationBaseEvent

Bases: LLMConvertibleEvent Base class for anything as a response to a tool call. Examples include tool execution, error, user reject.

Properties

  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • source: Literal[‘agent’, ‘user’, ‘environment’]
  • tool_call_id: str
  • tool_name: str

class ObservationEvent

Bases: ObservationBaseEvent

Properties

  • action_id: str
  • kind: Literal[‘ObservationEvent’]
  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • observation: Observation
  • visualize: Text Return Rich Text representation of this observation event.

Methods

to_llm_message()

class PauseEvent

Bases: Event Event indicating that the agent execution was paused by user request.

Properties

  • kind: Literal[‘PauseEvent’]
  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • source: Literal[‘agent’, ‘user’, ‘environment’]
  • visualize: Text Return Rich Text representation of this pause event.

class SystemPromptEvent

Bases: LLMConvertibleEvent System prompt added by the agent.

Properties

  • kind: Literal[‘SystemPromptEvent’]
  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • source: Literal[‘agent’, ‘user’, ‘environment’]
  • system_prompt: TextContent
  • tools: list[ChatCompletionToolParam]
  • visualize: Text Return Rich Text representation of this system prompt event.

Methods

to_llm_message()

class UserRejectObservation

Bases: ObservationBaseEvent Observation when user rejects an action in confirmation mode.

Properties

  • action_id: str
  • kind: Literal[‘UserRejectObservation’]
  • model_config: ClassVar[ConfigDict] = (configuration object) Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
  • rejection_reason: str
  • visualize: Text Return Rich Text representation of this user rejection event.

Methods

to_llm_message()