Skip to main content
A long agentic run dies of its own tool output. One large search result sits in the message list forever, re-sent on every later model call.
offload_tool_results.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 offload_tool_results.py, then run:
Full source: cookbook/02_agents/22_result_offloading/01_offload_tool_results.py