Tools
Exceptions
If after a tool call we need to “retry” the model with a different set of instructions or stop the agent, we can raise one of the following exceptions:
RetryAgentRun
: Use this exception when you want to retry the agent run with a different set of instructions.StopAgentRun
: Use this exception when you want to stop the agent run.AgentRunException
: A generic exception that can be used to retry the tool call.
This example shows how to use the RetryAgentRun
exception to retry the agent with additional instructions.
retry_in_tool_call.py
Make sure to set AGNO_DEBUG=True
to see the debug logs.