Skip to main content

StateUpdate

Enum StateUpdate 

Source
#[non_exhaustive]
pub enum StateUpdate { Running(RunningStateUpdate), Idle(IdleStateUpdate), RequiresAction(RequiresActionStateUpdate), Unknown(UnknownStateUpdate), Other(OtherStateUpdate), }
Available on crate feature 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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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)

Available on crate feature 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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StateUpdate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for StateUpdate

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for StateUpdate

Source§

impl JsonSchema for StateUpdate

Available on crate feature schemars only.
Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for StateUpdate

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for StateUpdate

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for StateUpdate

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.