AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

RemoteGraph Returns Invoke Output As List Of Dict Instead Of List Of BaseMessage - Mandatory When Combined With CompiledSubAgent

RemoteGraph's invoke/ainvoke returns message dictionaries instead of BaseMessage instances, causing CompiledSubAgent to produce empty ToolMessage content when used as a subagent. This breaks the parent agent's ability to read subagent results.

highConfidence 95%LangChain/LangGraphDurable ExecutionCheckpointingAffected Vlanggraph==1.2.11Affected Vlangchain==1.4.0Affected Vdeepagents==0.7.13

Origin Analysis

RemoteGraph serializes state over HTTP and deserializes messages as plain dictionaries without converting them back to LangChain BaseMessage objects, while CompiledSubAgent expects BaseMessage instances to extract the last non-empty AIMessage text.
Use RemoteGraph as a runnable for CompiledSubAgent in deepagents; invoke the supervisor agent; observe that the ToolMessage corresponding to the subagent task is empty because the returned state contains dict messages instead of BaseMessage objects.

Fixing Code Block

Edge Case Audit

This hotfix mutates the output state by converting dicts to BaseMessage objects, which may break if downstream code expects the original dict format (e.g., when serializing for logging or passing to other tools). Ensure all consumers of RemoteGraph output can handle BaseMessage objects. Additionally, the conversion relies on the 'type' or 'role' key; if message dicts use a different schema, conversion may fail or produce unexpected message types. Apply this patch only if you control the RemoteGraph usage; consider upstream fix in langgraph to avoid monkey patching. Test with multi-threaded or async scenarios to ensure thread safety.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state