Welcome to the OpenTelemetry Python GenAI Instrumentations repository!
New to OpenTelemetry? Read the New Contributor Guide first — it covers the CLA, Code of Conduct, and other prerequisites.
If you are using AI agents to assist with contributions, please also read AGENTS.md for guidance on how to use them responsibly in this project.
- Python — see
tox.inifor the supported versions. uv— used to manage the workspace and to back thetoxtest environments.
├── instrumentation/
│ └── opentelemetry-instrumentation-genai-<name>/ # one package per GenAI library
│ ├── src/opentelemetry/instrumentation/genai/<name>/
│ ├── tests/
│ └── pyproject.toml
└── util/
└── opentelemetry-util-genai/ # shared GenAI utilities
├── src/opentelemetry/util/genai/
├── tests/
└── pyproject.toml
The monorepo uses uv workspaces; each package owns its own pyproject.toml,
version, and entry points. tox.ini defines the test matrix.
Instrumentation packages are named opentelemetry-instrumentation-genai-<name> and import as
opentelemetry.instrumentation.genai.<name> — for example,
opentelemetry-instrumentation-genai-anthropic imports
opentelemetry.instrumentation.genai.anthropic.
Packages use the OpenTelemetry beta versioning format — MAJOR.MINORbN (e.g. 1.0b0). version.py carries a .dev
suffix during development (1.0b0.dev); the release workflow drops it.
Install all packages and dev tools into a single workspace virtual environment:
uv sync --frozen --all-packagesuv run pre-commit run ruff --all-filesRun the test environment for the package you changed (append -oldest or
-latest for the version variants defined in tests/requirements.{oldest,latest}.txt):
uv run tox -e py312-test-instrumentation-genai-openai-latestRun type checking across the workspace:
uv run tox -e typecheckGenAI tests replay recorded HTTP interactions (cassettes) stored under each
package's tests/cassettes/.
- Run: nothing extra — cassettes replay automatically when present. Tests that need a cassette skip if it is missing and no real API key is set.
- Record: delete the target
tests/cassettes/<test_name>.yaml, export a real provider API key (e.g.OPENAI_API_KEY,ANTHROPIC_API_KEY), and rerun the test.pytest-vcrwrites the cassette on the live call. - Sanitize: every package's
vcr_config()intests/conftest.pymust scrub auth viafilter_headersand strip identifying response headers viascrub_response_headers(...)fromopentelemetry.test_util_genai.vcr. Diff each new cassette before committing — leaked API keys, org ids, orSet-Cookievalues block the PR. - AI-generated cassettes: if you lack provider access, you may
synthesize a cassette from the provider's API reference via AI. Add a
# TODO: this is generated by AI, re-recordcomment at the top of the cassette, mention it in the PR, and open a follow-up issue to re-record it in CI against the real provider. - CI: replay-only; recording in CI is a future improvement.
This repo uses towncrier to manage
changelogs. Each PR with user-visible impact must add a changelog fragment
under the affected package's .changelog/ directory rather than editing
CHANGELOG.md directly.
Fragment path: <package>/.changelog/<PR_NUMBER>.<TYPE>
Types: added, changed, deprecated, removed, fixed.
The file contains a one-line description. For example,
instrumentation/opentelemetry-instrumentation-genai-anthropic/.changelog/123.fixed:
fix request hook not being called when stream=True
Don't include the PR number in the body — towncrier appends it from the filename.
Preview the rendered changelogs locally:
uv run tox -e changelog-previewIf your change doesn't need an entry (pure docs/tooling), add the
Skip Changelog label to the PR.
This repo ships skills (under .github/skills/) that automate the heavy,
repeatable contribution flows. Trigger them deliberately when
you start one of these tasks:
migrate-from-openinference— migrate anopeninference-instrumentation-*package into this repo as an OTel GenAI package, or augment an existing package with the coverage OpenInference adds on top.review-migration— review a ported or augmented package against its upstream implementation and writeMIGRATION_REPORT.md.write-conformance-tests— author conformance scenarios and thetest_conformance.pyrunner for an instrumentation package.
Please contribute back anything you learn while using the skills that could help improve them!
One logical change per PR. Don't bundle unrelated fixes, refactors, or features — split them so each can be reviewed and reverted independently. Small, focused PRs are much easier to review, and therefore much more likely to land quickly.
If a PR review surfaces contentious or difficult points, consider splitting those into follow-up PRs so the uncontroversial parts can land and each of the harder points gets its own focused discussion and review.
Post in #otel-genai-instrumentation on CNCF Slack or join the next GenAI SIG meeting and add your topic to the meeting agenda. See the community repo for current meeting times.
- Trask Stalnaker, Microsoft
- Liudmila Molkova
- Aaron Abbott, Google
For more information about the maintainer role, see the community repository.
- Dylan Russell, Google
- Mike Goldsmith, Honeycomb
- Keith Decker, Cisco
- Leighton Chen, Microsoft
For more information about the approver role, see the community repository.