Skip to main content

TaskState

Enum TaskState 

Source
#[non_exhaustive]
pub enum TaskState { Unspecified, Submitted, Working, InputRequired, AuthRequired, Completed, Failed, Canceled, Rejected, }
Expand description

The lifecycle state of a Task.

Per v1.0 spec (Section 5.5), enum values use ProtoJSON SCREAMING_SNAKE_CASE: "TASK_STATE_COMPLETED", "TASK_STATE_INPUT_REQUIRED", etc. Legacy lowercase/kebab-case values are accepted on deserialization.

This enum is closed to the v1.0 states. A future protocol revision that adds a state would be a wire-breaking change for the gRPC binding: an unknown TASK_STATE_* number from a newer peer is rejected by the protobuf conversion layer (with a field-scoped error) rather than silently discarded, so no task is ever reported in a bogus state.

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.
§

Unspecified

Proto default (0-value); should not appear in normal usage.

§

Submitted

Task received, not yet started.

§

Working

Task is actively being processed.

§

InputRequired

Agent requires additional input from the client to proceed.

§

AuthRequired

Agent requires the client to complete an authentication step.

§

Completed

Task finished successfully.

§

Failed

Task finished with an error.

§

Canceled

Task was canceled by the client.

§

Rejected

Task was rejected by the agent before execution.

Implementations§

Source§

impl TaskState

Source

pub const fn is_terminal(self) -> bool

Returns true if this state is a terminal (final) state.

Terminal states: Completed, Failed, Canceled, Rejected.

Source

pub const fn is_interrupted(self) -> bool

Returns true if this state is an interrupted state.

Interrupted states: InputRequired, AuthRequired. Per Section 3.2.2, blocking SendMessage MUST return when the task reaches a terminal OR interrupted state.

Source

pub const fn can_transition_to(self, next: TaskState) -> bool

Returns true if transitioning from self to next is a valid state transition per the A2A protocol.

The specification (§4.1.3) enumerates the task states and classifies them as terminal or interrupted, but it deliberately does not define a transition matrix — it never requires a task to pass through any intermediate state. Two rules follow from what it does say, and they are the only two enforced here:

  1. Terminal states are final. Completed, Failed, Canceled, and Rejected transition nowhere, including to themselves.
  2. Submitted is an entry state. Nothing transitions into it, and nothing transitions into the proto-default Unspecified. Unspecified as a source still transitions anywhere, since a task decoded with no state set must be able to take its real one.

Everything else is permitted. In particular Submitted → Completed is valid: an agent that answers a trivial request in one step never enters Working, and the reference SDKs emit exactly that sequence (the official a2a-tck SUT contract completes straight from Submitted). A stricter table here rejected conformant agents — including this SDK’s own users — with a spurious InvalidParams.

Trait Implementations§

Source§

impl Clone for TaskState

Source§

fn clone(&self) -> TaskState

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 Copy for TaskState

Source§

impl Debug for TaskState

Source§

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

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

impl<'de> Deserialize<'de> for TaskState

Source§

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

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

impl Display for TaskState

Source§

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

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

impl Eq for TaskState

Source§

impl From<TaskState> for TaskState

Source§

fn from(value: TaskState) -> TaskState

Converts to this type from the input type.
Source§

impl Hash for TaskState

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TaskState

Source§

fn eq(&self, other: &TaskState) -> 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 TaskState

Source§

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

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

impl StructuralPartialEq for TaskState

Source§

impl TryFrom<TaskState> for TaskState

Source§

type Error = ConvertError

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

fn try_from( value: TaskState, ) -> Result<TaskState, <TaskState as TryFrom<TaskState>>::Error>

Performs the conversion.

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<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> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more