User Control Flows
Streaming External Tool Execution
This example demonstrates how to implement streaming external tool execution, allowing for real-time interaction and response streaming while executing tools outside of the agent’s control.
Code
cookbook/agent_concepts/user_control_flows/external_tool_execution_stream.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.run(stream=True)
for streaming responses - Implements streaming continuation with
agent.continue_run(stream=True)
- Maintains real-time interaction with external tool execution
- Demonstrates how to handle streaming responses with external tools
Use Cases
- Real-time external tool execution
- Streaming applications with external service calls
- Interactive interfaces with external tool execution
- Progressive response generation with external tools