OpenAI Agents SDK

Trace the OpenAI Agents SDK in Python and TypeScript.

Register the Neatlogs trace processor once, and all agent runs, LLM generations, and tool calls from the OpenAI Agents SDK are captured.

Prerequisites

pip install -U "neatlogs[openai-agents]" openai-agents

Usage

import os
import neatlogs
from agents import Agent, Runner, add_trace_processor

neatlogs.init(api_key=os.environ["NEATLOGS_API_KEY"], workflow_name="openai-agents-demo")

add_trace_processor(neatlogs.openai_agents_processor())

agent = Agent(name="assistant", instructions="Be concise.")
result = Runner.run_sync(agent, "In one sentence, what is the OpenAI Agents SDK?")
print(result.final_output)

neatlogs.flush()
neatlogs.shutdown()

The processor produces a WORKFLOW trace root for each agent run, with nested AGENT, LLM generation, and TOOL spans for each tool call — no manual @span / span() wrapping needed.

On this page