ag-ui-protocol / ag-ui-protocol/ag-ui
How to preserve bidirectional shared state across a multi-agent / A2A boundary? (editable-form use case)
- Lingua principale
- Python
- Stelle
- 15.9k
- Fork
- 1.4k
- Merge medio
- 1g 17h
- PR unite (30g)
- 163
Descrizione
## Question / design clarification
I'm looking for the recommended pattern to preserve **bidirectional shared state** when the agent that owns that state sits behind a **multi-agent boundary** (delegation / handoff / A2A), and I can't find guidance for it in the docs or integrations.
### The single-agent case (works great)
AG-UI's native shared state (`STATE_SNAPSHOT` / `STATE_DELTA` + `input.state`) powers bidirectional editable UIs. Concrete example — a **"user story creator"**:
- The agent writes a `user_story` object (title / role / goal / benefit / acceptance criteria) into its session state → surfaced to the frontend via `STATE_DELTA`/`STATE_SNAPSHOT`.
- The frontend renders it as an **editable form** with two-way binding. When the user edits a field, the client sends it back in `input.state`; the server merges it into the agent's session, so the agent reasons over the user's edits.
- Net result: the user edits the form, the agent improves the story, and both stay in sync. This is the killer feature of AG-UI shared state.
### The multi-agent case (where I get stuck)
Now suppose the story-writing logic moves to a **specialized agent** reached via delegation/handoff — e.g. an orchestrator (the AG-UI-facing agent) that delegates to a "story agent" over **A2A**. The `user_story` now logically belongs to that sub-agent's session, not the orchestrator's. And from reading the repo:
- **`@ag-ui/a2a`** converts A2A events to `TEXT_MESSAGE_CHUNK` / `TOOL_CALL_*` / `ACTIVITY_*` / `RAW` — I don't see any `STATE_SNAPSHOT` / `STATE_DELTA` mapping across the A2A boundary.
- **`MultiAgentCapabilities`** (`delegation`, `handoffs`, `subAgents`) is a *declaration* schema, and the multi-agent event vocabulary (`STEP_*`, `ACTIVITY_*`, `AssistantMessage.name`) is for *representation*. Neither seems to propagate shared state across the boundary.
So the native "edit the form ⇄ agent updates it" loop appears to break the moment the owning agent is behind a delegation/handoff/A2A hop.
### What I'd like to know
1. **Recommended pattern:** Should the AG-UI-facing orchestrator always **own** the shared state and relay it into/out of the sub-agent (e.g. as an A2A `DataPart` / message `metadata`), so `STATE_*` stays a frontend ⇄ orchestrator concern and the sub-agent is effectively stateless? That's the approach I'd default to — is it the blessed one?
2. **Planned mechanism:** Is there any planned or intended way for a **sub-agent's state to surface as `STATE_*` through the parent**, or for `@ag-ui/a2a` to map STATE events across A2A? Or is that explicitly out of scope because A2A has no shared-state concept?
3. **Handoffs:** When the conversation is **fully transferred** to another agent (`handoffs: true`), how is shared state expected to carry over between the two agents so the frontend form doesn't lose sync?
4. Is there an example anywhere (any framework — LangGraph, Mastra, CrewAI, ADK) of a **bidirectional shared-state UI that survives a multi-agent split**? A pointer would be ideal.
### Why it matters
Shared-state editable UIs are one of AG-UI's most compelling capabilities, and multi-agent orchestration is increasingly the norm. Right now these two features seem to not compose cleanly, and it'd help a lot to know the intended architecture (or to confirm that "orchestrator owns the state and relays it" is the expected answer, in which case documenting it would be valuable).
Thanks!
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.