Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/python_dependency_bounds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trap 'rm -rf "$tmp"' EXIT

if [ "$#" -eq 0 ]; then
set -- sdks/python sdks/python-anthropic sdks/python-bedrock sdks/python-google-genai \
sdks/python-litellm sdks/python-openai sdks/python-openrouter
sdks/python-litellm sdks/python-openai sdks/python-openai-agents sdks/python-openrouter
fi

for package in "$@"; do
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
python-version: "3.13"
- name: Install locked Python dependencies
run: |
for package in sdks/python sdks/python-anthropic sdks/python-bedrock sdks/python-google-genai sdks/python-litellm sdks/python-openai sdks/python-openrouter; do
for package in sdks/python sdks/python-anthropic sdks/python-bedrock sdks/python-google-genai sdks/python-litellm sdks/python-openai sdks/python-openai-agents sdks/python-openrouter; do
uv sync --frozen --directory "$package"
done
- run: pnpm run py:check
Expand All @@ -85,6 +85,7 @@ jobs:
- sdks/python-google-genai
- sdks/python-litellm
- sdks/python-openai
- sdks/python-openai-agents
- sdks/python-openrouter
steps:
- uses: actions/checkout@v5
Expand Down
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,26 @@ Streamed output is kept within fixed size limits that each provider package's RE

Each integration links to its installation instructions and API coverage. The link text is the npm or PyPI package name.

| Integration | TypeScript | Python |
| ---------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
| Core SDK | [`@telemetry-dev/sdk`](packages/sdk) | [`telemetry-dev`](sdks/python) |
| Existing OpenTelemetry setup | [`@telemetry-dev/otel`](packages/otel) | [`telemetry-dev`](sdks/python) (`telemetry_dev.otel`) |
| OpenAI | [`@telemetry-dev/openai`](packages/openai) | [`telemetry-dev-openai`](sdks/python-openai) |
| Anthropic | [`@telemetry-dev/anthropic`](packages/anthropic) | [`telemetry-dev-anthropic`](sdks/python-anthropic) |
| Amazon Bedrock | [`@telemetry-dev/bedrock`](packages/bedrock) | [`telemetry-dev-bedrock`](sdks/python-bedrock) |
| Google GenAI | [`@telemetry-dev/google-genai`](packages/google-genai) | [`telemetry-dev-google-genai`](sdks/python-google-genai) |
| OpenRouter | [`@telemetry-dev/openrouter`](packages/openrouter) | [`telemetry-dev-openrouter`](sdks/python-openrouter) |
| Vercel AI SDK | [`@telemetry-dev/ai-sdk`](packages/ai) | |
| TanStack AI | [`@telemetry-dev/tanstack-ai`](packages/tanstack-ai) | |
| OpenAI Agents SDK | [`@telemetry-dev/openai-agents`](packages/openai-agents) | |
| LangChain and LangGraph | [`@telemetry-dev/langchain`](packages/langchain) | |
| LiteLLM | | [`telemetry-dev-litellm`](sdks/python-litellm) |
| MCP | [`@telemetry-dev/mcp`](packages/mcp) | |
| Eve | [`@telemetry-dev/eve`](packages/eve) | |
| Cursor | [`@telemetry-dev/cursor`](packages/cursor) | |
| OpenCode | [`@telemetry-dev/opencode`](packages/opencode) | |
| Oh My Pi | [`@telemetry-dev/omp`](packages/omp) | |
| Pi | [`@telemetry-dev/pi`](packages/pi) | |
| Integration | TypeScript | Python |
| ---------------------------- | -------------------------------------------------------- | ---------------------------------------------------------- |
| Core SDK | [`@telemetry-dev/sdk`](packages/sdk) | [`telemetry-dev`](sdks/python) |
| Existing OpenTelemetry setup | [`@telemetry-dev/otel`](packages/otel) | [`telemetry-dev`](sdks/python) (`telemetry_dev.otel`) |
| OpenAI | [`@telemetry-dev/openai`](packages/openai) | [`telemetry-dev-openai`](sdks/python-openai) |
| Anthropic | [`@telemetry-dev/anthropic`](packages/anthropic) | [`telemetry-dev-anthropic`](sdks/python-anthropic) |
| Amazon Bedrock | [`@telemetry-dev/bedrock`](packages/bedrock) | [`telemetry-dev-bedrock`](sdks/python-bedrock) |
| Google GenAI | [`@telemetry-dev/google-genai`](packages/google-genai) | [`telemetry-dev-google-genai`](sdks/python-google-genai) |
| OpenRouter | [`@telemetry-dev/openrouter`](packages/openrouter) | [`telemetry-dev-openrouter`](sdks/python-openrouter) |
| Vercel AI SDK | [`@telemetry-dev/ai-sdk`](packages/ai) | |
| TanStack AI | [`@telemetry-dev/tanstack-ai`](packages/tanstack-ai) | |
| OpenAI Agents SDK | [`@telemetry-dev/openai-agents`](packages/openai-agents) | [`telemetry-dev-openai-agents`](sdks/python-openai-agents) |
| LangChain and LangGraph | [`@telemetry-dev/langchain`](packages/langchain) | |
| LiteLLM | | [`telemetry-dev-litellm`](sdks/python-litellm) |
| MCP | [`@telemetry-dev/mcp`](packages/mcp) | |
| Eve | [`@telemetry-dev/eve`](packages/eve) | |
| Cursor | [`@telemetry-dev/cursor`](packages/cursor) | |
| OpenCode | [`@telemetry-dev/opencode`](packages/opencode) | |
| Oh My Pi | [`@telemetry-dev/omp`](packages/omp) | |
| Pi | [`@telemetry-dev/pi`](packages/pi) | |

