Open
Description
Follwoing the readme of https://github.com/langchain-ai/langgraph-supervisor-py, I am trying to create Supervisor agent with Cohere Command R Refresh model. Fails with AttributeError: 'CohereTool' object has no attribute 'get'
Code:
from langgraph_supervisor import create_supervisor
from langgraph.prebuilt import create_react_agent
# Create supervisor workflow
workflow = create_supervisor(
[research_agent, math_agent],
model=model,
prompt=(
"You are a team supervisor managing a research expert and a math expert. "
"For current events, use research_agent. "
"For math problems, use math_agent."
)
)
Error Stacktrace:
AttributeError Traceback (most recent call last)
Cell In[19], line 2
1 # Create supervisor workflow
----> 2 workflow = create_supervisor(
3 [research_agent, math_agent],
4 model=model,
5 prompt=(
6 "You are a team supervisor managing a research expert and a math expert. "
7 "For current events, use research_agent. "
8 "For math problems, use math_agent."
9 )
10 )
File ~/lib/python3.13/site-packages/langgraph_supervisor/supervisor.py:211, in create_supervisor(agents, model, tools, prompt, response_format, parallel_tool_calls, state_schema, config_schema, output_mode, add_handoff_back_messages, supervisor_name, include_agent_name)
208 if include_agent_name:
209 model = with_agent_name(model, include_agent_name)
--> 211 supervisor_agent = create_react_agent(
212 name=supervisor_name,
213 model=model,
214 tools=all_tools,
215 prompt=prompt,
216 state_schema=state_schema,
217 response_format=response_format,
218 )
220 builder = StateGraph(state_schema, config_schema=config_schema)
221 builder.add_node(supervisor_agent, destinations=tuple(agent_names) + (END,))
File ~/lib/python3.13/site-packages/langgraph/prebuilt/chat_agent_executor.py:154, in _convert_modifier_to_prompt.<locals>.wrapper(*args, **kwargs)
151 prompt = state_modifier
153 kwargs["prompt"] = prompt
--> 154 return func(*args, **kwargs)
File ~/lib/python3.13/site-packages/langgraph/prebuilt/chat_agent_executor.py:653, in create_react_agent(model, tools, prompt, response_format, state_schema, config_schema, checkpointer, store, interrupt_before, interrupt_after, debug, version, name)
649 model = cast(BaseChatModel, init_chat_model(model))
651 tool_calling_enabled = len(tool_classes) > 0
--> 653 if _should_bind_tools(model, tool_classes) and tool_calling_enabled:
654 model = cast(BaseChatModel, model).bind_tools(tool_classes)
656 model_runnable = _get_prompt_runnable(prompt) | model
File ~/lib/python3.13/site-packages/langgraph/prebuilt/chat_agent_executor.py:186, in _should_bind_tools(model, tools)
183 bound_tool_names = set()
184 for bound_tool in bound_tools:
185 # OpenAI-style tool
--> 186 if bound_tool.get("type") == "function":
187 bound_tool_name = bound_tool["function"]["name"]
188 # Anthropic-style tool
AttributeError: 'CohereTool' object has no attribute 'get'
Metadata
Metadata
Assignees
Labels
No labels