-
Notifications
You must be signed in to change notification settings - Fork 2.7k
SubAgentMiddleware regression — runtime config not passed to subagent invocations (PR #602 fix lost in #1041 refactor) #2362
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingdeepagentsRelated to the `deepagents` SDK / agent harnessRelated to the `deepagents` SDK / agent harnessexternalUser is not a member of the `langchain-ai` GitHub organizationUser is not a member of the `langchain-ai` GitHub organization
Description
Checked other resources
- This is a bug, not a usage question.
- I added a clear and descriptive title.
- I searched existing issues and didn't find this.
- I can reproduce this with the latest released version.
- I included a minimal reproducible example and steps to reproduce.
Area (Required)
- deepagents (SDK)
- cli
Related Issues / PRs
Reproduction Steps / Example Code (Python)
from dataclasses import dataclass
from langchain.agents import create_agent
from langchain.tools import tool, ToolRuntime
from deepagents import create_deep_agent
@dataclass
class MyContext:
api_url: str = "https://example.com"
@tool
def check_context(query: str, runtime: ToolRuntime[MyContext]) -> str:
"""Tool that needs runtime.context."""
return f"Context: {runtime.context.api_url}"
agent = create_deep_agent(
tools=[check_context],
context_schema=MyContext,
)
# This works:
agent.invoke({"messages": [...]}, context=MyContext())
# But when the agent delegates to a subagent via the task tool,
# the subagent's tools receive runtime.context = NoneError Message and Stack Trace (if applicable)
Description
- I'm trying to use the
deepagentslibrary withcontext_schemaso subagent tools can accessruntime.context. - I expect
runtime.contextto be available in tools called by subagents (as it was after PR fix(deepagents): Pass through runtime config to subagents #602 fixed this in Dec 2025). - Instead,
runtime.contextisNonein subagent tools. PR feat(sdk): subagent skills, middleware refactor #1041 (Feb 4, 2026) rewrotesubagents.pyand dropped theruntime.configpass-through from_build_task_tool(). The fix is to passruntime.configtosubagent.invoke()andsubagent.ainvoke()— the exact one-line change from PR fix(deepagents): Pass through runtime config to subagents #602.
Environment / System Info
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdeepagentsRelated to the `deepagents` SDK / agent harnessRelated to the `deepagents` SDK / agent harnessexternalUser is not a member of the `langchain-ai` GitHub organizationUser is not a member of the `langchain-ai` GitHub organization