Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
7a57927
docs: subagent support design spec
mme Jul 7, 2026
431f3b1
docs: subagent support implementation plan
mme Jul 7, 2026
1bb7368
feat(python): add optional subagent_id to message types
mme Jul 7, 2026
2bcccbb
feat(core): add optional subagentId to message schemas
mme Jul 7, 2026
36e74f7
feat(core): add optional subagentId to creation/standalone events
mme Jul 7, 2026
343a03d
feat(core): add SUBAGENT_STARTED/FINISHED/ERROR lifecycle events
mme Jul 7, 2026
2d97dab
feat(python): add subagent_id to events and SUBAGENT_* lifecycle events
mme Jul 7, 2026
70b7619
feat(client): add subagent lifecycle subscriber hooks
mme Jul 7, 2026
1ce794c
feat(client): propagate subagentId through chunk transform
mme Jul 7, 2026
236936f
feat(client): enforce subagent lifecycle consistency in verifier
mme Jul 7, 2026
1408a2a
feat(client): dispatch subagent lifecycle subscriber hooks
mme Jul 7, 2026
ad9a85e
test(client): strengthen subagent tests + drop dead field (CR round 1)
mme Jul 7, 2026
be5cd8b
chore: format and lint fixes for subagent support
mme Jul 7, 2026
4e80c92
feat: add optional subagentId to REASONING_MESSAGE_CHUNK
mme Jul 7, 2026
81ce523
test: make subagent attribution assertions non-vacuous
mme Jul 7, 2026
6212b08
test(python): guard remaining subagent_id event assertions via by-ali…
mme Jul 7, 2026
36b0a27
docs: plan for subagent backward-compatibility shim
mme Jul 7, 2026
c2a3c27
feat(client): add version-gated subagent backward-compat shim (0.0.57)
mme Jul 7, 2026
4370f8c
test(client): e2e verify 0.0.57 shim strips subagents through run pip…
mme Jul 7, 2026
5c8eeab
docs: correct subagent Phase 2 backward-compat rationale
mme Jul 7, 2026
f1c6b0b
fix(client): strip subagentId from RUN_STARTED.input echo + harden 0.…
mme Jul 7, 2026
b71bac1
fix(client): make 0.0.57 shim warn-test env-independent + correct docs
mme Jul 7, 2026
703bb7e
docs: deepagents subagent attribution demo (step 1) design
mme Jul 7, 2026
31ac667
docs: deepagents subagent demo implementation plan
mme Jul 7, 2026
c4f451a
docs: fold spike findings into deepagents demo plan (detection signal…
mme Jul 7, 2026
3caf759
chore(langgraph): bump langchain/langgraph to deepagents-compatible v…
mme Jul 7, 2026
72b79c3
spike(langgraph): document deepagents subagent event surfacing
mme Jul 7, 2026
3fcd6c2
feat(langgraph): derive deepagents subagent context from nested check…
mme Jul 7, 2026
1c4ce10
feat(langgraph): emit SUBAGENT_STARTED/FINISHED/ERROR at subagent bou…
mme Jul 7, 2026
9c078ce
fix(python-sdk): export SUBAGENT_STARTED/FINISHED/ERROR events from a…
mme Jul 7, 2026
0a4f562
feat(langgraph): stamp subagentId on creation events while in a subagent
mme Jul 7, 2026
4065217
feat(langgraph-examples): add deepagents 3-subagent attribution demo …
mme Jul 7, 2026
51842f7
fix(langgraph): emit one SUBAGENT_STARTED/FINISHED per subagent under…
mme Jul 7, 2026
58a88cb
feat(dojo): add deepagents subagent-attribution demo page + wiring
mme Jul 7, 2026
074bf3d
fix(dojo): scope deepagents_subagents demo to the python-backed integ…
mme Jul 7, 2026
37c6449
chore: override CopilotKit's @ag-ui deps to workspace so subagentId r…
mme Jul 7, 2026
4727cf4
chore(langgraph-examples): temporarily reduce deepagents demo to one …
mme Jul 7, 2026
bddd9ba
fix(langgraph): include subagent messages (with subagentId) in MESSAG…
mme Jul 7, 2026
53f9102
feat(langgraph): subagent tool-call snapshot + name/description; inli…
mme Jul 8, 2026
a36c69b
chore(temp): flip integration @ag-ui deps to workspace:* for pkg.pr.n…
mme Jul 8, 2026
557ca11
Revert workspace:* flip — breaks pkg-pr-new pack (pnpm pack cannot re…
mme Jul 8, 2026
39a4865
docs: update BEFORE-MERGE (pkg.pr.new url path abandoned; use @ag-ui …
mme Jul 8, 2026
e503a7a
chore: undo pkg.pr.new preview plumbing
mme Jul 8, 2026
35fc222
feat(dojo): subagent attribution UI — name via useSubagent + tool-cal…
mme Jul 8, 2026
b6feeb1
feat(dojo): group subagent messages into one reasoning-style collapsible
mme Jul 8, 2026
fed8fee
feat(subagents): finish subagent on task-end + reasoning-style collap…
mme Jul 8, 2026
3738b68
refactor(dojo): render subagent groups via renderCustomMessages + mul…
mme Jul 9, 2026
b77cb96
demo(deepagents): run 3 subagents in parallel and restore tool-call a…
mme Jul 9, 2026
3d55805
feat(dojo): show a subtle checkmark when a subagent finishes
mme Jul 9, 2026
acec0b6
fix(dojo): collapse subagent group immediately, animate only on open
mme Jul 9, 2026
8d8dd47
refactor(dojo): own the subagent header as a standalone component
mme Jul 9, 2026
a7d6c92
fix(langgraph): drop subagent-attributed messages from run input
mme Jul 9, 2026
bdfd42b
feat(langgraph): persist subagent messages across turns via the snapshot
mme Jul 9, 2026
85ff694
chore: remove superpowers plans and specs from the branch
mme Jul 14, 2026
c69e3bd
chore: remove subagent spike/investigation notes from the demo dir
mme Jul 14, 2026
4f6e141
fix(subagents): terminal events on error + fix failing test (CR round)
mme Jul 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(langgraph-examples): add deepagents 3-subagent attribution demo …
…agent

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
  • Loading branch information
mme and claude committed Jul 7, 2026
commit 40652173c2154a0378cd9453085ddc34e24da89a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# deepagents 3-subagent attribution demo module
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
"""A deepagents supervisor that delegates to three specialized research
subagents via the `task` tool.

This demo exists to exercise the AG-UI SUBAGENT_STARTED / SUBAGENT_FINISHED
event attribution for deepagents subagents: a single user question should
reliably fan out into three `task` delegations (market, technical, and risk
research), each surfaced as its own subagent run with a distinct
`subagent_id`.
"""

import os

from langchain_openai import ChatOpenAI

from deepagents import create_deep_agent
from deepagents.middleware.subagents import SubAgent

model = ChatOpenAI(model="gpt-4o-mini")

market_researcher: SubAgent = {
"name": "market_researcher",
"description": (
"Researches market size, target customers, competitors, and demand "
"for a product or business idea. Delegate to this subagent for any "
"market-related sub-question."
),
"system_prompt": (
"You are a market research analyst. Given a product or business "
"idea, give a concise (3-5 sentence) assessment of the target "
"market, likely customers, and competitive landscape. Be specific "
"and avoid hedging."
),
"tools": [],
}

technical_researcher: SubAgent = {
"name": "technical_researcher",
"description": (
"Researches the technical feasibility, architecture, and "
"implementation challenges of building a product or system. "
"Delegate to this subagent for any technical sub-question."
),
"system_prompt": (
"You are a technical research analyst. Given a product or business "
"idea, give a concise (3-5 sentence) assessment of the technical "
"feasibility, key implementation challenges, and any notable "
"technology choices. Be specific and avoid hedging."
),
"tools": [],
}

risk_researcher: SubAgent = {
"name": "risk_researcher",
"description": (
"Researches the business, legal, and operational risks of "
"launching a product or business idea. Delegate to this subagent "
"for any risk-related sub-question."
),
"system_prompt": (
"You are a risk research analyst. Given a product or business "
"idea, give a concise (3-5 sentence) assessment of the most "
"important risks (business, legal, or operational) and one "
"mitigation for each. Be specific and avoid hedging."
),
"tools": [],
}

SUPERVISOR_PROMPT = """You are a research supervisor. For EVERY user question \
about a product, business, or idea, you MUST gather input from all three of \
your specialist subagents before answering - no exceptions, even if the \
question seems simple.

Always do the following, in order:
1. Call the `task` tool with `subagent_type="market_researcher"`, asking it \
to research the market angle of the user's question.
2. Call the `task` tool with `subagent_type="technical_researcher"`, asking \
it to research the technical angle of the user's question.
3. Call the `task` tool with `subagent_type="risk_researcher"`, asking it to \
research the risk angle of the user's question.
4. Once all three have responded, synthesize their findings into a single, \
concise final answer for the user that clearly attributes each point to its \
area (market, technical, risk).

Delegate all three tasks - do not skip any of them, and do not answer from \
your own knowledge instead of delegating."""

# Conditionally use a checkpointer based on the environment (matches the
# pattern used by the sibling example agents).
is_fast_api = os.environ.get("LANGGRAPH_FAST_API", "false").lower() == "true"

if is_fast_api:
# For CopilotKit and other contexts, use MemorySaver
from langgraph.checkpoint.memory import MemorySaver

graph = create_deep_agent(
model=model,
tools=[],
system_prompt=SUPERVISOR_PROMPT,
subagents=[market_researcher, technical_researcher, risk_researcher],
checkpointer=MemorySaver(),
)
else:
# When running in LangGraph API/dev, don't use a custom checkpointer
graph = create_deep_agent(
model=model,
tools=[],
system_prompt=SUPERVISOR_PROMPT,
subagents=[market_researcher, technical_researcher, risk_researcher],
)

This file was deleted.

12 changes: 12 additions & 0 deletions integrations/langgraph/python/examples/agents/dojo.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from .tool_based_generative_ui.agent import graph as tool_based_generative_ui_graph
from .a2ui_fixed_schema.agent import graph as a2ui_fixed_schema_graph
from .a2ui_dynamic_schema.agent import graph as a2ui_dynamic_schema_graph
from .deepagents_subagents.agent import graph as deepagents_subagents_graph

app = FastAPI(title="LangGraph Dojo Example Server")

Expand Down Expand Up @@ -88,6 +89,11 @@
description="Dynamic A2UI with LLM-generated UI schema.",
graph=a2ui_dynamic_schema_graph,
),
"deepagents_subagents": LangGraphAgent(
name="deepagents_subagents",
description="A deepagents supervisor delegating to three specialized subagents (subagent attribution demo).",
graph=deepagents_subagents_graph,
),
}

add_langgraph_fastapi_endpoint(
Expand Down Expand Up @@ -150,6 +156,12 @@
app=app, agent=agents["a2ui_dynamic_schema"], path="/agent/a2ui_dynamic_schema"
)

add_langgraph_fastapi_endpoint(
app=app,
agent=agents["deepagents_subagents"],
path="/agent/deepagents_subagents",
)


def main():
"""Run the uvicorn server."""
Expand Down
3 changes: 2 additions & 1 deletion integrations/langgraph/python/examples/langgraph.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"agentic_chat_multimodal": "./agents/agentic_chat_multimodal/agent.py:graph",
"subgraphs": "./agents/subgraphs/agent.py:graph",
"a2ui_fixed_schema": "./agents/a2ui_fixed_schema/agent.py:graph",
"a2ui_dynamic_schema": "./agents/a2ui_dynamic_schema/agent.py:graph"
"a2ui_dynamic_schema": "./agents/a2ui_dynamic_schema/agent.py:graph",
"deepagents_subagents": "./agents/deepagents_subagents/agent.py:graph"
},
"env": ".env"
}