Async Tools
Agno Agents can execute multiple tools concurrently, allowing you to process function calls that the model makes efficiently. This is especially valuable when the functions involve time-consuming operations. It improves responsiveness and reduces overall execution time.
Here is an example:
Run the Agent:
How to use:
- Provide your Agent with a list of tools, preferably asynchronous for optimal performance. However, synchronous functions can also be used since they will execute concurrently on separate threads.
- Run the Agent using either the
arun
oraprint_response
method, enabling concurrent execution of tool calls.
Concurrent execution of tools requires a model that supports parallel function
calling. For example, OpenAI models have a parallel_tool_calls
parameter
(enabled by default) that allows multiple tool calls to be requested and
executed simultaneously.
In this example, gpt-4o
makes three simultaneous tool calls to atask1
, atask2
and atask3
. Normally these tool calls would execute sequentially, but using the aprint_response
function, they run concurrently, improving execution time.