Repository navigation
feat: add SendLiveMessage for bidirectional interaction (#1995) - #2153
Conversation
) ## Summary Extends the SLIMRPC binding with a layered set of specs and an example for collaborative multi-agent sessions. No new RPC methods are defined — the relay works with `SendStreamingMessage` (A2A 1.0+) for broad compatibility, and upgrades to `SendLiveMessage` bidi streaming (A2A 1.1) when available. The specs are layered from most-general to most-specific: ``` spec/v1/a2a-shared-task.md ← base primitive: multi-client single-agent task spec/v1/a2a-collaborative-task.md ← multi-agent relay (extends shared-task) spec/v1/slimrpc-collaborative-task.md ← SLIMRPC profile: capability-driven mode selection spec/v1/slimrpc-multicast.md ← SLIMRPC multicast SendLiveMessage (fan-out, no relay) spec/v1/slimrpc.md ← base SLIMRPC binding (point-to-point) ``` --- ### `spec/v1/a2a-shared-task.md` — A2A Shared Task extension Defines the primitive that collaborative-task is built on: a single `Task` on a single agent addressable by multiple clients simultaneously. Key points: - **No new A2A methods.** Works with `SendMessage` / `SendStreamingMessage` (A2A 1.0+). The A2A SDK already fans all events to all active subscribers on a task. - **`message-sender` metadata key.** Namespaced under the extension URI in `Message.metadata`; carries the identity of the sender of each message. - **Extension URI:** `https://a2a-protocol.org/extensions/shared-task/v1` --- ### `spec/v1/a2a-collaborative-task.md` — A2A Collaborative Task extension Transport-neutral spec for output-to-input relay between N agent tasks. Key design points: - **All-to-all mesh topology.** No pipeline or star; all participants see all messages. - **Three relay tiers** (in order of preference): - *Native fan-out*: transport delivers peer `StreamResponse` items to all members natively — no relay process. Requires A2A 1.1. - *Live relay*: relay uses `SendLiveMessage` (A2A 1.1) — relay holds open send stream per agent. - *Basic relay*: relay uses `SendStreamingMessage` + `SendMessage(context_id, return_immediately=True)` injection (A2A 1.0+). Broadest compatibility — works with any A2A agent. - **`message-sender` attribution** carried in `Message.metadata` under the shared-task extension URI. Application code MUST NOT set or override it; the transport or relay populates it. - **Session ID rewriting.** Each agent independently assigns its own `contextId` / `taskId`; the relay rewrites both into every translated item before delivery. - **Extension URI:** `https://a2a-protocol.org/extensions/collaborative-task/v1` ### Peer event translation table | Peer sends | Translated to | Parts | | :--- | :--- | :--- | | Initial `Task` | `StreamRequest { message }` | 1× `Part.data` (`application/vnd.a2a.task+json`) | | `TaskStatusUpdateEvent` with message | `StreamRequest { message }` | Original parts + appended `Part.data` (`application/vnd.a2a.task-status-update+json`) | | `TaskStatusUpdateEvent` without message | `StreamRequest { message }` | 1× `Part.data` (`application/vnd.a2a.task-status-update+json`) | | `TaskArtifactUpdateEvent` | `StreamRequest { artifact_update }` unchanged | — | | `TaskMessageUpdateEvent` | `StreamRequest { message }` (original parts + appended envelope) | Preserve original `message-sender` | --- ### `spec/v1/slimrpc-collaborative-task.md` — SLIMRPC Collaborative Task profile Maps the generic spec onto SLIM. Key points: - **Capability-driven mode selection (§3).** Before initiating a session, the client inspects each agent's Agent Card to determine the transport mode: | Participant capabilities | Mode | | :--- | :--- | | All agents declare SLIMRPC binding + all three collaborative-task extension URIs | **Native** — shared-responses GROUP channel, no relay | | Some SLIMRPC-capable, some not | **Hybrid** — shared-responses GROUP for SLIMRPC agents + p2p relay for others | | None SLIMRPC-capable | **Full relay** — point-to-point A2A connections only | - **Activation signal (§4).** `a2a-extensions: https://a2a-protocol.org/bindings/experimental-slimrpc/extensions/collaborative-task/v1` in SLIMRPC call metadata. Applies to both `SendLiveMessage` and `SendStreamingMessage` on SLIM group channels. - **`message-sender` in `Message.metadata` (§5.1).** Populated from SLIM transport `src` field by the runtime. Application code MUST NOT set it. - **`slimrpc-context-map` (§5.2).** SLIMRPC session-level call metadata on the initial streaming call; used for session continuation only. - **MUST NOT declare SLIMRPC collaborative-task URI unless started with shared-responses (§8).** Declaring the URI signals native-mode eligibility; an agent not in shared-responses mode cannot participate correctly. --- ### `spec/v1/slimrpc-multicast.md` — Multicast `SendLiveMessage` Fan-out `SendLiveMessage` over a SLIM group channel: each agent's `StreamResponse` flows back to the initiating client only; agents are unaware of one another's output. Unchanged from prior version. --- ### `examples/collaborative/incident-response/` Four-agent incident response example (monitoring → log → diagnostics → remediation). All relay logic lives in `collaborate_transport.py`: ```python async for slim_name, response in collaborate(client_factory, agent_cards, request_stream): ... ``` `collaborate()` inspects Agent Cards and selects the mode automatically: ```python try: client = client_factory.create(agent_cards) # ValueError → nstreams if isinstance(client, MulticastClient) and all_slimrpc_capable: # native: shared-responses GROUP channel, no relay else: # multicast relay: GROUP channel, app relay re-injects peer responses except ValueError: # nstreams: N p2p SRPCTransport instances, app fan-out relay ``` `make_agent_card(shared_responses=False)` conditionally declares the SLIMRPC collaborative-task URI — only when `shared_responses=True` — enforcing the MUST NOT rule from spec §8. --- ### Related - A2A 1.1 bidi streaming foundations: [a2aproject/A2A#2153](a2aproject/A2A#2153) - A2A 1.1 coherent task timeline (ADR-002): [a2aproject/A2A#2129](a2aproject/A2A#2129) - Follow-up — `contextId` correlation for `SendMessage`/`SendStreamingMessage` multicast: [#7](#7)
9f04d05 to
c00afd3
Compare
) Add a single live operation that serves a long-lived duplex session, a brief connect-send-disconnect exchange, and attaching to a task to observe it. StreamRequest payloads reuse the existing request types: SubscribeToTaskRequest (extended with optional last_seen_generation to resume without a snapshot) and SendMessageRequest. The first request binds the stream to one task. Subscribing with last_seen_generation replays without a Task snapshot; otherwise the stream opens with one. Subscribe is only valid as the opening request. StreamError rejects a single bad request without tearing down the stream, and new payload kinds on StreamRequest and StreamResponse are specified as non-breaking so future events need no version gating. TaskMessageUpdateEvent delivers client-originated timeline entries, gated to clients negotiating 1.1 or later, and TaskPushNotificationConfig gains protocol_version since a webhook delivery has no request to key that off.
|
/vote |
Vote created@herczyn has called for a vote on The members of the following teams have binding votes:
Non-binding votes are also appreciated as a sign of support! How to voteYou can cast your vote by reacting to
Please note that voting for multiple options is not allowed and those votes won't be counted. The vote will be open for |
Vote statusIn favor: Summary
Binding votes (2)
|
| User | Vote | Timestamp |
|---|---|---|
| Tehsmash | In favor | 2026-10-13 8:13:02.0 +00:00:00 |
|
agree in principal here. The challenge this introduces in the spec is there are now 3 different ways in protocol to perform a client operation of send message. The protocol operations indicate different response paradigms and is mixing both server construct and protocol operations vs transport. This is an existing challenge and related: #2023 |
Vote statusIn favor: Summary
Binding votes (4)
|
| User | Vote | Timestamp |
|---|---|---|
| Tehsmash | In favor | 2026-10-13 8:13:02.0 +00:00:00 |
…770) ## What was broken When a server sends a `StreamResponse` with a payload kind this SDK does not know, `StreamResponse.fromJSON` drops the unknown key and the client yields `{ payload: undefined }` to the caller. Every caller then has to special-case an event that carries nothing. Hit it with a local SSE server sending `task`, then `{"futureUpdate": {...}}`, then `statusUpdate`: ``` main rest ["task","undefined","statusUpdate"] main jsonrpc ["task","undefined","statusUpdate"] main grpc ["task","undefined","statusUpdate"] branch rest ["task","statusUpdate"] branch jsonrpc ["task","statusUpdate"] branch grpc ["task","statusUpdate"] ``` ## Background This came out of a2aproject/A2A#2269. The TSC agreed that adding a payload kind should not break existing clients, and @herczyn added wording to the bidi PR (a2aproject/A2A#2153) saying a client that gets a `StreamResponse` payload kind it does not recognise MUST skip it and keep reading the stream. ## What the fix does `Client.sendMessageStream` and `Client.resubscribeTask` skip any event with no payload before it reaches the after-interceptors or the caller, then keep reading. Doing it in `Client` puts the rule in one place for every transport. I checked REST, JSON-RPC and gRPC end to end. Over gRPC, ts-proto drops the unknown field and the frame decodes to `{}`, so the same skip applies. The `Transport` classes are unchanged, so anyone driving a transport directly still sees the raw events. ## How it was verified - Three new tests in `test/client/multitransport-client.spec.ts`. The `sendMessageStream` and `resubscribeTask` ones fail on `main` (`expected [ 'task', undefined, 'task' ] to deeply equal [ 'task', 'task' ]`) and pass here. - The end-to-end run above, through the real `RestTransport`, `JsonRpcTransport` and `GrpcTransport` (`sendMessageStream` only for gRPC). - `npm test` on `2c81b86`: 1844 passed on the branch, 1841 on `main`. On my Windows machine both runs also fail the same sqlite push-store test, in its `afterEach` cleanup (`rmSync` of the temp dir gets `EPERM`). I installed with `--ignore-scripts` on both sides. - `npm run lint:ci`, `npm run build`, and the workers-safe, grpc and express build checks all pass. Co-authored-by: Jakub Worek <[email protected]>
Vote statusIn favor: Summary
Binding votes (4)
|
| User | Vote | Timestamp |
|---|---|---|
| Tehsmash | In favor | 2026-10-13 8:13:02.0 +00:00:00 |
3 similar comments
Vote statusIn favor: Summary
Binding votes (4)
|
| User | Vote | Timestamp |
|---|---|---|
| Tehsmash | In favor | 2026-10-13 8:13:02.0 +00:00:00 |
Vote statusIn favor: Summary
Binding votes (4)
|
| User | Vote | Timestamp |
|---|---|---|
| Tehsmash | In favor | 2026-10-13 8:13:02.0 +00:00:00 |
Vote statusIn favor: Summary
Binding votes (4)
|
| User | Vote | Timestamp |
|---|---|---|
| Tehsmash | In favor | 2026-10-13 8:13:02.0 +00:00:00 |
|
added this in the discord but just one more note of comment: I think as we work with this should see if:
|
Vote statusIn favor: Summary
Binding votes (4)
|
| User | Vote | Timestamp |
|---|---|---|
| Tehsmash | In favor | 2026-10-13 8:13:02.0 +00:00:00 |
| vinoo999 | In favor | 2026-10-19 12:34:14.0 +00:00:00 |
Vote closedThe vote passed! 🎉 In favor: Summary
Binding votes (5)
|
…#2322) ## Summary Lets a client write artifacts (including multiple artifacts in one call, or chunked updates) over both live streams and unary/server-streaming calls, split out of #2153 so the live channel can be reviewed on its own. Because `StreamRequest` in #2153 embeds `SendMessageRequest`, extending `SendMessageRequest` once enables client-written artifacts across `SendMessage`, `SendStreamingMessage`, and `SendLiveMessage` alike. ## What's here 1. **`SendMessageRequest.artifact_updates` (`repeated TaskArtifactUpdateEvent`)** — lets a client send work-item artifacts alongside a control `message` (for example `"please translate this doc"` + the doc when creating a task) or on their own when continuing an existing task (`task_id` set). - `message` is required when creating a task (when no `task_id` is provided, as the agent needs a control message to know what to do with the artifacts); it may be omitted only when sending `artifact_updates` to an existing task. - When `message` and `artifact_updates` are sent together and a `Task` is created/updated, `message` is appended to `timeline` first, followed by `artifact_updates` in list order. If the agent responds with a direct `Message` without creating a `Task`, neither is persisted in a task. 2. **`AgentCapabilities.user_artifacts` (`optional bool`)** — indicates whether the agent accepts client-written (`ROLE_USER`) artifacts in `SendMessageRequest.artifact_updates` (otherwise `UnsupportedOperationError` / `StreamError`). 3. **`generation` ownership** — on each client-sent `TaskArtifactUpdateEvent`, `generation` is server-owned: clients MUST leave it unset, servers MUST ignore any value received, and the server stamps the authoritative value when broadcasting the resulting `TaskArtifactUpdateEvent` downstream. 4. **`Artifact.role`** — restored so a client-written artifact (`ROLE_USER`) stays distinguishable from an agent output (`ROLE_AGENT`, the default). Deferred out of the history ADR (#2129) for this change. ## Verification `buf breaking` (FILE) clean, api-linter `problems: []`, protolint clean, markdownlint clean. Related: #1995, #2153
|
Hi, it's really great to see the bidirectional interaction support upcoming in v1.1! Is there already an expected timeline for the 1.1 release spec and sdk? |
Follow-up adjustments to SendLiveMessage (a2aproject#2153) and client-written artifacts (a2aproject#2322) on dev-1.1: 1. Treat SubscribeToTaskRequest.last_seen_generation as a hint: servers may either replay subsequent events without an opening Task snapshot, or open with the current Task snapshot and stream onward. 2. Rename StreamRequest.send_message to StreamRequest.request, as SendMessageRequest may carry artifact_updates without a message. 3. Explicitly state that StreamError is a stream-local transport rejection: never appended to Task.timeline, never increments Task.generation, and never broadcast to other subscribers or webhooks. 4. Define (artifact_id, role) as the per-task artifact primary key, with servers enforcing ROLE_USER on client writes and ROLE_AGENT on agent outputs (and consumers treating ROLE_UNSPECIFIED as ROLE_AGENT). Signed-off-by: Kuba Herczynski <[email protected]>
) A v1 stream containing known events, a future payload, and later known updates currently stops at the future payload. Continue receiving known events through completion in REST, JSON-RPC, and gRPC v1, for both `SendStreamingMessage` and `SubscribeToTask`. - REST decodes known events and server errors first, then skips non-null unknown fields when no known payload was set. Remove the extra known-name list. Treat JSON `null` as unset: `{"task":null,"futureEvent":{}}` is skipped, while empty/null-only wrappers fail with `stream response has no payload`. - Keep public `a2a.StreamResponse.UnmarshalJSON` strict, including its existing error text. An internal error sentinel lets only the JSON-RPC streaming receive path distinguish unknown payloads from malformed known events; unary and eventqueue decoding remain strict. - gRPC skips only `pbconv.ErrUnsupportedStreamResponse`, covering both unrecognized wire fields and future generated oneof variants the converter does not support. Supported-variant conversion failures and empty responses remain errors. When no payload decoded, descriptor-based validation also rejects incompatible wire types for declared message fields: protobuf retains these as unknown bytes, but they are not additive future variants. Already-decoded payloads retain their existing behavior. v0 transports are unchanged. - Debug logs identify skipped JSON fields or protobuf field numbers/payload types without logging payload contents. Regression tests cover known events before and after unknown events through completion, consecutive and unknown-only streams, known events with added fields, JSON null semantics, and preservation of malformed JSON/known payload, empty wrapper, multiple known JSON variant, server, and transport errors. gRPC coverage includes a simulated future generated oneof and real gRPC wire tests for both streaming operations. The wire tests cover all four current payload fields, an unknown field before a wrong-wire known field, genuine future fields, unknown groups, unchanged known-payload behavior, malformed embedded protobuf, and empty wrappers. Shared HTTP cases are formatted across multiple lines; unrelated header/params checks and the redundant cancellation/early-exit addition were removed. Parser cases assert the exact no-payload error or the decoder-error prefix; diagnostics tests identify the expected skip record among unrelated log records and check the complete output for payload leakage. Existing upstream tests are preserved. Validation against main `ea739de` (Go 1.26.0): - RED: the original HTTP/mock-gRPC regression suite fails on unmodified main for the expected unknown-payload errors (48 HTTP and 16 gRPC subcases); control cases pass. The follow-up wire tests reproduce 10 incorrect skip cases on the previous PR head `558e08c`; all 20 final wire cases pass after the fix. - GREEN/BLUE: targeted suites pass, including explicit strict-public-decoder and field-only diagnostic checks. - `go test -race -mod=readonly -count=1 -shuffle=on ./...` passes; rerun successfully after the wire-validation and assertion follow-ups. - `go mod tidy -diff`, `go build -mod=readonly ./...`, `go vet ./...`, and the separate `examples/clustermode` build pass. - Repository-pinned golangci-lint v2.11.4, commit `8f3b0c7ed018e57905fbd873c697e0b1ede605a5`: 0 issues. - `git diff --check` passes. Merged current main and resolved the test-file conflict while retaining upstream authentication/query-parameter tests. Initial validation used a temporary local checkout after iCloud offloaded files from the working copy; the follow-up validation ran in the original checkout. Aligned with the StreamResponse forward-compatibility rule in a2aproject/A2A#2153. Fixes a2aproject#435. AI assistance: implementation, tests, and review revisions were prepared with Codex; validation was run locally. --------- Co-authored-by: Yaroslav Shevchuk <[email protected]>
## Summary Follow-up refinements to `SendLiveMessage` (#2153) and client-written artifacts (#2322) on `dev-1.1`: 1. **Escape hatch for `last_seen_generation`** (`SubscribeToTaskRequest`, §3.1.6, §3.1.12) — treats `lastSeenGeneration` as a hint rather than requiring event replay. When set, the server MAY replay subsequent events without an opening `Task` snapshot, OR ignore the hint, open with the current `Task` snapshot, and stream onward from there (allowing stores that only persist the projected `Task` to work without an event log). 2. **Rename `StreamRequest.send_message` → `StreamRequest.request`** (`StreamRequest` field 2, §3.1.12, §3.2.1) — `SendMessageRequest` can carry `artifact_updates` without a `message` when continuing an existing task, so `request` reflects the broader payload. 3. **`StreamError` explicitly off the timeline** (`StreamError`, §3.1.12, §3.2.7) — clarifies that `StreamError` is a transport-level rejection on that stream: it does not mutate task state, is never recorded in `Task.timeline`, never advances `Task.generation`, and is never broadcast to other subscribers or push notification webhooks. 4. **Artifact primary key = `(artifact_id, role)`** (`Artifact`, `TaskArtifactUpdateEvent`, §3.2.1) — defines `(artifact_id, role)` as the per-task unique key for `Task.artifacts`, `append: true` chunk matching, and `append: false` replacement, with servers enforcing/normalising `role` by origin (`ROLE_USER` on client writes, rejecting `ROLE_AGENT`; `ROLE_AGENT` on agent outputs, with `ROLE_UNSPECIFIED` treated as `ROLE_AGENT`). ## Verification - `buf breaking` against `main` clean - `protolint` clean - `api-linter` `problems: []` - `markdownlint` clean Related: #1995, #2153, #2322 --------- Signed-off-by: Kuba Herczynski <[email protected]>
Summary
Adds
SendLiveMessage, a single operation for bidirectional interaction (#1995). Fully additive.Client-written artifacts were split into #2322 so this PR is just the live channel.
What's here
One operation, three uses.
SendLiveMessageserves a long-lived duplex session, a brief connect-send-disconnect exchange, and attaching to a task purely to observe it.Reuses existing request types — no new wrapper messages.
StreamRequest.payloadis aoneofof:SubscribeToTaskRequest subscribe = 3(extended withoptional int64 last_seen_generation = 3) — attaches to an existing task without sending input.SendMessageRequest send_message = 2— sends a message with optionalSendMessageConfigurationandmetadata, identical to unarySendMessage.Opening semantics. The first request binds the stream to one task:
subscribewithlastSeenGeneration: noTasksnapshot, replay only what followed it (falls back to a snapshot if the server no longer retains that point).subscribewithoutlastSeenGeneration: opens with aTasksnapshot.sendMessage: the message is appended first, so the opening snapshot already reflects it.subscribeis only valid as the opening request; later it's rejected with aStreamError.Transport parity. Native-duplex transports (gRPC, WebSocket) use one connection. HTTP invokes the operation as a server stream for the downlink and sends further input as separate short-lived calls. A non-downlink call returns only an acknowledgement and never replays events, so a client holding both never sees an event twice.
StreamError. Rejects a single bad request without tearing down the stream.Forward compatibility. New payload kinds on
StreamRequest/StreamResponseare specified as non-breaking: clients MUST skip response payloads they don't recognise; servers MUST reject unknown request payloads with aStreamErrorrather than closing the stream.TaskMessageUpdateEventdelivers client-originated timeline entries, emitted only to clients negotiatingA2A-Version: 1.1+.TaskPushNotificationConfig.protocolVersion— defaults to the version of the creating request; unset means 1.0.Verification
buf breaking(FILE) clean, api-linterproblems: [], protolint clean, markdownlint clean.Follow-up: #2322 (client-written artifacts +
Artifact.role).Related: #1995, #1992, #1991