Skip to content

prompt

Class info

Classes

Name Children Inherits
BackgroundSubagent
aclientp.schema.v2.prompt
A detached subagent session that has anything running.
    BackgroundTerminal
    aclientp.schema.v2.prompt
    A process that keeps running after its tool call returned control to the model.
      BackgroundToolCall
      aclientp.schema.v2.prompt
      Work of a tool call that continues without a process of its own, e.g. a watcher.
        IdleStateUpdate
        aclientp.schema.v2.prompt
        No foreground work is active; background work may continue.
        OtherStateUpdate
        aclientp.schema.v2.prompt
        A custom or future state; ``state`` values starting with ``_`` are extensions.
        PromptRequest
        aclientp.schema.v2.prompt
        Parameters of ``session/prompt``: a user message for the session.
          PromptResponse
          aclientp.schema.v2.prompt
          Acknowledges that the user message was inserted into the conversation.
            RequiresActionStateUpdate
            aclientp.schema.v2.prompt
            The foreground workflow as a whole is blocked on user action.
            RunningStateUpdate
            aclientp.schema.v2.prompt
            Foreground work is in progress.
            UnknownBackgroundWork
            aclientp.schema.v2.prompt
            Custom or future background work; ``type`` values starting with ``_`` are extensions.
              UnknownStateUpdate
              aclientp.schema.v2.prompt
              The agent cannot currently determine foreground activity.

              🛈 DocStrings

              v2 prompt lifecycle: session/prompt and the session's foreground state.

              session/prompt returns as soon as the user message is inserted, with its messageId; it does not wait for the turn. Progress is reported with state_update notifications (running, idle, requires_action, unknown), and the stop reason travels on the idle update. A failure after insertion ends foreground work with idle and stopReason: "error"; a JSON-RPC error on session/prompt always means the message was not inserted.

              BackgroundWork module-attribute

              BackgroundWork = Annotated[
                  Annotated[BackgroundTerminal, Tag("terminal")]
                  | Annotated[BackgroundToolCall, Tag("tool_call")]
                  | Annotated[BackgroundSubagent, Tag("subagent")]
                  | Annotated[UnknownBackgroundWork, Tag(OTHER_TAG)],
                  Discriminator(open_discriminator("type", frozenset({"terminal", "tool_call", "subagent"}))),
              ]
              

              One piece of work running independently of the foreground work.

              Items reference entities the client already tracks; the agent announces each item before listing it.

              StateUpdate module-attribute

              StateUpdate = Annotated[
                  Annotated[RunningStateUpdate, Tag("running")]
                  | Annotated[IdleStateUpdate, Tag("idle")]
                  | Annotated[RequiresActionStateUpdate, Tag("requires_action")]
                  | Annotated[UnknownStateUpdate, Tag("unknown")]
                  | Annotated[OtherStateUpdate, Tag(OTHER_TAG)],
                  Discriminator(
                      open_discriminator("state", frozenset({"running", "idle", "requires_action", "unknown"}))
                  ),
              ]
              

              A snapshot of the session's aggregate foreground activity.

              StopReason module-attribute

              StopReason = (
                  Literal["end_turn", "max_tokens", "max_turn_requests", "refusal", "cancelled", "error"] | str
              )
              

              Why foreground work stopped. Values starting with _ are extensions.

              BackgroundSubagent

              Bases: AnnotatedObject

              A detached subagent session that has anything running.

              Source code in src/aclientp/schema/v2/prompt.py
              class BackgroundSubagent(AnnotatedObject):
                  """A detached subagent session that has anything running."""
              
                  type: Literal["subagent"] = Field(default="subagent", init=False)
              
                  session_id: SessionId
                  """The listed session."""
              

              session_id instance-attribute

              session_id: SessionId
              

              The listed session.

              BackgroundTerminal

              Bases: AnnotatedObject

              A process that keeps running after its tool call returned control to the model.

              Source code in src/aclientp/schema/v2/prompt.py
              class BackgroundTerminal(AnnotatedObject):
                  """A process that keeps running after its tool call returned control to the model."""
              
                  type: Literal["terminal"] = Field(default="terminal", init=False)
              
                  terminal_id: TerminalId
                  """The listed terminal."""
              

              terminal_id instance-attribute

              terminal_id: TerminalId
              

              The listed terminal.

              BackgroundToolCall

              Bases: AnnotatedObject

              Work of a tool call that continues without a process of its own, e.g. a watcher.

              Source code in src/aclientp/schema/v2/prompt.py
              class BackgroundToolCall(AnnotatedObject):
                  """Work of a tool call that continues without a process of its own, e.g. a watcher."""
              
                  type: Literal["tool_call"] = Field(default="tool_call", init=False)
              
                  tool_call_id: ToolCallId
                  """The listed tool call."""
              

              tool_call_id instance-attribute

              tool_call_id: ToolCallId
              

              The listed tool call.

              IdleStateUpdate

              Bases: _StateBase

              No foreground work is active; background work may continue.

              Agents SHOULD include stop_reason when the transition ends foreground work.

              Source code in src/aclientp/schema/v2/prompt.py
              class IdleStateUpdate(_StateBase):
                  """No foreground work is active; background work may continue.
              
                  Agents SHOULD include ``stop_reason`` when the transition ends foreground work.
                  """
              
                  state: Literal["idle"] = Field(default="idle", init=False)
              
                  stop_reason: StopReason | MISSING | None = MISSING
                  """Why foreground work stopped; omitted or ``None`` when there is no stop reason."""
              
                  error: Error | MISSING | None = MISSING
                  """For ``stop_reason == "error"``: the failure, as a JSON-RPC error object."""
              
                  usage: Usage | MISSING | None = MISSING
                  """**UNSTABLE**: Token usage of the completed foreground work."""
              

              error class-attribute instance-attribute

              error: Error | MISSING | None = MISSING
              

              For stop_reason == "error": the failure, as a JSON-RPC error object.

              stop_reason class-attribute instance-attribute

              stop_reason: StopReason | MISSING | None = MISSING
              

              Why foreground work stopped; omitted or None when there is no stop reason.

              usage class-attribute instance-attribute

              usage: Usage | MISSING | None = MISSING
              

              UNSTABLE: Token usage of the completed foreground work.

              OtherStateUpdate

              Bases: Unknown, _StateBase

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

              Source code in src/aclientp/schema/v2/prompt.py
              class OtherStateUpdate(Unknown, _StateBase):
                  """A custom or future state; ``state`` values starting with ``_`` are extensions."""
              
                  state: str
                  """The state."""
              

              state instance-attribute

              state: str
              

              The state.

              PromptRequest

              Bases: AnnotatedObject

              Parameters of session/prompt: a user message for the session.

              Agents MUST support text and resource_link content; other block types need the matching prompt capability.

              Source code in src/aclientp/schema/v2/prompt.py
              class PromptRequest(AnnotatedObject):
                  """Parameters of ``session/prompt``: a user message for the session.
              
                  Agents MUST support ``text`` and ``resource_link`` content; other block types
                  need the matching prompt capability.
                  """
              
                  session_id: SessionId
                  """The session to send the message to."""
              
                  prompt: Sequence[ContentBlock] = Field(min_length=1)
                  """The content of the user message; at least one block."""
              
                  idempotency_key: IdempotencyKey | MISSING | None = MISSING
                  """Identifies this submission, so a retry does not insert the message twice."""
              

              idempotency_key class-attribute instance-attribute

              idempotency_key: IdempotencyKey | MISSING | None = MISSING
              

              Identifies this submission, so a retry does not insert the message twice.

              prompt class-attribute instance-attribute

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

              The content of the user message; at least one block.

              session_id instance-attribute

              session_id: SessionId
              

              The session to send the message to.

              PromptResponse

              Bases: AnnotatedObject

              Acknowledges that the user message was inserted into the conversation.

              It does not mean the turn has finished; that is reported with state_update.

              Source code in src/aclientp/schema/v2/prompt.py
              class PromptResponse(AnnotatedObject):
                  """Acknowledges that the user message was inserted into the conversation.
              
                  It does not mean the turn has finished; that is reported with ``state_update``.
                  """
              
                  message_id: MessageId
                  """ID of the inserted user message; live user message updates use the same ID."""
              

              message_id instance-attribute

              message_id: MessageId
              

              ID of the inserted user message; live user message updates use the same ID.

              RequiresActionStateUpdate

              Bases: _StateBase

              The foreground workflow as a whole is blocked on user action.

              Source code in src/aclientp/schema/v2/prompt.py
              class RequiresActionStateUpdate(_StateBase):
                  """The foreground workflow as a whole is blocked on user action."""
              
                  state: Literal["requires_action"] = Field(default="requires_action", init=False)
              

              RunningStateUpdate

              Bases: _StateBase

              Foreground work is in progress.

              Source code in src/aclientp/schema/v2/prompt.py
              class RunningStateUpdate(_StateBase):
                  """Foreground work is in progress."""
              
                  state: Literal["running"] = Field(default="running", init=False)
              

              UnknownBackgroundWork

              Bases: Unknown

              Custom or future background work; type values starting with _ are extensions.

              Source code in src/aclientp/schema/v2/prompt.py
              class UnknownBackgroundWork(Unknown):
                  """Custom or future background work; ``type`` values starting with ``_`` are extensions."""
              
                  type: str
                  """The kind of work."""
              

              type instance-attribute

              type: str
              

              The kind of work.

              UnknownStateUpdate

              Bases: _StateBase

              The agent cannot currently determine foreground activity.

              Replaces previously confirmed states; not to be sent merely because the session has been quiet.

              Source code in src/aclientp/schema/v2/prompt.py
              class UnknownStateUpdate(_StateBase):
                  """The agent cannot currently determine foreground activity.
              
                  Replaces previously confirmed states; not to be sent merely because the session
                  has been quiet.
                  """
              
                  state: Literal["unknown"] = Field(default="unknown", init=False)