Skip to content

feat(anthropic): Add gen_ai.system attribute to spans#5661

Merged
ericapisani merged 1 commit intomasterfrom
ep/py-2135-add-gen-ai-system-span-anthropic-6j2
Mar 13, 2026
Merged

feat(anthropic): Add gen_ai.system attribute to spans#5661
ericapisani merged 1 commit intomasterfrom
ep/py-2135-add-gen-ai-system-span-anthropic-6j2

Conversation

@ericapisani
Copy link
Member

Add the gen_ai.system span attribute (set to "anthropic") to the Anthropic integration.

Other AI integrations (OpenAI, Langchain, Google GenAI, LiteLLM, Pydantic AI) already set this attribute, but it was missing from the Anthropic integration. The attribute is set in _set_input_data() which is called for every span (streaming/non-streaming, sync/async).

Refs PY-2135
Closes #5657

Set the `gen_ai.system` span attribute to "anthropic" for consistency
with other AI integrations (OpenAI, Langchain, Google GenAI) that
already include this attribute.

Refs PY-2135
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linear-code
Copy link

linear-code bot commented Mar 13, 2026

@github-actions
Copy link
Contributor

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Pydantic Ai

  • Support ImageUrl content type in span instrumentation by ericapisani in #5629
  • Add tool description to execute_tool spans by ericapisani in #5596

Other

  • (anthropic) Add gen_ai.system attribute to spans by ericapisani in #5661
  • (crons) Add owner field to MonitorConfig by julwhitney13 in #5610
  • (otlp) Add collector_url option to OTLPIntegration by sl0thentr0py in #5603

Bug Fixes 🐛

  • (celery) Propagate user-set headers by sentrivana in #5581
  • (utils) Avoid double serialization of strings in safe_serialize by ericapisani in #5587
  • Enable unused import ruff check and fix unused imports by sentrivana in #5652

Documentation 📚

  • (openai-agents) Remove inapplicable comment by alexander-alderman-webb in #5495
  • Add AGENTS.md by sentrivana in #5579
  • Add set_attribute example to changelog by sentrivana in #5578

Internal Changes 🔧

Docs

  • Remove agentic codebase documentation workflows by dingsdax in #5655
  • Switch agentic workflows from Copilot to Claude engine by dingsdax in #5654
  • Add agentic workflows for codebase documentation by dingsdax in #5649

Openai Agents

  • Do not fail on new tool fields by alexander-alderman-webb in #5625
  • Stop expecting a specific function name by alexander-alderman-webb in #5623
  • Set streaming header when library uses with_streaming_response() by alexander-alderman-webb in #5583
  • Replace mocks with httpx for streamed responses by alexander-alderman-webb in #5580
  • Replace mocks with httpx in non-MCP tool tests by alexander-alderman-webb in #5602
  • Replace mocks with httpx in MCP tool tests by alexander-alderman-webb in #5605
  • Replace mocks with httpx in handoff tests by alexander-alderman-webb in #5604
  • Replace mocks with httpx in API error test by alexander-alderman-webb in #5601
  • Replace mocks with httpx in non-error single-response tests by alexander-alderman-webb in #5600
  • Remove test for unreachable state by alexander-alderman-webb in #5584
  • Expect namespace tool field for new openai versions by alexander-alderman-webb in #5599

Other

  • (graphene) Simplify span creation by sentrivana in #5648
  • (httpx) Resolve type checking failures by alexander-alderman-webb in #5626
  • (pyramid) Support alpha suffixes in version parsing by alexander-alderman-webb in #5618
  • (rust) Don't implement separate scope management by sentrivana in #5639
  • (strawberry) Simplify span creation by sentrivana in #5647
  • Remove custom warden action by sentrivana in #5653
  • Add httpx to linting requirements by alexander-alderman-webb in #5644
  • Remove CodeQL action by sentrivana in #5616
  • Normalize dots in package names in populate_tox.py by alexander-alderman-webb in #5574
  • Do not run actions on potel-base by sentrivana in #5614

🤖 This preview updates automatically when you update the PR.

@ericapisani ericapisani marked this pull request as ready for review March 13, 2026 10:16
@ericapisani ericapisani requested a review from a team as a code owner March 13, 2026 10:16
@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 12.47s

All tests are passing successfully.

❌ Patch coverage is 0.00%. Project has 14059 uncovered lines.

Files with missing lines (1)
File Patch % Lines
anthropic.py 9.03% ⚠️ 252 Missing

Generated by Codecov Action

@ericapisani ericapisani merged commit a3ee8aa into master Mar 13, 2026
158 checks passed
@ericapisani ericapisani deleted the ep/py-2135-add-gen-ai-system-span-anthropic-6j2 branch March 13, 2026 10:42
sentrivana pushed a commit that referenced this pull request Mar 13, 2026
Add the `gen_ai.system` span attribute (set to `"anthropic"`) to the
Anthropic integration.

Other AI integrations (OpenAI, Langchain, Google GenAI, LiteLLM,
Pydantic AI) already set this attribute, but it was missing from the
Anthropic integration. The attribute is set in `_set_input_data()` which
is called for every span (streaming/non-streaming, sync/async).

Refs PY-2135
Closes #5657
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Anthropic integration] Add gen_ai.system to spans

3 participants