Skip to main content
Yield custom events from a custom tool and consume them while streaming.
This example omits stream_events=True, so Agno discards the yielded custom event. Add the option before running.
custom_tool_events.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export your OpenAI API key

4

Enable custom events

In the saved file, add stream_events=True next to stream=True in the agent.arun() call.
5

Run the example

Save the code above as custom_tool_events.py, then run:
Full source: cookbook/91_tools/custom_tool_events.py