Skip to main content
This example demonstrates how to use max_tool_calls_from_history to limit the number of tool calls included in the agent’s context. This helps manage context size and reduce token costs while still maintaining complete history in your database.

Code

filter_tool_calls_from_history.py

Usage

1

Create a Python file

Create filter_tool_calls_from_history.py with the code above.
2

Set up your virtual environment

3

Install dependencies

4

Export your OpenAI API key

5

Run Agent