Skip to content

How can I access which tools were used and their outputs in an agent run (without external tracing)? #1305

@Shivam-Bahuguna-Seatrium

Description

I am using the OpenAI agents library and running agents like this:

result = await Runner.run(agent, prompt, context=context, session=self.session)

my_agent = Agent(
name="MyAgent",
instructions="Use the tool if needed.",
model="",
tools=[MyTool()],
)

After running the agent, how can I programmatically get the names of the tools that were actually used during the run?
Is there a built-in way to access this information from the result object or elsewhere, without using external tracing tools like Logfire or LangGraph?

If not, what is the recommended approach to capture tool usage for auditing or display purposes?

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already existsquestionQuestion about using the SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions