Skip to content

session_updates

Class info

Classes

Name Children Inherits
AvailableCommandsUpdate
aclientp.schema.v2.session_updates
The available commands are ready or have changed.
    CompactionSummaryChunk
    aclientp.schema.v2.session_updates
    A content block appended to a compaction's summary.
      CompactionUpdate
      aclientp.schema.v2.session_updates
      A context compaction upsert, keyed by ``compaction_id``.
        ConfigOptionUpdate
        aclientp.schema.v2.session_updates
        The session's config options have changed.
          IdleStateSessionUpdate
          aclientp.schema.v2.session_updates
          ``state_update``: no foreground work is active.
            Notice
            aclientp.schema.v2.session_updates
            Fire-and-forget information for the user, not part of session history.
              OtherStateSessionUpdate
              aclientp.schema.v2.session_updates
              ``state_update`` with a custom or future state.
                PromptSuggestion
                aclientp.schema.v2.session_updates
                **UNSTABLE**: A prompt the agent predicts the user will send next.
                  PromptSuggestionsUpdate
                  aclientp.schema.v2.session_updates
                  **UNSTABLE**: Replaces the session's prompt suggestions.
                    ReplayComplete
                    aclientp.schema.v2.session_updates
                    The history replay requested by ``session/resume`` is complete.
                      RequiresActionStateSessionUpdate
                      aclientp.schema.v2.session_updates
                      ``state_update``: foreground work is blocked on user action.
                        RunningStateSessionUpdate
                        aclientp.schema.v2.session_updates
                        ``state_update``: foreground work is in progress.
                          SessionInfoUpdate
                          aclientp.schema.v2.session_updates
                          Partial update of session metadata; ``None`` clears a field.
                            ToolCallSessionUpdate
                            aclientp.schema.v2.session_updates
                            ``tool_call_update``: a tool call was created or updated.
                              UnknownSessionUpdate
                              aclientp.schema.v2.session_updates
                              A custom or future session update; values starting with ``_`` are extensions.
                                UnknownStateSessionUpdate
                                aclientp.schema.v2.session_updates
                                ``state_update``: the agent cannot currently determine foreground activity.
                                  UpdateSessionNotification
                                  aclientp.schema.v2.session_updates
                                  Parameters of ``session/update``: one update of a session.
                                    UsageUpdate
                                    aclientp.schema.v2.session_updates
                                    Context window and cost of the session.

                                      🛈 DocStrings

                                      v2 session/update: the :data:SessionUpdate union and the smaller updates.

                                      CompactionStatus module-attribute

                                      CompactionStatus = Literal['in_progress', 'completed', 'failed', 'cancelled'] | str
                                      

                                      Lifecycle state of a context compaction. Values starting with _ are extensions.

                                      NoticeSeverity module-attribute

                                      NoticeSeverity = Literal['info', 'warning', 'error'] | str
                                      

                                      Severity hint of a notice. Values starting with _ are extensions.

                                      SessionUpdate module-attribute

                                      SessionUpdate = Annotated[
                                          Annotated[UserMessageChunk, Tag("user_message_chunk")]
                                          | Annotated[UserMessage, Tag("user_message")]
                                          | Annotated[AgentMessageChunk, Tag("agent_message_chunk")]
                                          | Annotated[AgentMessage, Tag("agent_message")]
                                          | Annotated[AgentThoughtChunk, Tag("agent_thought_chunk")]
                                          | Annotated[AgentThought, Tag("agent_thought")]
                                          | Annotated[StateSessionUpdate, Tag("state_update")]
                                          | Annotated[ToolCallContentChunk, Tag("tool_call_content_chunk")]
                                          | Annotated[ToolCallSessionUpdate, Tag("tool_call_update")]
                                          | Annotated[TerminalUpdate, Tag("terminal_update")]
                                          | Annotated[TerminalOutputChunk, Tag("terminal_output_chunk")]
                                          | Annotated[PlanUpdate, Tag("plan_update")]
                                          | Annotated[PlanRemoved, Tag("plan_removed")]
                                          | Annotated[AvailableCommandsUpdate, Tag("available_commands_update")]
                                          | Annotated[ConfigOptionUpdate, Tag("config_option_update")]
                                          | Annotated[SessionInfoUpdate, Tag("session_info_update")]
                                          | Annotated[UsageUpdate, Tag("usage_update")]
                                          | Annotated[Notice, Tag("notice")]
                                          | Annotated[CompactionUpdate, Tag("compaction_update")]
                                          | Annotated[CompactionSummaryChunk, Tag("compaction_summary_chunk")]
                                          | Annotated[ReplayComplete, Tag("replay_complete")]
                                          | Annotated[PromptSuggestionsUpdate, Tag("prompt_suggestions_update")]
                                          | Annotated[CursorUpdate, Tag("cursor_update")]
                                          | Annotated[SubagentUpdate, Tag("subagent_update")]
                                          | Annotated[SessionMessage, Tag("session_message")]
                                          | Annotated[SessionMessageChunk, Tag("session_message_chunk")]
                                          | Annotated[UnknownSessionUpdate, Tag(OTHER_TAG)],
                                          Discriminator(open_discriminator("sessionUpdate", _SESSION_UPDATES)),
                                      ]
                                      

                                      An update sent while a session exists: messages, progress and other activity.

                                      StateSessionUpdate module-attribute

                                      StateSessionUpdate = Annotated[
                                          Annotated[RunningStateSessionUpdate, Tag("running")]
                                          | Annotated[IdleStateSessionUpdate, Tag("idle")]
                                          | Annotated[RequiresActionStateSessionUpdate, Tag("requires_action")]
                                          | Annotated[UnknownStateSessionUpdate, Tag("unknown")]
                                          | Annotated[OtherStateSessionUpdate, Tag(OTHER_TAG)],
                                          Discriminator(
                                              open_discriminator("state", frozenset({"running", "idle", "requires_action", "unknown"}))
                                          ),
                                      ]
                                      

                                      A state_update session update: a snapshot of the session's foreground activity.

                                      AvailableCommandsUpdate

                                      Bases: AnnotatedObject

                                      The available commands are ready or have changed.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class AvailableCommandsUpdate(AnnotatedObject):
                                          """The available commands are ready or have changed."""
                                      
                                          session_update: Literal["available_commands_update"] = Field(
                                              default="available_commands_update", init=False
                                          )
                                      
                                          available_commands: Sequence[AvailableCommand]
                                          """All commands the agent can execute."""
                                      

                                      available_commands instance-attribute

                                      available_commands: Sequence[AvailableCommand]
                                      

                                      All commands the agent can execute.

                                      CompactionSummaryChunk

                                      Bases: AnnotatedObject

                                      A content block appended to a compaction's summary.

                                      A first-seen ID creates an in-progress compaction; chunks append in receive order.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class CompactionSummaryChunk(AnnotatedObject):
                                          """A content block appended to a compaction's summary.
                                      
                                          A first-seen ID creates an in-progress compaction; chunks append in receive order.
                                          """
                                      
                                          session_update: Literal["compaction_summary_chunk"] = Field(
                                              default="compaction_summary_chunk", init=False
                                          )
                                      
                                          compaction_id: CompactionId
                                          """The compaction whose summary receives the content."""
                                      
                                          content: ContentBlock
                                          """The appended content block."""
                                      

                                      compaction_id instance-attribute

                                      compaction_id: CompactionId
                                      

                                      The compaction whose summary receives the content.

                                      content instance-attribute

                                      content: ContentBlock
                                      

                                      The appended content block.

                                      CompactionUpdate

                                      Bases: AnnotatedObject

                                      A context compaction upsert, keyed by compaction_id.

                                      The first update fixes the compaction's position in the timeline; summary and error are patches.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class CompactionUpdate(AnnotatedObject):
                                          """A context compaction upsert, keyed by ``compaction_id``.
                                      
                                          The first update fixes the compaction's position in the timeline; ``summary`` and
                                          ``error`` are patches.
                                          """
                                      
                                          session_update: Literal["compaction_update"] = Field(default="compaction_update", init=False)
                                      
                                          compaction_id: CompactionId
                                          """The agent-owned ID of the compaction, unique within the session."""
                                      
                                          status: CompactionStatus | MISSING | None = MISSING
                                          """Current lifecycle status; omitted leaves it unchanged, ``None`` resets it to
                                          ``in_progress``. A new compaction starts as ``in_progress``."""
                                      
                                          summary: Sequence[ContentBlock] | MISSING | None = MISSING
                                          """Complete replacement summary content to show the user."""
                                      
                                          error: str | MISSING | None = MISSING
                                          """Human-readable error details."""
                                      

                                      compaction_id instance-attribute

                                      compaction_id: CompactionId
                                      

                                      The agent-owned ID of the compaction, unique within the session.

                                      error class-attribute instance-attribute

                                      error: str | MISSING | None = MISSING
                                      

                                      Human-readable error details.

                                      status class-attribute instance-attribute

                                      status: CompactionStatus | MISSING | None = MISSING
                                      

                                      Current lifecycle status; omitted leaves it unchanged, None resets it to in_progress. A new compaction starts as in_progress.

                                      summary class-attribute instance-attribute

                                      summary: Sequence[ContentBlock] | MISSING | None = MISSING
                                      

                                      Complete replacement summary content to show the user.

                                      ConfigOptionUpdate

                                      Bases: AnnotatedObject

                                      The session's config options have changed.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class ConfigOptionUpdate(AnnotatedObject):
                                          """The session's config options have changed."""
                                      
                                          session_update: Literal["config_option_update"] = Field(
                                              default="config_option_update", init=False
                                          )
                                      
                                          config_options: Sequence[SessionConfigOption]
                                          """All config options and their current values."""
                                      

                                      config_options instance-attribute

                                      config_options: Sequence[SessionConfigOption]
                                      

                                      All config options and their current values.

                                      IdleStateSessionUpdate

                                      Bases: IdleStateUpdate

                                      state_update: no foreground work is active.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class IdleStateSessionUpdate(IdleStateUpdate):
                                          """``state_update``: no foreground work is active."""
                                      
                                          session_update: Literal["state_update"] = Field(default="state_update", init=False)
                                      

                                      Notice

                                      Bases: AnnotatedObject

                                      Fire-and-forget information for the user, not part of session history.

                                      Agents must not rely on a notice being received or shown.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class Notice(AnnotatedObject):
                                          """Fire-and-forget information for the user, not part of session history.
                                      
                                          Agents must not rely on a notice being received or shown.
                                          """
                                      
                                          session_update: Literal["notice"] = Field(default="notice", init=False)
                                      
                                          severity: NoticeSeverity
                                          """Presentation severity hint."""
                                      
                                          title: str = Field(min_length=1)
                                          """Plain-text title that can stand alone."""
                                      
                                          description: str | MISSING | None = MISSING
                                          """Plain-text detail or guidance."""
                                      

                                      description class-attribute instance-attribute

                                      description: str | MISSING | None = MISSING
                                      

                                      Plain-text detail or guidance.

                                      severity instance-attribute

                                      severity: NoticeSeverity
                                      

                                      Presentation severity hint.

                                      title class-attribute instance-attribute

                                      title: str = Field(min_length=1)
                                      

                                      Plain-text title that can stand alone.

                                      OtherStateSessionUpdate

                                      Bases: OtherStateUpdate

                                      state_update with a custom or future state.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class OtherStateSessionUpdate(OtherStateUpdate):
                                          """``state_update`` with a custom or future state."""
                                      
                                          session_update: Literal["state_update"] = Field(default="state_update", init=False)
                                      

                                      PromptSuggestion

                                      Bases: AnnotatedObject

                                      UNSTABLE: A prompt the agent predicts the user will send next.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class PromptSuggestion(AnnotatedObject):
                                          """**UNSTABLE**: A prompt the agent predicts the user will send next."""
                                      
                                          prompt: Sequence[ContentBlock] = Field(min_length=1)
                                          """The content of the suggested prompt."""
                                      

                                      prompt class-attribute instance-attribute

                                      prompt: Sequence[ContentBlock] = Field(min_length=1)
                                      

                                      The content of the suggested prompt.

                                      PromptSuggestionsUpdate

                                      Bases: AnnotatedObject

                                      UNSTABLE: Replaces the session's prompt suggestions.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class PromptSuggestionsUpdate(AnnotatedObject):
                                          """**UNSTABLE**: Replaces the session's prompt suggestions."""
                                      
                                          session_update: Literal["prompt_suggestions_update"] = Field(
                                              default="prompt_suggestions_update", init=False
                                          )
                                      
                                          suggestions: Sequence[PromptSuggestion]
                                          """Suggestions, most likely first; an empty list withdraws all."""
                                      

                                      suggestions instance-attribute

                                      suggestions: Sequence[PromptSuggestion]
                                      

                                      Suggestions, most likely first; an empty list withdraws all.

                                      ReplayComplete

                                      Bases: AnnotatedObject

                                      The history replay requested by session/resume is complete.

                                      Sent once per session/resume with replayFrom; a resume that ends without it delivered a truncated replay.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class ReplayComplete(AnnotatedObject):
                                          """The history replay requested by ``session/resume`` is complete.
                                      
                                          Sent once per ``session/resume`` with ``replayFrom``; a resume that ends without it
                                          delivered a truncated replay.
                                          """
                                      
                                          session_update: Literal["replay_complete"] = Field(default="replay_complete", init=False)
                                      

                                      RequiresActionStateSessionUpdate

                                      Bases: RequiresActionStateUpdate

                                      state_update: foreground work is blocked on user action.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class RequiresActionStateSessionUpdate(RequiresActionStateUpdate):
                                          """``state_update``: foreground work is blocked on user action."""
                                      
                                          session_update: Literal["state_update"] = Field(default="state_update", init=False)
                                      

                                      RunningStateSessionUpdate

                                      Bases: RunningStateUpdate

                                      state_update: foreground work is in progress.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class RunningStateSessionUpdate(RunningStateUpdate):
                                          """``state_update``: foreground work is in progress."""
                                      
                                          session_update: Literal["state_update"] = Field(default="state_update", init=False)
                                      

                                      SessionInfoUpdate

                                      Bases: AnnotatedObject

                                      Partial update of session metadata; None clears a field.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class SessionInfoUpdate(AnnotatedObject):
                                          """Partial update of session metadata; ``None`` clears a field."""
                                      
                                          session_update: Literal["session_info_update"] = Field(
                                              default="session_info_update", init=False
                                          )
                                      
                                          title: str | MISSING | None = MISSING
                                          """Human-readable title of the session."""
                                      
                                          updated_at: str | MISSING | None = MISSING
                                          """RFC 3339 timestamp of the last activity."""
                                      

                                      title class-attribute instance-attribute

                                      title: str | MISSING | None = MISSING
                                      

                                      Human-readable title of the session.

                                      updated_at class-attribute instance-attribute

                                      updated_at: str | MISSING | None = MISSING
                                      

                                      RFC 3339 timestamp of the last activity.

                                      ToolCallSessionUpdate

                                      Bases: ToolCallUpdate

                                      tool_call_update: a tool call was created or updated.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class ToolCallSessionUpdate(ToolCallUpdate):
                                          """``tool_call_update``: a tool call was created or updated."""
                                      
                                          session_update: Literal["tool_call_update"] = Field(default="tool_call_update", init=False)
                                      

                                      UnknownSessionUpdate

                                      Bases: Unknown

                                      A custom or future session update; values starting with _ are extensions.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class UnknownSessionUpdate(Unknown):
                                          """A custom or future session update; values starting with ``_`` are extensions."""
                                      
                                          session_update: str
                                          """The update kind."""
                                      

                                      session_update instance-attribute

                                      session_update: str
                                      

                                      The update kind.

                                      UnknownStateSessionUpdate

                                      Bases: UnknownStateUpdate

                                      state_update: the agent cannot currently determine foreground activity.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class UnknownStateSessionUpdate(UnknownStateUpdate):
                                          """``state_update``: the agent cannot currently determine foreground activity."""
                                      
                                          session_update: Literal["state_update"] = Field(default="state_update", init=False)
                                      

                                      UpdateSessionNotification

                                      Bases: AnnotatedObject

                                      Parameters of session/update: one update of a session.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class UpdateSessionNotification(AnnotatedObject):
                                          """Parameters of ``session/update``: one update of a session."""
                                      
                                          session_id: SessionId
                                          """The session the update belongs to."""
                                      
                                          update: SessionUpdate
                                          """The update."""
                                      

                                      session_id instance-attribute

                                      session_id: SessionId
                                      

                                      The session the update belongs to.

                                      update instance-attribute

                                      update: SessionUpdate
                                      

                                      The update.

                                      UsageUpdate

                                      Bases: AnnotatedObject

                                      Context window and cost of the session.

                                      Source code in src/aclientp/schema/v2/session_updates.py
                                      class UsageUpdate(AnnotatedObject):
                                          """Context window and cost of the session."""
                                      
                                          session_update: Literal["usage_update"] = Field(default="usage_update", init=False)
                                      
                                          used: int = Field(ge=0)
                                          """Tokens currently in the context."""
                                      
                                          size: int = Field(ge=0)
                                          """Total context window size in tokens."""
                                      
                                          cost: Cost | MISSING | None = MISSING
                                          """Cumulative session cost; omitted leaves the last cost unchanged, ``None`` clears it."""
                                      

                                      cost class-attribute instance-attribute

                                      cost: Cost | MISSING | None = MISSING
                                      

                                      Cumulative session cost; omitted leaves the last cost unchanged, None clears it.

                                      size class-attribute instance-attribute

                                      size: int = Field(ge=0)
                                      

                                      Total context window size in tokens.

                                      used class-attribute instance-attribute

                                      used: int = Field(ge=0)
                                      

                                      Tokens currently in the context.