Package io.a2a.spec
Enum Class TaskState
- All Implemented Interfaces:
Serializable,Comparable<TaskState>,Constable
Defines the lifecycle states of a
Task in the A2A Protocol.
TaskState represents the discrete states a task can be in during its execution lifecycle. States are categorized as either transitional (non-final) or terminal (final), where terminal states indicate that the task has reached its end state and will not transition further.
Transitional States:
- TASK_STATE_SUBMITTED: Task has been received by the agent and is queued for processing
- TASK_STATE_WORKING: Agent is actively processing the task and may produce incremental results
- TASK_STATE_INPUT_REQUIRED: Agent needs additional input from the user to continue
- TASK_STATE_AUTH_REQUIRED: Agent requires authentication or authorization before proceeding
Terminal States:
- TASK_STATE_COMPLETED: Task finished successfully with all requested work done
- TASK_STATE_CANCELED: Task was explicitly canceled by the user or system
- TASK_STATE_FAILED: Task failed due to an error during execution
- TASK_STATE_REJECTED: Task was rejected by the agent (e.g., invalid request, policy violation)
- UNRECOGNIZED: Task state cannot be determined (error recovery state)
The isFinal() method can be used to determine if a state is terminal, which is
important for event queue management and client polling logic.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAgent requires authentication or authorization to proceed (transitional state).Task was canceled by user or system (terminal state).Task completed successfully (terminal state).Task failed due to an error (terminal state).Agent requires additional input from the user to continue (transitional state).Task was rejected by the agent (terminal state).Task has been received and is queued for processing (transitional state).Agent is actively processing the task (transitional state).Task state is unknown or cannot be determined (terminal state). -
Method Summary
Modifier and TypeMethodDescriptionbooleanisFinal()Determines whether this state is a terminal (final) state.static TaskStateReturns the enum constant of this class with the specified name.static TaskState[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TASK_STATE_SUBMITTED
Task has been received and is queued for processing (transitional state). -
TASK_STATE_WORKING
Agent is actively processing the task (transitional state). -
TASK_STATE_INPUT_REQUIRED
Agent requires additional input from the user to continue (transitional state). -
TASK_STATE_AUTH_REQUIRED
Agent requires authentication or authorization to proceed (transitional state). -
TASK_STATE_COMPLETED
Task completed successfully (terminal state). -
TASK_STATE_CANCELED
Task was canceled by user or system (terminal state). -
TASK_STATE_FAILED
Task failed due to an error (terminal state). -
TASK_STATE_REJECTED
Task was rejected by the agent (terminal state). -
UNRECOGNIZED
Task state is unknown or cannot be determined (terminal state).
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isFinal
public boolean isFinal()Determines whether this state is a terminal (final) state.Terminal states indicate that the task has completed its lifecycle and will not transition to any other state. This is used by the event queue system to determine when to close queues and by clients to know when to stop polling.
- Returns:
trueif this is a terminal state,falseelse.
-