Some integrations need no package from this repository, because the tool exports OpenTelemetry
itself or through a third-party library: Claude Code, Claude Platform, Claude SDK native spans,
Expand Down
40 changes: 40 additions & 0 deletions docs/sdk-conformance.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,46 @@ or `MetricProducer` API. The first accepted span with intervals reports the limi
`on_error` and the SDK logger; no undrainable aggregate is retained.
The metrics use DELTA temporality and the bucket boundaries in `packages/otel/src/metrics.ts`.

## OpenAI Agents SDK

`@telemetry-dev/openai-agents` and `telemetry-dev-openai-agents` map the traces of the OpenAI
Agents SDK to spans by the same table. Each Agents trace gets a root span of `type: "span"`, named
after the trace, with `openai_agents.trace_id` and, when the trace has a `groupId` (`group_id`
in Python), `gen_ai.conversation.id`. Every other span keeps its Agents parent, or the root when the parent
is unknown.

| Agents span | Span name | `type` | Fields |
| ------------------------ | ------------------------ | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `agent` | `invoke_agent {name}` | `agent` | `agentName`; `openai_agents.agent.{tools,handoffs,output_type}` |
| `task` | `task {name}` | `span` | |
| `turn` | `turn {n}` | `span` | `openai_agents.turn` |
| `response`, `generation` | `chat {model}` | `generation` | model, response model and id (for `generation`, Python only on streamed calls), usage, input, output; `provider: "openai"` only for `response` |
| `function` | `execute_tool {name}` | `tool` | `toolName`, `toolCallId`, input, output; `openai_agents.mcp.server` |
| `handoff` | `handoff {from} -> {to}` | `span` | `openai_agents.handoff.{from,to}` |
| `guardrail` | `guardrail {name}` | `span` | `openai_agents.guardrail.{name,triggered}` |
| `mcp_tools` | `mcp_tools {server}` | `span` | `openai_agents.mcp.tool_count` |
| `custom` `sandbox.*` | its name | `span` | `sandbox.operation`; `sandbox.backend` when the Agents SDK records it; see below for `sandbox.exec` |
| other `custom` | its name | `span` | string, number, and boolean values of its data as metadata |

