Start free

OpenAI Agents SDK integration

Observability for OpenAI Agents SDK

Trace OpenAI Agents SDK workflows in production. Inspect every agent turn, model call, tool call, handoff, and guardrail, then group recurring failures into Signals and evals.

ADD TRACING TO YOUR AGENT

import * as OpenAIAgentsSDK from "@openai/agents"
import { Agent, run, tool } from "@openai/agents"
import { z } from "zod"
import { Latitude, capture } from "@latitude-data/telemetry"
import { createOpenAIAgentsInstrumentation } from
  "@latitude-data/telemetry/instrumentations/openai-agents"

const latitude = new Latitude({
  apiKey: process.env.LATITUDE_API_KEY!,
  project: process.env.LATITUDE_PROJECT_SLUG!,
  instrumentations: [createOpenAIAgentsInstrumentation(OpenAIAgentsSDK)],
})

await latitude.ready

const getOrder = tool({
  name: "get_order",
  description: "Get an order by id.",
  parameters: z.object({ orderId: z.string() }),
  execute: async ({ orderId }) => lookupOrder(orderId),
})

const agent = new Agent({
  name: "Support agent",
  instructions: "Help customers with their orders.",
  tools: [getOrder],
  model: "gpt-4o-mini",
})

await capture(
  "support-agent-turn",
  () => run(agent, userMessage),
  { sessionId: conversationId, userId },
)

Dedicated instrumentation for @openai/agents and openai-agents. Your agent definitions and Runner calls stay the same.

What your OpenAI agent traces turn into

Complete workflows you can inspect end to end, with agent decisions and recurring failures grouped for you.

Three steps to your first trace

Initialize Latitude with the OpenAI Agents instrumentation, then wrap the Runner call. Your agents, tools, handoffs, and guardrails keep their existing definitions.

1

Install the SDK

Use the package for your runtime. Latitude supports the TypeScript and Python OpenAI Agents SDKs.

2

Instrument the Runner call

Initialize Latitude with the dedicated OpenAI Agents instrumentation and wrap the request or job in capture(). Agent runs, generations, function calls, handoffs, guardrails, and MCP activity are recorded inside it.

3

Run one workflow

Open Traces. The agent loop appears in execution order, including the agent selected for each turn, model generations, tool calls, handoffs, and guardrail results.

Send your first trace in minutes. Wrap each request or background job withcapture() and pass a stable session id to connect turns. Short-lived workers should flush before exit so buffered spans are exported. OpenAI’s own tracing can remain enabled alongside Latitude. OpenAI Agents SDK integration guide →

Debug OpenAI Agents SDK failures in production

The production failures created by agent loops, specialized handoffs, tools, guardrails, and persistent conversation state.

Wrong agent or handoff selected

A triage agent transfers a billing request to the wrong specialist, or keeps work that should be delegated. Search the full workflow, compare handoff paths, and track the recurring pattern as a Signal.

Search and Signals →OpenAI handoffs

Tool failures and invalid arguments

A function tool raises, returns an unusable result, or receives arguments that fail its schema. Tool spans preserve the call, validated input, result, error, and surrounding agent turn.

Tool-call spans →

Agent loops hit the turn limit

The runner repeats model and tool turns without reaching a final output until max_turns is exceeded. The Thrashing flagger detects repeated tool use without progress, while traces show the exact loop.

Flaggers →OpenAI running agents

Guardrails miss part of the workflow

Agent input guardrails run on the first agent, output guardrails run on the final agent, and tool guardrails cover custom function tools. Trace each result to find unprotected handoffs, hosted tools, or intermediate behavior.

Guardrail spans →OpenAI guardrails

Find recurring failures hidden across OpenAI agent runs

Reading traces one at a time finds the failure you went looking for. Latitude surfaces the one costing you the most sessions.

Search

Describe it in plain language

Find workflows by meaning, exact text, agent name, model, tool, user, release, or metadata.

Search →

Behaviors

Grouped by what users tried to do

Whole sessions cluster by user intent and outcome, including workflows that crossed several agents.

Behaviors →

Signals

One named, tracked problem

Repeated failures become one Signal with affected sessions, examples, a trend, and a lifecycle. Evaluations keep scoring new traffic after the fix.

Signals →

From production failure to verified fix

Turn a recurring OpenAI Agents SDK failure into a regression test, an opened PR, and evidence from new traffic.

