Skip to content

[BUG] langgraph: AttributeError: 'Command' object has no attribute 'tool_call_id' when tool returns Command object #431

@EcoleKeine

Description

@EcoleKeine

Error when using langgraph_supervisor create_supervisor()

Log

  File "...\.venv\Lib\site-packages\ag_ui_langgraph\agent.py", line 106, in run
    async for event_str in self._handle_stream_events(input.copy(update={"forwarded_props": forwarded_props})):
        yield event_str
  File "...\.venv\Lib\site-packages\ag_ui_langgraph\agent.py", line 211, in _handle_stream_events
    async for single_event in self._handle_single_event(event, state):
        yield single_event
  File "...\.venv\Lib\site-packages\copilotkit\langgraph_agui_agent.py", line 167, in _handle_single_event
    async for event_str in super()._handle_single_event(event, state):
        yield event_str
  File "...\.venv\Lib\site-packages\ag_ui_langgraph\agent.py", line 677, in _handle_single_event
    tool_call_id=tool_call_output.tool_call_id,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Command' object has no attribute 'tool_call_id'
WARNING:langgraph:Task supervisor with path ('__pregel_pull', 'supervisor') wrote to unknown channel remaining_steps, ignoring it.
ERROR:asyncio:Task exception was never retrieved

According to the LangGraph documentation https://langchain-ai.github.io/langgraph/how-tos/tool-calling/#short-term-memory, tools can return a langgraph.types.Command object

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions