Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Would it be possible to expose callId in tool lifecycle events for better tracking? #100

Closed
@physihan

Description

@physihan

Description:

I've been exploring how to track individual tool calls across their lifecycle using the OpenAI Agents JS SDK. I noticed that the agent_tool_start and agent_tool_end events don't seem to include a callId or similar identifier, which makes it a bit tricky to correlate the beginning and end of a specific tool call—especially when a tool may be invoked multiple times concurrently.

Question / Suggestion

Is there a reason why callId (which I believe is used internally to track tool invocations) isn't exposed in the tool lifecycle events?

If it's technically feasible, would it make sense to include it in the emitted events like so?

agent_tool_start: [
  context: RunContext<TContext>,
  agent: Agent<TContext, TOutput>,
  tool: Tool,
  callId: string  // <- possible addition?
];

agent_tool_end: [
  context: RunContext<TContext>,
  agent: Agent<TContext, TOutput>,
  tool: Tool,
  result: string,
  callId: string  // <- possible addition?
];

Why This Might Help

Having access to something like callId would be useful for:

  • Linking agent_tool_start and agent_tool_end for the same tool call
  • Measuring execution time for individual tool invocations
  • Debugging and monitoring concurrent tool usage
  • Correlating human approval workflows with specific tool executions

Current Workaround

At the moment, I'm considering workarounds like generating my own unique IDs per tool invocation, but that feels redundant if the SDK already generates and tracks a callId internally.

Curious to Know

If there's already a way to do this or a better recommended approach, I’d love to hear about it!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions