Skip to content

Commit eeaa2a2

Browse files
committed
feat(dojo): add the deepagents subagent-attribution demo
A demo page that renders each subagent's output as its own collapsible, reasoning-style group: name and description from useSubagent, tool-call cards inside the owning group, a checkmark when the subagent finishes, and an interrupt handled inside a subagent. Grouping is driven by `subagentRunId` on the messages via renderCustomMessages, which is the consumer-side proof that attribution survives the whole path -- LangGraph's derived namespaces, the protocol events, the client's apply step, and CopilotKit's rendering. Scoped to the Python-backed integrations, since the agent is a LangGraph graph. `useSubagent({ subagentRunId })` is plain shorthand: CopilotKit adopted the same field name (CopilotKit/CopilotKit#5873), so no mapping is needed at the boundary. If it ever needs an explicit mapping again, the two names have diverged.
1 parent ad90070 commit eeaa2a2

8 files changed

Lines changed: 561 additions & 0 deletions

File tree

apps/dojo/src/agents.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ export const agentsIntegrations = {
257257
shared_state: "shared_state",
258258
tool_based_generative_ui: "tool_based_generative_ui",
259259
subgraphs: "subgraphs",
260+
deepagents_subagents: "deepagents_subagents",
260261
},
261262
),
262263
a2ui_dynamic_schema: new LangGraphAgent({
@@ -291,6 +292,7 @@ export const agentsIntegrations = {
291292
shared_state: "shared_state",
292293
tool_based_generative_ui: "tool_based_generative_ui",
293294
subgraphs: "subgraphs",
295+
deepagents_subagents: "deepagents_subagents",
294296
},
295297
),
296298
a2ui_fixed_schema: new LangGraphHttpAgent({
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Deepagents Subagents: AG-UI Subagent Attribution (Step 1)
2+
3+
This demo runs the **deepagents** 3-subagent LangGraph agent and proves that
4+
**subagent attribution surfaces through AG-UI** to the frontend.
5+
6+
## What This Demo Shows
7+
8+
The deepagents integration dispatches work to specialized subagents. As those
9+
subagents emit messages, the integration stamps each message with a
10+
`subagentRunId` field. This demo reads that field straight off `agent.messages`
11+
and renders a small `⟐ {subagentRunId}` marker next to any message that carries
12+
one.
13+
14+
This is intentionally **minimal** — the goal of this step is only to prove
15+
that the `subagentRunId` attribution makes it from the backend all the way to
16+
the frontend message objects. Polished UI (grouping by subagent, avatars,
17+
etc.) is a follow-up, not part of this demo.
18+
19+
## How to Interact
20+
21+
Send a prompt that requires the supervisor to delegate to its subagents, e.g.:
22+
23+
- "Research the topic of octopus intelligence using your subagents and summarize the findings."
24+
25+
Watch the **Message Attribution** panel on the right: every message lists its
26+
role, and any message produced by a subagent shows the `⟐ {subagentRunId}`
27+
marker.
28+
29+
## Implementation Notes
30+
31+
- `subagentRunId` is an AG-UI message field (see `@ag-ui/core`). At the time of
32+
writing it isn't part of the CopilotKit `Message` type, so the demo reads it
33+
via a cast (`(message as unknown as { subagentRunId?: string }).subagentRunId`).
34+
- The chat panel uses `useAgent` with `UseAgentUpdate.OnMessagesChanged` so the
35+
attribution list re-renders as new messages stream in.

0 commit comments

Comments
 (0)