DetectLatitude groups repeated wrong-handoff sessions into a Signal.
TestTurn affected production traces into a regression eval.
FixAgent Dispatch sends the Signal, sample traces, and repo context to Claude Code or Cursor. Your coding agent writes the smallest fix, adds a regression test, and opens a PR.
VerifyLatitude scores new OpenAI agent traffic and alerts you if the failure returns.

Latitude detects and verifies. Your coding agent writes the fix. You review the PR.

Fits the OpenAI agent stack you already have

  • Python 3.11+ and TypeScript
  • OpenAI and supported third-party models
  • Function tools, handoffs, guardrails, and MCP
  • Cloud or self-hosted Latitude (MIT)

Using OpenAI Traces already?

Keep it. The OpenAI Agents SDK supports additional tracing processors, and Latitude’s dedicated instrumentation can run alongside the SDK’s default OpenAI export. Latitude gives you cross-session Search, Behaviors, Signals, production evals, and Agent Dispatch around those workflows. OpenAI tracing docs

For Zero Data Retention workflows, OpenAI’s hosted tracing is unavailable. Latitude can be deployed in your own infrastructure, and trace payload capture should follow your privacy and retention requirements. Disable sensitive input and output capture where required.

When do you need more than OpenAI Agents SDK traces?

Built-in tracing explains one workflow. Production observability also needs to show which failures keep happening across users, releases, and sessions.

CapabilityApplication logsOpenAI TracesLatitude
Agent, model, tool, handoff, and guardrail spansManualYesYes
Complete multi-run sessionsManualGroup IDsYes
Semantic search across sessionsNoLimitedYes
Recurring failure discoveryManualManual reviewSignals
Production traces into evalsNoSeparate workflowYes
Dispatch to your coding agent and verifyNoNoYes
Self-hosted observabilityDependsNoYes

MIT

Open source, 4.3k github stars

20K

Free credits a month, 30-day retention

Unlimited

Seats on every plan, no per-user pricing

GDPR

Compliant, data in AWS eu-central-1

OpenAI Agents SDK observability FAQ

How do I add observability to the OpenAI Agents SDK?

Install @latitude-data/telemetry for TypeScript or latitude-telemetry for Python. Initialize Latitude with the dedicated OpenAI Agents SDK instrumentation, wait for the SDK to be ready, and wrap each Runner request or job in capture(). Latitude records agent runs, model generations, function tools, handoffs, guardrails, and MCP activity.

Can Latitude run alongside OpenAI’s built-in tracing?

Yes. OpenAI’s Agents SDK supports additional tracing processors, and Latitude’s instrumentation can run alongside the default OpenAI trace export. Keep OpenAI Traces for workflow inspection and use Latitude for semantic Search, Behaviors, Signals, production evals, and Agent Dispatch across sessions.

Does Latitude support Python and TypeScript OpenAI agents?

Yes. Python uses openai-agents with latitude-telemetry. TypeScript uses @openai/agents with @latitude-data/telemetry. Both integrations capture agent, generation, function, handoff, and guardrail spans.

How are multiple OpenAI agent runs grouped into one conversation?

Pass the same sessionId to Latitude capture() for every related turn. OpenAI’s group_id serves a similar purpose in its native tracing model, while the Latitude session id groups those captured runs into one searchable conversation.

What OpenAI Agents SDK failures can Latitude detect?

Latitude exposes tool errors, empty responses, output schema failures, repeated tool use, guardrail results, handoff paths, latency, cost, and turn-limit loops in traces. Search, Behaviors, evaluations, and Signals track recurring failures such as wrong specialist routing or lost context across production sessions.

Does Latitude send fixes directly to production?

No. Agent Dispatch sends the Signal, sample traces, and relevant context to your coding agent, such as Claude Code or Cursor. That coding agent writes the smallest fix and regression test, then opens a PR. A human reviews and merges the change.

Can I control sensitive data in traces?

Yes. OpenAI’s Agents SDK can exclude sensitive model and tool inputs and outputs from traces, and Latitude supports ingest-side PII redaction and self-hosting. Configure both layers for your data policy before sending production traffic.

Trace your first OpenAI agent workflow

Connect your OpenAI Agents SDK application, run one production-like workflow, and inspect every agent turn, model call, tool call, handoff, and guardrail in Latitude.

No credit card required.