maple-agent-tracing-openai-agents

Installation
SKILL.md

Maple agent tracing for the OpenAI Agents SDK

Goal: every conversation with the app shows up in Maple Agent Sessions as exactly one session, one turn per Runner.run, with transcript, model calls, tool calls (failures marked), agent lanes for sub-agents and handoffs, and tokens (streamed turns included).

Mechanism: the SDK has its own tracing pipeline (not OpenTelemetry) whose default processor uploads to the OpenAI dashboard. openinference-instrumentation-openai-agents registers a processor on that pipeline that converts each SDK span into an OTel span; an OTel SDK TracerProvider + OTLP/HTTP exporter sends them to Maple.

Python is the primary path. TypeScript (@openai/agents in package.json): Step 1 applies; then follow Step 2e in place of Steps 0 and 2a-6, and verify with Step 7. The TypeScript bridge exports less (see the end of 2e).

Step 0: Detect versions and existing setup

  1. Find the project file (pyproject.toml, requirements*.txt, uv.lock, poetry.lock) and the installed openai-agents version. Target openai-agents>=0.22 (verified 0.22.3) and openinference-instrumentation-openai-agents>=2.5 (verified 2.5.0; 1.x does not record agent names). Python 3.10 to 3.14.
  2. Grep for existing tracing: TracerProvider(, set_tracer_provider, OpenAIAgentsInstrumentor, set_trace_processors, add_trace_processor, set_tracing_disabled, OPENAI_AGENTS_DISABLE_TRACING, tracing_disabled=, logfire.configure, instrument_openai_agents, OpenAIInstrumentor, phoenix.otel.register, langfuse, openlit.init, Traceloop.init.
    • Existing TracerProvider of the app's own: reuse it. Add a BatchSpanProcessor(OTLPSpanExporter(...)) for Maple to it. Do not create a second provider.
    • Existing OpenAIAgentsInstrumentor().instrument(...): edit that call; never call instrument() twice.
    • Tracing disabled anywhere (set_tracing_disabled(True), OPENAI_AGENTS_DISABLE_TRACING=1, RunConfig(tracing_disabled=True)): remove it. It kills the pipeline the bridge reads; zero spans.
    • Any other instrumentation on the same calls (OpenInference OpenAIInstrumentor, Logfire instrument_openai_agents/instrument_openai, Langfuse/Traceloop/OpenLIT Agents or OpenAI instrumentors, opentelemetry-instrumentation-genai-openai-agents): remove it or every model call is recorded twice.
  3. Find every Runner.run(, Runner.run_sync(, Runner.run_streamed( and where the conversation/thread id lives in the request. Note RunConfig(group_id=...) and SQLiteSession(...)/other Session ids: reuse that id in Step 3.
  4. Find the model setup: default OpenAI (Responses API, OPENAI_API_KEY) vs a custom base URL (AsyncOpenAI(base_url=...), set_default_openai_client, OpenAIChatCompletionsModel, set_default_openai_api("chat_completions"), LiteLLM extension).
Installs
5
GitHub Stars
1.9K
First Seen
Oct 8, 2026