Support Concurrent/Nested Runs #1522
contextablemark
started this conversation in
Proposals
Replies: 1 comment 3 replies
|
How would this work with the retry and edit flows that are described in the serialization doc in the AG-UI readme? We used something like this initially but because the parentRunId was reserved for that flow, we had to rewrite the stack to not use parentRunId and instead use stepid since that was cleaner and served the same semantic purposes |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
Three related gaps converge here:
No concurrent execution. Frameworks like LangGraph and ADK v2 support fan-out where a parent agent spawns multiple child agents in parallel. AG-UI prohibits
RUN_STARTEDduring an active run, so there's no way to represent this.No mid-run delegation. When an orchestrator agent delegates to a specialist during its own run — a pattern used by LangGraph subgraphs, Claude Agent SDK nested agents, and ADK v2 Task API — the delegation flattens into a single event stream, losing the structural parent-child relationship.
No event-to-run correlation. Even if we allow concurrent runs,
runIdonly exists onRUN_STARTED/FINISHED— the events in between (text messages, tool calls, state changes) don't declare which run they belong to. Interleaved events from concurrent runs would be impossible to untangle.Community Remarks
From Discord:
Proposed Changes
Three changes that work together:
1a. Add
runIdtoBaseEvent(optional)When only one run is active (the common case today),
runIdcan be omitted — all events implicitly belong to the single active run. When multiple runs are concurrent,runIdis required on every event so clients can group them.1b. Make
invokingRunIdsemantic onRUN_STARTEDRemove the "only one active run" constraint. Instead, the verifier tracks a set of active run IDs:
Key design decision: no LIFO ordering constraint. Fan-out children can finish in any order. The only rule is a parent run cannot finish while it has active children.
1c. Add
agentIdtoRUN_STARTED(optional)This ties a run to an agent identity, linking to
multiAgent.subAgents[]for discovery. Each run is owned by one agent — the hierarchy of runs is the hierarchy of agent delegation.Example: Fan-out with Parallel Agents
Applicable to: LangGraph parallel branches, ADK v2 Workflow Runtime fan-out, AWS Strands multi-agent nodes
Example: Sequential Delegation
Applicable to: Claude Agent SDK nested agents, ADK v2 Task API, A2A delegation
What This Enables
runIdon each eventBackwards Compatibility
runIdon BaseEvent is optional — when absent, events belong to the single active runinvokingRunIdandagentIdon RUN_STARTED are optionaltransport.concurrentRuns: true) so clients can declare supportSTEP_STARTED/FINISHEDwith"node_type:node_id"naming.All reactions