Repository navigation
Add history array to Task schema definition - #167
Merged
Merged
Conversation
kthota-g
approved these changes
Apr 15, 2025
dudutwizer
pushed a commit
to xpander-ai/A2A
that referenced
this pull request
Apr 23, 2025
msampathkumar
pushed a commit
that referenced
this pull request
Oct 13, 2026
…tics (#2270) ## Summary Clarifies that task states are **terminal** or **non-terminal**, and that the interrupted states `TASK_STATE_INPUT_REQUIRED` and `TASK_STATE_AUTH_REQUIRED` are **non-terminal**. A non-terminal task stays under the server's control: the server **MAY** keep processing it and transition it to any other state — including out of an interrupted state — without a message from the client, and **MAY** keep accepting messages directed to it. Entering a non-terminal state does not necessitate closing a streaming response. Prose-only. No new types, fields, or enum values, and no wire change. ## Motivation The interrupted states are already labelled "interrupted" in `a2a.proto`, and the streaming operations (§3.1.2, §3.1.6) already close a stream only on a terminal state. But the SSE binding prose (§11.7) said the stream closes on "a terminal **or interrupted** state", and the spec never stated plainly what terminal vs. non-terminal means. That left implementors inferring a stricter, client-driven model than the protocol requires — e.g. that `INPUT_REQUIRED` ends the turn and closes the stream. Nothing in the protocol prevents sending a message to a task in an interrupted state, or an agent moving a task out of an interrupted state on its own. The server owns the task lifecycle; sending to a running task is otherwise underspecified for interop (#1992). This PR states the rule once, at the `TaskState` level, so bindings have a single thing to implement against. It also unblocks the input-required discussion and complements the steering extension (#2125). ## Changes - `specification/a2a.proto` — `TaskState` enum comment: define terminal vs. non-terminal/interrupted at the lifecycle level. Per-state comments unchanged. - `docs/specification.md` §4.1.3 — matching normative definition under the enum table. Delivery-agnostic; streaming stays in the streaming operation. - `docs/specification.md` §3.1.2 — in the Task lifecycle stream, a non-terminal/interrupted state SHOULD NOT by itself close the stream (terminal still MUST). - `docs/specification.md` §11.7 — drop "or interrupted" from the SSE close rule; point to §3.1.2. ## Breaking change? Drafted as SHOULD NOT (not MUST NOT) so no conforming implementation is invalidated. The only behavioral shift is for servers that close the SSE stream on an interrupted state today (see Appendix). Opening a vote to record whether this counts as breaking. ## Non-goals - Elicitations — deferred to an extension (ADR-002 / #2084). - Deprecating `TaskStatus.message` — how an agent describes the requested input is a docs concern, not this change. - Blocking `SendMessage` / `return_immediately` semantics — unchanged. - Steering an actively `WORKING` task — separate extension, #2125. ## Appendix: current SDK behavior (server side) Which SDK server implementations end a streaming response when a task enters an interrupted state: | SDK | Closes on `input-required`? | Closes on `auth-required`? | Where | |---|---|---|---| | a2a-python `DefaultRequestHandlerV2` (default) | No | No | `active_task.py` — `INTERRUPTED_TASK_STATES` kept disjoint from `TERMINAL_TASK_STATES`; stream handler has no state-based break | | a2a-python `LegacyRequestHandler` | Yes | No | `event_consumer.py: consume_all()` — `is_final_event` set includes `INPUT_REQUIRED` (#167) | | a2a-go | Yes | No | `internal/taskupdate/final.go: IsFinal()` → `state.Terminal() \|\| state == TaskStateInputRequired` | | a2a-js | Yes | No | `execution_event_queue.ts: events()` stop set = `TERMINAL_STATE_LIST \|\| INPUT_REQUIRED_STATE_LIST` (AUTH excluded) | | a2a-dotnet | Yes | Yes | `TaskUpdater.cs` — `RequireInputAsync()` and `RequireAuthAsync()` both call `eventQueue.Complete()` | - `auth-required` is already broadly compliant; only a2a-dotnet closes on it. - `input-required` is the divergence: only a2a-python V2 (the default) keeps the stream open; go, js, python-legacy, and dotnet close. - Bringing an SDK in line is small and wire-neutral: drop `input-required` from the stop predicate (`IsFinal` in go, `events()` in js, `consume_all` in python-legacy), and stop calling `Complete()` in dotnet's `RequireInputAsync`/`RequireAuthAsync`. SHOULD NOT → MUST NOT is a candidate for a later minor once these converge. Related: #2084, #2129, #1992, #2125. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds Message history to the Task schema definition so that the schema definition matches the technical documentation and example code.
The
tasks/getinput,TaskQueryParams, acceptshistoryLengthas an integer parameter, which is documented to return thelast N items of history ... which will include all Messages, in order, sent by client and server. Adding the History field to the Task definition makes this explicit.Technical Documentation
Task Definition
Get a Task Example
{ "jsonrpc": "2.0", "id": 1, "result": { "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", "sessionId": "c295ea44-7543-4f78-b524-7a38915ad6e4", "status": { "state": "completed" }, "artifacts": [{ "parts": [{ "type":"text", "text":"Why did the chicken cross the road? To get to the other side!" }] }], "history":[ { "role": "user", "parts": [ { "type": "text", "text": "tell me a joke" } ] } ], "metadata": {} } }Python Models
Task