Skip to main content
An async tool yields a CustomEvent populated from request session state. Serving the agent through AgentOS turns that event into the same SSE surface as built-in run events. The client sends session state, consumes the stream, and asserts the custom customer-profile event arrived.
custom_events.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export your OpenAI API key

4

Run the example

Save the code above as custom_events.py, then run:
Full source: cookbook/05_agent_os/06_customize/custom_events.py