#[non_exhaustive]pub enum StateUpdate {
Running(RunningStateUpdate),
Idle(IdleStateUpdate),
RequiresAction(RequiresActionStateUpdate),
Unknown(UnknownStateUpdate),
Other(OtherStateUpdate),
}unstable_protocol_v2 only.Expand description
A snapshot of the session’s aggregate foreground activity.
Foreground work is the agent’s active response or workflow in the session,
including model processing, tool execution, and waiting for user action needed
to continue that work. It can start with a prompt or be agent-initiated, for
example to pursue an ongoing goal or follow up on a completed background task.
Either way, the agent MUST report running when foreground work starts,
or requires_action if it starts blocked on user action, and idle when it
ends. The agent SHOULD include a stop reason on that idle update.
Agent-initiated work does not require a prompt request or a synthetic user
message.
running may precede user-message insertion, for example during a foreground
hook. It is not acknowledgment of insertion, and rejecting a prompt does not
itself end foreground work.
Background activity can continue and emit other session/update notifications
while idle. Those notifications, including a detached task’s progress or
completion, do not by themselves change this state. A permission request only
warrants requires_action when foreground work is blocked on user action.
The agent SHOULD report requires_action when the foreground workflow as a
whole cannot progress without user action, including permissions or elicitations.
Once reported, it MUST report running when progress resumes, or idle when
work ends without resuming.
If other foreground work can progress, the state remains running. Resolving
one of several requests does not itself change the state. Agents SHOULD ignore
responses for work that has already ended rather than use them to resume it.
A new session defaults to idle until a state update reports otherwise.
Resume MUST send a current-state snapshot after any replay and before its
response. The snapshot reports foreground state after resuming.
The response alone does not imply idle.
Repeated snapshots are idempotent, not additional work, completions, or usage.
A repeated state may carry updated information without another state transition.
The agent MUST report idle when no foreground activity remains. Completing
an individual activity while other foreground work continues does not require
an idle boundary. Local commands use the same lifecycle even without model work.
See protocol docs: Session States
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Running(RunningStateUpdate)
Foreground work is in progress.
Idle(IdleStateUpdate)
No foreground work is active. Background activity may continue.
RequiresAction(RequiresActionStateUpdate)
Foreground work is blocked on user action.
Unknown(UnknownStateUpdate)
unstable_subagents only.UNSTABLE
This capability is not part of the spec yet, and may be removed or changed at any point.
The Agent cannot currently determine foreground activity. This replaces previously confirmed activity without ending the work or session.
Other(OtherStateUpdate)
Custom or future session state.
Values beginning with _ are reserved for implementation-specific
extensions. Unknown values that do not begin with _ are reserved for
future ACP variants.
Trait Implementations§
Source§impl Clone for StateUpdate
impl Clone for StateUpdate
Source§impl Debug for StateUpdate
impl Debug for StateUpdate
Source§impl<'de> Deserialize<'de> for StateUpdate
impl<'de> Deserialize<'de> for StateUpdate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for StateUpdate
Source§impl JsonSchema for StateUpdate
Available on crate feature schemars only.
impl JsonSchema for StateUpdate
schemars only.Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for StateUpdate
impl PartialEq for StateUpdate
Source§impl Serialize for StateUpdate
impl Serialize for StateUpdate
impl StructuralPartialEq for StateUpdate
Auto Trait Implementations§
impl Freeze for StateUpdate
impl RefUnwindSafe for StateUpdate
impl Send for StateUpdate
impl Sync for StateUpdate
impl Unpin for StateUpdate
impl UnsafeUnpin for StateUpdate
impl UnwindSafe for StateUpdate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.