Only `chat` spans carry usage: task, turn, and agent spans repeat the totals of their calls.
`toolCallId` comes from the tool call of the same name and arguments, else the same name, in the
output of the model call under the same parent; the Agents SDK puts no call id on tool spans.
The `exec_command` and `write_stdin` tool spans get `process.exit.code` from the
`Process exited with code N` line in the header of their output; a non-zero code does not mark the
span failed.

The two Agents SDKs record `sandbox.exec` differently. In TypeScript its data holds the command and
working directory, sent as `process.command_line` and `process.working_directory` input content. In
Python its data holds the exit code, sent as `process.exit.code`; the Agents SDK marks a non-zero
exit as an error, and the span is not marked failed. In Python every session operation records
its backend; in TypeScript only session create and resume do.

The root ends when the trace ends, or, for a trace with no open span, at a flush or shutdown, at
the end of its last span. The TypeScript Agents SDK does not end the trace of a run that throws, so
there the root also ends when a top-level `task` or `agent` span ends with an error; the Python
Agents SDK ends the trace either way. A processor keeps the roots of the 10,000
most recently active traces, so spans that end later still nest under them.

## Prompts

`getPrompt(name, options)` / `get_prompt(name, ...)` send `GET {baseUrl}/v1/prompts?name=<name>`
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"build": "vp run -r build",
"check": "cross-env OPENAI_SDK_VERSION=7 vp check && vp run @telemetry-dev/openai#check:v6 && vp run @telemetry-dev/anthropic#check:v0",
"test": "vp run -r test",
"py:sync": "uv sync --directory sdks/python && uv sync --directory sdks/python-anthropic && uv sync --directory sdks/python-bedrock && uv sync --directory sdks/python-google-genai && uv sync --directory sdks/python-litellm && uv sync --directory sdks/python-openai && uv sync --directory sdks/python-openrouter",
"py:check": "uv run --directory sdks/python ruff format --check . && uv run --directory sdks/python ruff check . && uv run --directory sdks/python pyright && uv run --directory sdks/python pyright --verifytypes telemetry_dev --ignoreexternal && uv run --directory sdks/python-anthropic ruff format --check . && uv run --directory sdks/python-anthropic ruff check . && uv run --directory sdks/python-anthropic pyright && uv run --directory sdks/python-anthropic pyright --verifytypes telemetry_dev_anthropic --ignoreexternal && uv run --directory sdks/python-bedrock ruff format --check . && uv run --directory sdks/python-bedrock ruff check . && uv run --directory sdks/python-bedrock pyright && uv run --directory sdks/python-bedrock pyright --verifytypes telemetry_dev_bedrock --ignoreexternal && uv run --directory sdks/python-google-genai ruff format --check . && uv run --directory sdks/python-google-genai ruff check . && uv run --directory sdks/python-google-genai pyright && uv run --directory sdks/python-google-genai pyright --verifytypes telemetry_dev_google_genai --ignoreexternal && uv run --directory sdks/python-litellm ruff format --check . && uv run --directory sdks/python-litellm ruff check . && uv run --directory sdks/python-litellm pyright && uv run --directory sdks/python-litellm pyright --verifytypes telemetry_dev_litellm --ignoreexternal && uv run --directory sdks/python-openai ruff format --check . && uv run --directory sdks/python-openai ruff check . && uv run --directory sdks/python-openai pyright && uv run --directory sdks/python-openai pyright --verifytypes telemetry_dev_openai --ignoreexternal && uv run --directory sdks/python-openrouter ruff format --check . && uv run --directory sdks/python-openrouter ruff check . && uv run --directory sdks/python-openrouter pyright && uv run --directory sdks/python-openrouter pyright --verifytypes telemetry_dev_openrouter --ignoreexternal",
"py:test": "uv run --directory sdks/python pytest && uv run --directory sdks/python-anthropic pytest && uv run --directory sdks/python-bedrock pytest && uv run --directory sdks/python-google-genai pytest && uv run --directory sdks/python-litellm pytest && uv run --directory sdks/python-openai pytest && uv run --directory sdks/python-openrouter pytest",
"py:sync": "uv sync --directory sdks/python && uv sync --directory sdks/python-anthropic && uv sync --directory sdks/python-bedrock && uv sync --directory sdks/python-google-genai && uv sync --directory sdks/python-litellm && uv sync --directory sdks/python-openai && uv sync --directory sdks/python-openai-agents && uv sync --directory sdks/python-openrouter",
"py:check": "uv run --directory sdks/python ruff format --check . && uv run --directory sdks/python ruff check . && uv run --directory sdks/python pyright && uv run --directory sdks/python pyright --verifytypes telemetry_dev --ignoreexternal && uv run --directory sdks/python-anthropic ruff format --check . && uv run --directory sdks/python-anthropic ruff check . && uv run --directory sdks/python-anthropic pyright && uv run --directory sdks/python-anthropic pyright --verifytypes telemetry_dev_anthropic --ignoreexternal && uv run --directory sdks/python-bedrock ruff format --check . && uv run --directory sdks/python-bedrock ruff check . && uv run --directory sdks/python-bedrock pyright && uv run --directory sdks/python-bedrock pyright --verifytypes telemetry_dev_bedrock --ignoreexternal && uv run --directory sdks/python-google-genai ruff format --check . && uv run --directory sdks/python-google-genai ruff check . && uv run --directory sdks/python-google-genai pyright && uv run --directory sdks/python-google-genai pyright --verifytypes telemetry_dev_google_genai --ignoreexternal && uv run --directory sdks/python-litellm ruff format --check . && uv run --directory sdks/python-litellm ruff check . && uv run --directory sdks/python-litellm pyright && uv run --directory sdks/python-litellm pyright --verifytypes telemetry_dev_litellm --ignoreexternal && uv run --directory sdks/python-openai ruff format --check . && uv run --directory sdks/python-openai ruff check . && uv run --directory sdks/python-openai pyright && uv run --directory sdks/python-openai pyright --verifytypes telemetry_dev_openai --ignoreexternal && uv run --directory sdks/python-openai-agents ruff format --check . && uv run --directory sdks/python-openai-agents ruff check . && uv run --directory sdks/python-openai-agents pyright && uv run --directory sdks/python-openai-agents pyright --verifytypes telemetry_dev_openai_agents --ignoreexternal && uv run --directory sdks/python-openrouter ruff format --check . && uv run --directory sdks/python-openrouter ruff check . && uv run --directory sdks/python-openrouter pyright && uv run --directory sdks/python-openrouter pyright --verifytypes telemetry_dev_openrouter --ignoreexternal",
"py:test": "uv run --directory sdks/python pytest && uv run --directory sdks/python-anthropic pytest && uv run --directory sdks/python-bedrock pytest && uv run --directory sdks/python-google-genai pytest && uv run --directory sdks/python-litellm pytest && uv run --directory sdks/python-openai pytest && uv run --directory sdks/python-openai-agents pytest && uv run --directory sdks/python-openrouter pytest",
"py:test:bounds": "bash .github/scripts/python_dependency_bounds.sh",
"py:build": "uv build --directory sdks/python && uv build --directory sdks/python-anthropic && uv build --directory sdks/python-bedrock && uv build --directory sdks/python-google-genai && uv build --directory sdks/python-litellm && uv build --directory sdks/python-openai && uv build --directory sdks/python-openrouter",
"py:build": "uv build --directory sdks/python && uv build --directory sdks/python-anthropic && uv build --directory sdks/python-bedrock && uv build --directory sdks/python-google-genai && uv build --directory sdks/python-litellm && uv build --directory sdks/python-openai && uv build --directory sdks/python-openai-agents && uv build --directory sdks/python-openrouter",
"prepare": "vp config"
},
"devDependencies": {
Expand Down
Loading
Loading