Agent-to-Agent Protocols › The task lifecycle
Language AI HandbookAll chapters A Task is a server-side lifecycle record with a server-generated id, a contextId shared by related interactions, and a typed status. If the server chooses to return a task when a message is sent, the client uses that assigned ID with subsequent operations. The v1.0.1 normative TaskState enum covers submitted, working, completed, failed, canceled, rejected, input-required, and auth-required states. Submitted marks an acknowledged task, and working means active processing. input-required and auth-required are interruptions. The task can continue once the required input or authentication is available. Completed, failed, canceled, and rejected are terminal. The enum also reserves an unspecified value, which a caller should not interpret as successful completion.
A status update can carry a message, for example a clarification. The deliverable belongs in artifacts when the protocol returns a Task. An artifact carries typed parts such as inline text, a file, or structured data. An intermediate artifact can arrive while the task is working. Likewise, a final status confirms the lifecycle outcome while the application separately checks that the required result validates. A status event and an artifact update answer different questions about the same task.
Use GetTask to poll and reconcile by ID. If streaming is supported, SubscribeToTask returns the current Task first, then status and artifact updates. The subscription section states that a stream for the task closes when the task becomes terminal and that a subscription to an already terminal task is unsupported. If a disconnected client misses events, read the task snapshot and reconcile the available artifacts. Push notifications are another delivery mechanism, conditional on advertised support and configuration.
A long-horizon caller needs to decide how long it will wait for an interruption, how it will obtain the next input, and what it will report if it reaches its deadline before the remote state can be confirmed. When the connection drops, mark the observation as unknown until it can be checked. A transport failure is not a task state.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!