feat(dojo): deepagents subagents demo - #2351
Open
mme wants to merge 5 commits into
Open
Conversation
This was referenced Aug 7, 2026
Contributor
Python Preview PackagesVersion
Install with uvAdd the TestPyPI index to your [[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
explicit = trueThen install the packages you need: # Core SDK
uv add 'ag-ui-protocol==0.0.0.dev1788537285' --index testpypi
# Integrations (each already depends on the matching ag-ui-protocol preview)
uv add 'ag-ui-langgraph==0.0.0.dev1788537285' --index testpypi
uv add 'ag-ui-crewai==0.0.0.dev1788537285' --index testpypi
# NOTE: ag-ui-agent-spec depends on pyagentspec (git-only, not on PyPI).
# You will need to install pyagentspec separately from its git repo.
uv add 'ag-ui-agent-spec==0.0.0.dev1788537285' --index testpypi
uv add 'ag_ui_adk==0.0.0.dev1788537285' --index testpypi
uv add 'ag_ui_strands==0.0.0.dev1788537285' --index testpypiInstall with pippip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
ag-ui-protocol==0.0.0.dev1788537285
Commit: b38e937 |
@ag-ui/a2a-middleware
@ag-ui/a2ui-middleware
@ag-ui/event-throttle-middleware
@ag-ui/mcp-apps-middleware
@ag-ui/mcp-middleware
@ag-ui/a2a
@ag-ui/adk
@ag-ui/ag2
@ag-ui/agno
@ag-ui/aws-strands
@ag-ui/claude-agent-sdk
@ag-ui/claude-managed-agents
@ag-ui/crewai
@ag-ui/langchain
@ag-ui/langgraph
@ag-ui/llamaindex
@ag-ui/mastra
@ag-ui/pydantic-ai
@ag-ui/vercel-ai-sdk
@ag-ui/watsonx
@ag-ui/a2ui-toolkit
create-ag-ui-app
@ag-ui/client
@ag-ui/core
@ag-ui/encoder
@ag-ui/proto
commit: |
mme
force-pushed
the
mme/subagents-langgraph-dojo
branch
4 times, most recently
from
August 10, 2026 11:28
968753a to
2fbee22
Compare
mme
force-pushed
the
mme/subagents-protocol
branch
from
August 10, 2026 14:16
b1bba2b to
cb8d9f7
Compare
mme
force-pushed
the
mme/subagents-langgraph-dojo
branch
from
August 10, 2026 14:20
7eca6c0 to
eeaa2a2
Compare
parkerroan
pushed a commit
to parkerroan/ag-ui
that referenced
this pull request
Aug 26, 2026
…ension, and subagent_visibility The LangGraph half of the subagent work (protocol merged in ag-ui-protocol#2350), split out of ag-ui-protocol#2351 so it can release independently of the dojo demo and its CopilotKit preview pins. Byte-identical to the reviewed content on mme/subagents-langgraph-dojo. What the integration does: - Derived attribution: LangGraph does not announce subagents, so nested checkpoint namespaces plus lc_agent_name identify each delegation; one STARTED/FINISHED pair per subagent under concurrency, per-lane steps, nested parents via boundary chains, per-lane public-id minting on collisions, input seeding and reverse translation for HITL resume. - subagent_visibility = "inline" (default) | "attributed" | "hidden". Inline is byte-identical to pre-subagent behavior — pinned by a dedicated contract suite and verified against the PUBLISHED @ag-ui/core 0.0.55/0.0.57/0.0.58 transport schemas (92/92 events of a real capture parse clean). Attributed emits the full subagent surface. Hidden is invisible delegation (a design-partner request): only the parent's task call, its result, and the parent's reply reach the wire, with identity-paired, provenance-based suppression. emit_subagent_events remains a one-cycle boolean alias. - HITL inside a subagent: suspension is a typed outcome, interrupts are attributed per interrupt, suspended lanes resume as continuations of the same subagentRunId (checkpoint task identity), and no-resume replays re-derive attribution from checkpoint evidence matching the deepagents task-call shape. Release note (PNI-274, documented in pyproject): [tool.uv.sources] still points ag-ui-protocol at the in-repo SDK — dev/CI-only, never in wheel metadata. On the first ag-ui-protocol release carrying the subagent events: raise the floor to that version, delete the block, relock, then release ag-ui-langgraph. Module-scope imports make the new floor mandatory (pre-subagent SDKs fail at import; pip must refuse the pairing). Suite: 603 tests + 5 subtests, including the flag-off byte-identity contract, the hidden contract (28 tests), parallel/nested streaming, and HITL resume. Review history: six-round design-partner-context review, five-round clean-room review, design + four-round implementation review for suspension, seven-round review for subagent_visibility — all converged on real compiled graphs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mme
force-pushed
the
mme/subagents-langgraph-dojo
branch
from
August 28, 2026 10:31
687abc0 to
9a9eaa2
Compare
This was referenced Aug 28, 2026
mme
force-pushed
the
mme/subagents-langgraph-dojo
branch
from
August 28, 2026 16:06
7be4fc0 to
a7d1d8b
Compare
…urface 1.61.2 -> 1.70.1 across the six @CopilotKit dependencies. 1.70.1 is the first CopilotKit release that depends on the published @Ag-ui 0.0.59 — the first AG-UI release carrying the subagent surface (SUBAGENT_STARTED/FINISHED/ERROR, the AgentSubscriber dispatch, and subagentRunId message attribution) — which the deepagents_subagents demo (added later in this branch) consumes directly via agent.subscribe. Plain released versions: no pkg.pr.new pins, no overrides, and block-exotic-subdeps stays enabled. Note: the runtime side of this bump stops injecting the forwarded-headers 'App Context' message into the thread, which moves the langgraph-python event-trace goldens — re-recorded in the next commit.
Pairs with the CopilotKit 1.70.1 bump: the goldens were recorded against a runtime that injected an 'App Context' message carrying copilotkit_forwarded_headers as the thread's first message; the 1.66+ runtime no longer injects it, so every journey ran one STATE_SNAPSHOT short of its golden. Environment drift, not a regression: the TypeScript lane re-recorded with no semantic changes, and its goldens never contained the injected message. Recording gotcha worth knowing: the backend must run WITHOUT LangSmith env (LANGCHAIN_TRACING_V2 / LANGCHAIN_API_KEY / LANGSMITH_API_KEY). With tracing on, the LangChain run tree gets a root id distinct from the platform run_id, so raw-event parent_ids anonymize to a different id slot than CI's untraced runs produce — the golden then fails only in CI, at events[N].rawEvent.data.parent_ids[0]. Re-recorded via 'pnpm event-trace:update --spec agenticChatPage' against live langgraph-cli backends with a clean env; both lanes pass in normal mode.
main's examples/uv.lock still records the in-repo ag-ui-langgraph path dependency at 0.0.43 with ag-ui-protocol as a directory source; the integration's pyproject has since moved to 0.0.44 with a registry floor (ag-ui-protocol>=0.1.21, dev-only [tool.uv.sources] kept out of published metadata per the PNI-274 plan). Relock so 'uv sync' in the examples — which the deepagents_subagents demo lane runs against — resolves cleanly without rewriting the lockfile.
A deepagents supervisor delegates to a research subagent that raises a LangGraph interrupt() from INSIDE the subagent, so the demo shows both halves of the subagent surface at once: attribution (each subagent's work rendered in its own collapsible group, tagged with its identity and lifecycle status) and an in-subagent human-in-the-loop pause that resumes on the same thread. The demo consumes the protocol surface directly: a page-mounted provider subscribes to the agent's onSubagentStartedEvent / onSubagentFinishedEvent / onSubagentErrorEvent callbacks and keeps the per-invocation lifecycle in a React context (started => running with the friendly name, finished => finished — suspended included, error => error, unknown id => unregistered). The provider subscribes from page mount because SUBAGENT_STARTED precedes the subagent's first attributed message — the group component mounts too late to hear it. No CopilotKit hook is involved, so the page doubles as the reference for consuming the subagent lifecycle from the raw AG-UI surface (the useSubagent hook PR, CopilotKit#5873, was closed in favor of this). Registered on the langgraph-fastapi lane only. The platform lane goes through the TypeScript LangGraphAgent client, which does not emit SUBAGENT_* events. files.json embeds the demo source for the dojo's view-source panel and is generated, not hand-written.
Covers what is specific to subagents rather than re-testing chat: the delegation grouping and its identity tag, the interrupt raised inside the subagent, and the two branches of that approval producing visibly different, still-clean finishes. Two invariants only a browser can check: attribution survives the final MESSAGES_SNAPSHOT (a snapshot dropping subagentRunId would collapse every group into the parent), and no group is left spinning once the run finishes. The demo's own tool-result turns opt out of aimock's generic tool-result acknowledgment, which is prepended and would otherwise make the approve and reject branches read identically — the same carve-out every other demo with its own post-tool-result reply uses.
mme
force-pushed
the
mme/subagents-langgraph-dojo
branch
from
September 4, 2026 15:54
7b7120d to
ec41b3d
Compare
mme
marked this pull request as ready for review
September 4, 2026 15:54
mxmzb
approved these changes
Sep 4, 2026
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.
Adds the deepagents_subagents demo to the dojo: a deepagents supervisor delegates to a research subagent that raises a LangGraph
interrupt()from inside the subagent, showing both halves of the AG-UI subagent surface (shipped in@ag-ui0.0.59) at once:subagentRunIdrenders inside that subagent's collapsible group, tagged with its name and live lifecycle status (running / finished / error / unregistered).The demo consumes the raw protocol surface: a page-mounted provider subscribes to the
AgentSubscribercallbacks (onSubagentStartedEvent/onSubagentFinishedEvent/onSubagentErrorEvent) and keeps the per-invocation lifecycle in React context — no framework hook, so the page doubles as the reference implementation for consuming the subagent lifecycle. (CopilotKit'suseSubagenthook PR, CopilotKit/CopilotKit#5873, was closed in favor of this.)Registered on the langgraph-fastapi lane only: the platform lane goes through the TypeScript
LangGraphAgentclient, which does not emitSUBAGENT_*events.Also carried, as their own commits
@copilotkit/*1.61.2 → 1.70.1 — the first CopilotKit release depending on the published@ag-ui0.0.59. Plain released versions; no pins, no overrides.langgraph-pythonevent-trace goldens — the 1.66+ runtime stopped injecting the forwarded-headers "App Context" message, so every journey ran oneSTATE_SNAPSHOTshort of its golden. (Recording note: the backend must run without LangSmith env vars, orparent_idsanonymize differently than CI's untraced runs — details in the commit message.)uv.lockrefresh — main's lock still records the in-repoag-ui-langgraphat 0.0.43 with a directory source forag-ui-protocol; the integration's pyproject moved to 0.0.44 with a registry floor.Verification
MESSAGES_SNAPSHOT, and no group left spinning after the run.agenticChatPageevent-trace suites pass;files.jsonregenerated and byte-verified; dojo typechecks against released@copilotkit/react-core1.70.1;pnpm install --frozen-lockfilesucceeds withblock-exotic-subdepsleft enabled.