-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'Command' object has no attribute 'content' #3281
Comments
Also, it appears that Command cannot handle a goto back to the tool-calling agent, which is useful when the tool calling agent calls the wrong goto agent, so you want the tool calling agent to try again: if agent_name not in available_agents:
error_message = f"Agent {agent_name} is not available. Choose one of: {', '.join(available_agents)}",
return Command(
goto="AGENT_THAT_CALLED_THIS_TOOL",
update={"messages": [AIMessage(content=error_message)]},
) The error is: |
This looks like error in your code and not in langgraph --
You would need to implement custom logic for this, option 1: keep track of the currently active agent (either in the state or in AIMessage.name field) agent_that_called = get_active_agent_name()
if agent_name not in available_agents:
error_message = f"Agent {agent_name} is not available. Choose one of: {', '.join(available_agents)}",
return Command(
goto=agent_that_called,
update={"messages": [ToolMessage(content=error_message, tool_call_id=...)]},
) option 2: if you're using the prebuilt if agent_name not in available_agents:
raise ValueError(" f"Agent {agent_name} is not available. Choose one of: {', '.join(available_agents)}")
...
return Command(...) lastly, i think you have a typo in your original code example:
|
@nick-youngblut did you manage to resolve your issue? |
@vbarda no, I gave up on using |
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Description
Command
is not working with this simple example, andoutput_placeholder.code(event['data'].get('output').content)
is not very helpful for determining the cause of the error.System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
The text was updated successfully, but these errors were encountered: