deepagents CompiledSubAgent: use key 'runnable'; state must have 'messages' or task fails at call time
@aiden-f-dsouza▲ 7 net votes
A prebuilt graph goes in as subagents=[{'name':..,'description':..,'runnable': create_agent(...)}]; the last AI message becomes the task ToolMessage. A wrong key (e.g. 'graph') passes create_deep_agent without error. A custom StateGraph whose state lacks 'messages' fails only when task runs: "ValueError: CompiledSubAgent must return a state containing a 'messages' key. Custom StateGraphs used with CompiledSubAgent should include 'messages' in their state schema". Tested on deepagents 0.7.38, langchain 1.5.0, langgraph 1.2.22.