User Control Flows
Async External Tool Execution
This example demonstrates how to implement asynchronous external tool execution, allowing for non-blocking execution of tools outside of the agent’s control.
Code
cookbook/agent_concepts/user_control_flows/external_tool_execution_async.py
Usage
1
Create a virtual environment
Open the Terminal
and create a python virtual environment.
2
Set your API key
3
Install libraries
4
Run Example
Key Features
- Uses
agent.arun()
for asynchronous agent execution - Implements
agent.acontinue_run()
for async continuation - Maintains the same external tool execution flow as synchronous version
- Demonstrates how to handle async execution with external tools
Use Cases
- Non-blocking external tool execution
- High-performance applications requiring async execution
- Web applications with external service calls
- Long-running operations with external tools