← All integrations
// integration

OpenTelemetry tracing for multi-agent runs

An optional first-party adapter from TraceRecord v2 to the provider your application already owns.

Enterprise support
01 setup

A minimal setup.

import {
  BasicTracerProvider,
  InMemorySpanExporter,
  SimpleSpanProcessor,
} from '@opentelemetry/sdk-trace-base'
import { OpenMultiAgent, type AgentConfig } from '@open-multi-agent/core'
import { createOtelTraceSink } from '@open-multi-agent/otel'

// npm install @open-multi-agent/core@^1.12.1 @open-multi-agent/otel@^0.1.0
// npm install @opentelemetry/api @opentelemetry/sdk-trace-base
// Set OPENAI_API_KEY in the environment for the demo team.
const exporter = new InMemorySpanExporter()
const provider = new BasicTracerProvider({
  spanProcessors: [new SimpleSpanProcessor(exporter)],
})
const sink = createOtelTraceSink({ tracerProvider: provider })

const agents: AgentConfig[] = [
  { name: 'researcher', systemPrompt: 'Gather the key facts.' },
  { name: 'writer', systemPrompt: 'Write a tight summary.' },
]

const oma = new OpenMultiAgent({
  defaultProvider: 'openai',
  defaultModel: 'gpt-5.4-mini',
  observability: { sinks: [sink] },
})
const team = oma.createTeam('brief', { name: 'brief', agents })

try {
  await oma.runTeam(team, 'Summarize the latest release notes.')
  await sink.forceFlush({ timeoutMs: 1_000 })
  console.log(exporter.getFinishedSpans().length)
} finally {
  await sink.shutdown({ timeoutMs: 1_000 })
  await provider.shutdown()
}
02 how it fits

How it fits.

@open-multi-agent/[email protected] is the optional first-party bridge for TraceRecord v2, introduced in core v1.11.0 and compatible with core v1.12.1. createOtelTraceSink() maps one OMA span lifecycle to OpenTelemetry spans, including stable run IDs, task and tool relationships, token counts, cost metadata, retry fields, and compatible gen_ai.* attributes. Your application supplies and owns the tracer or provider; the adapter never installs a global provider and does not shut down a shared provider unless you explicitly opt in. The in-memory exporter above keeps the example runnable without a collector; replace it with the SDK and exporter your application already uses. Prompt, completion, tool payload, credential, and reasoning content are filtered by the adapter by default; treat all telemetry redaction as best-effort and apply your own sink policy before export.

// Enterprise

Taking this to production?

open-multi-agent is MIT-licensed and free to run yourself. When you need it delivered, integrated, or supported on a deadline, 元定义科技 (YuanASI) offers commercial delivery and support.

Enterprise support