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
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
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
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
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.
OtherStateUpdate
¶
Bases: Unknown, _StateBase
A custom or future state; state values starting with _ are extensions.
Source code in src/aclientp/schema/v2/prompt.py
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
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.
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
RequiresActionStateUpdate
¶
Bases: _StateBase
The foreground workflow as a whole is blocked on user action.
Source code in src/aclientp/schema/v2/prompt.py
RunningStateUpdate
¶
UnknownBackgroundWork
¶
Bases: Unknown
Custom or future background work; type values starting with _ are extensions.
Source code in src/aclientp/schema/v2/prompt.py
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.