Skip to content

Comments

Anthropic agents boilerplate#4179

Merged
aabmass merged 21 commits intoopen-telemetry:mainfrom
vasantteja:feat/anthropic-agents-boilerplate
Feb 20, 2026
Merged

Anthropic agents boilerplate#4179
aabmass merged 21 commits intoopen-telemetry:mainfrom
vasantteja:feat/anthropic-agents-boilerplate

Conversation

@vasantteja
Copy link
Contributor

@vasantteja vasantteja commented Feb 8, 2026

Description

This PR adds boilerplate instrumentation for the Anthropic Agents SDK, establishing the scaffolding to capture spans/metrics/logs around agent calls and providing a starting point for future telemetry enhancements. This PR is shamelessly inspired from this PR.

Motivation: enable consistent GenAI observability for Claude Agents workflows and align instrumentation shape with other GenAI integrations.

Dependencies: claude-agent-sdk (minimum supported version per package metadata).

Callouts: Claude-agent-sdk requires is compatible with python version >= 3.10

Fixes #4065 partly

P.S: LLM help was used for writing the code.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Basic testing has been added as full functionality is still not implemented.

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md (https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/CONTRIBUTING.md) for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@vasantteja vasantteja requested a review from a team as a code owner February 8, 2026 17:19
@vasantteja vasantteja removed their assignment Feb 9, 2026
@vasantteja vasantteja removed their assignment Feb 10, 2026
- Introduced `opentelemetry-instrumentation-anthropic-agents` package for tracing LLM requests using the Anthropic Python SDK.
- Added support for capturing request and response attributes in accordance with GenAI semantic conventions.
- Included examples for both manual and zero-code instrumentation.
- Created a CHANGELOG.md to document notable changes.
- Added LICENSE and README files for package details and usage instructions.

This commit lays the groundwork for enhanced observability in applications utilizing Anthropic's capabilities.
- Added support for the `opentelemetry-instrumentation-anthropic-agents` package, enabling tracing of requests made through the Claude Agent SDK.
- Updated `pyproject.toml` and `tox.ini` to include new test environments and dependencies for the Anthropic Agents instrumentation.
- Modified GitHub workflows to incorporate linting and testing for the new instrumentation.
- Improved documentation in README files and examples to reflect changes in usage and setup.
- Introduced new examples demonstrating both manual and zero-code instrumentation approaches.

This commit strengthens observability for applications utilizing Claude Agents, ensuring comprehensive tracing and logging capabilities.
…mentation, streamlining the document to reflect current features and improvements.
- Changed dependency from `anthropic >= 0.16.0` to `claude-agent-sdk >= 0.1.14` in `README.md`, `pyproject.toml`, and related files.
- Refactored `AnthropicAgentsInstrumentor` to align with the new SDK, including updates to initialization and logging.
- Removed unused utility functions and cleaned up test configurations to reflect the new dependency.
- Updated tests to ensure compatibility with the Claude Agent SDK.

This commit enhances the instrumentation for applications using the Claude Agent SDK, ensuring accurate tracing and logging capabilities.
…ic Agents instrumentation

- Updated `tox.ini` and `pyproject.toml` to require Python 3.10 or higher, removing support for Python 3.9.
- Cleaned up GitHub workflows by removing outdated test jobs for Python 3.9 and adding new jobs for Python 3.10.
- Updated `README.md` to reflect the new dependency on `claude-agent-sdk` and removed references to the old SDK.
- Made minor code cleanups in example scripts and test files to improve readability.

These changes ensure compatibility with the latest Python versions and streamline the testing process for the Anthropic Agents instrumentation.
@vasantteja vasantteja force-pushed the feat/anthropic-agents-boilerplate branch from da49290 to bfa99a1 Compare February 11, 2026 17:18
@vasantteja vasantteja removed their assignment Feb 11, 2026
Copy link
Contributor

@wrisa wrisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a minor comment other LGTM

@vasantteja vasantteja removed their assignment Feb 13, 2026
Copy link
Member

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I've left one small request to add issues to track the follow-up work.

…ting references in configuration files, workflows, and documentation. Add new files for the Claude Agent SDK instrumentation, including README, examples, and changelog. Ensure proper setup for testing and linting in CI/CD workflows.
Copy link
Member

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

…ts-boilerplate

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	.github/workflows/test_0.yml
#	.github/workflows/test_1.yml
#	.github/workflows/test_2.yml
#	uv.lock
…pic-agents-boilerplate"

This reverts commit 7ed01ec, reversing
changes made to 7e83cd7.
@emdneto emdneto added the gen-ai Related to generative AI label Feb 20, 2026
@aabmass aabmass merged commit a025a20 into open-telemetry:main Feb 20, 2026
771 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gen-ai Related to generative AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add OpenTelemetry Instrumentation for the Claude Agent SDK