Skip to main content
Use tool hooks with teams and agents to intercept tool calls. The hook in this example logs each call and measures its execution time.

Code

team_with_tool_hooks.py

Usage

1

Create a Python file

Create team_with_tool_hooks.py with the code above.
2

Set up your virtual environment

3

Install dependencies

4

Export your OpenAI API key

5

Run Team