-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Please read this first
- Have you read the docs? Agents SDK docs
- Have you searched for related issues? Others may have had similar requests
Describe the feature
Problem Statement
I'm leveraging lifecycle events to record timing metrics for my AI agent. I have a class that inherits RunHooksBase
. When on_agent_start and on_tool_start are called, I begin timers. When on_agent_end or on_tool_end are called, I stop timers and record the metric. Unfortunately, I'm unable to differentiate between tool calls. Thus, metrics may be slightly imprecise if the agent has parallel tool calls enabled. Knowing with *_start
corresponds with which *_end
would allow this type of observability.
Feature Details
If possible, all hook methods should have access to a unique ID that identifies the tool call. I notice that elsewhere, ToolContext provides a tool_call_id
. This type of value would be ideal for lifecycle events and satisfy the problem statement above.