langchain-ai / langchain-ai/langgraph
Does `CompiledSubAgent` support state parameter passing?
- Dominant language
- Python
- Stars
- 41.8k
- Forks
- 7.1k
- Avg merge
- 23h 7m
- Merged PRs (30d)
- 30
Description
I've got a LangGraph runnable that expects specific state keys (like location, industry, etc.) to function properly.
Currently, when I use CompiledSubAgent to integrate this runnable with my deep agent, the subagent gets invoked but the required state parameters aren't being passed through - leading to KeyErrors when the runnable tries to access them.
I found a workaround by wrapping my runnable as a tool with an explicit args_schema, which lets the main agent extract and pass parameters correctly.
But this feels heavyweight for what should be a simple subagent invocation.
What I'm looking for:
A way to tell CompiledSubAgent: "Hey, this runnable needs these specific state keys populated before you invoke it" - similar to how tools have args_schema to define their required parameters.
Where the middleware extracts the needed parameters from the task description and populates the state before invoking the runnable.
Is there currently a way to do this with CompiledSubAgent that I'm missing? Or would this be a worthwhile addition?
Thanks
Contributor guide
Research direction
Start by locating CompiledSubAgent and tracing how it invokes the wrapped LangGraph runnable and supplies state. Compare that path with the documented tool args_schema workaround. Done means the issue’s requested state-key behavior is either supported and documented or its feasibility and required API are clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100