Skip to content

feat(attributes): Add experimental gen_ai.extract operation - #728

Merged
andreiborza merged 10 commits into
mainfrom
ab/gen-ai-extract
Oct 23, 2026
Merged

andreiborza merged 10 commits into
mainfrom
ab/gen-ai-extract

Conversation

@andreiborza

@andreiborza andreiborza commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

What

Adds a gen_ai.extract op and extract operation name for typed field extraction models, such as Cloudflare's Clairic. The messages record the extraction request and response as the provider sent them.

For the input/output message structure see getsentry/sentry-docs#20107.

Why

Extraction models return typed values from a state, and this does not fit chat or decide spans.

@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sentry-conventions Ready Ready Preview Oct 23, 2026 9:34am UTC

Request Review

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

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 ✨

Attributes

  • Add experimental gen_ai.extract operation by andreiborza in #728
  • Remove next_trace from the sentry.link.type values by s1gr1d in #739
  • Add server_request as a sentry.link.type value by s1gr1d in #738
  • Add LCP and INP subpart attributes by logaretm in #712
  • Add message_origin as a sentry.link.type value by JPeer264 in #724
  • Add aws.lambda.resource_mapping.id attribute by pabloDeputter in #710
  • Add object to the sentry.category values by pabloDeputter in #721
  • Add http.request.duration by loewenheim in #697

Names

  • Add span name rules for rpc spans by pabloDeputter in #714
  • Add queue.publish/create/receive/process/settle to messaging span names by pabloDeputter in #705

Other

  • (descriptions) AWS Lambda function descriptions by pabloDeputter in #720
  • (docs) Add metrics page by logaretm in #733
  • (gen_ai) Add tool call result size attribute by obostjancic in #679
  • (metrics) Add browser bfcache and element timing metrics by logaretm in #729
  • (ops) Add object.copy op by pabloDeputter in #706
  • Add view.render op by alexander-alderman-webb in #699

Bug Fixes 🐛

  • (attributes) Apply consistent scrubbing across deprecations by mjq in #692

Documentation 📚

  • (cache) Define cache.ttl for fractional and per-read TTLs by s1gr1d in #726
  • Clarify cache.ttl for 0, no expiry, and reads by s1gr1d in #725

Internal Changes 🔧

Deps

  • Bump nanoid to 3.3.20 by Lms24 in #737
  • Bump vite from 8.2.1 to 8.3.5 by dependabot in #735
  • Bump markdown-it from 15.0.2 to 15.0.3 by dependabot in #736

Other

  • (attributes) Scrub S3 object keys by default by pabloDeputter in #713
  • (node) Bump Node to 22.23.4 by oioki in #742
  • (repo) Update CODEOWNERS to include @giortzisg by Lms24 in #708
  • Deprecate gen_ai.responses in favor of gen_ai.chat by alexander-alderman-webb in #703
  • Add deprecated messaging ops set by the Python SDK by alexander-alderman-webb in #693
  • Add view.response.render op, deprecated in favor of view.render by alexander-alderman-webb in #700
  • Add event.django op, deprecated in favor of function by alexander-alderman-webb in #698

🤖 This preview updates automatically when you update the PR.

andreiborza added a commit to getsentry/sentry-javascript that referenced this pull request Oct 22, 2026
… spans (#25624)

## What

Workers AI calls to Cloudflare Clairic (`@cf/cloudflare/clairic`) now
create `extract <model>` spans with op `gen_ai.extract`, instead of
`chat` spans without messages.

- Records the request and response bodies as input and output messages,
with images replaced by `[Blob substitute]`
- Records the response model and token usage
- Adds unit tests and a Cloudflare integration test

## Why

Clairic is a typed field extraction model, and the new extraction span
spec (getsentry/sentry-conventions#728) covers it. The op is a local
constant until the conventions release.

Ref #25615

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@andreiborza
andreiborza merged commit ebc8ba0 into main Oct 23, 2026
18 checks passed
@andreiborza
andreiborza deleted the ab/gen-ai-extract branch October 23, 2026 09:38
nicohrubec pushed a commit to getsentry/sentry-javascript that referenced this pull request Oct 27, 2026
…#25734)

Follow-up to #25624. The `gen_ai.extract` op shipped in
`@sentry/conventions` 0.28.0 (getsentry/sentry-conventions#728), and the
repo already depends on 0.29.0, so the local `GEN_AI_EXTRACT_OP`
placeholder is replaced with the `GEN_AI_EXTRACT` export from
`@sentry/conventions/op`. No dependency bump or behavior change.

Ref #25615

<!-- junior-request-attribution:start -->
via **Jan Peer Stöcklmair**.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0CA6TD3QRK%3A1792966562.069879 -->

--

[View Junior
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0CA6TD3QRK%3A1792966562.069879)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0CA6TD3QRK%3A1792966562.069879/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Jan VamPeer Stöcklmair <[email protected]>
ArthurKnaus added a commit to getsentry/sentry-docs that referenced this pull request Nov 4, 2026
## DESCRIBE YOUR PR

Documents the `gen_ai.extract` span in the agent tracing manual
instrumentation guides, modeled on the existing Decision and Memory span
sections. Follows
[sentry-conventions#728](getsentry/sentry-conventions#728),
which adds the experimental `gen_ai.extract` op, the `extract` operation
name, and the extraction shapes for `gen_ai.input.messages` /
`gen_ai.output.messages`.

- Add an "Extraction Span" section to the JavaScript and Python manual
instrumentation pages, placed after "Decision Span". The example uses a
Clairic invoice extraction (same data as the conventions examples):
`gen_ai.extract` op, `extract {model}` name, `gen_ai.operation.name:
"extract"`, the request body without `model` as input messages, and the
response body without `model` and `usage` as output messages
- Add a shared `extraction-span` attributes include: required
op/name/operation name, model, provider, and agent attributes, token
usage, and the input format (`state`, `fields`, `images`,
`reference_date`, `options`, plus field spec types) and output format
(`answers`, `truncated`, `span`/`spans` offsets)
- JS page links to the Workers AI integration, which creates these spans
automatically for Clairic since `@sentry/cloudflare` 11.10.0

Attribute values were checked against sentry-conventions
(`model/op/gen_ai.json`, `gen_ai.operation.name`,
`gen_ai.input.messages`, `gen_ai.output.messages`), the JS Workers AI
instrumentation (`cloudflare.workers_ai` provider name), and the
product's extraction parser (spans are recognized by
`gen_ai.operation.name`).

**Open questions before ready for review**

- The field-level message format overlaps with the develop-docs spec in
#20107 (still open). Once that merges, should the include link there
instead of repeating the field tables?
- The existing Decision span docs still show `{type: "evaluation", ...}`
wrappers, which the current conventions examples and #20107 drop. Out of
scope here, but worth a follow-up.

Refs
[AGT-3212](https://linear.app/getsentry/issue/AGT-3212/manual-instrumentation-docs-for-extraction-spans)

## IS YOUR CHANGE URGENT?

- [ ] Urgent deadline (GA date, etc.): YYYY-MM-DD
- [ ] Other deadline: YYYY-MM-DD
- [x] No deadline: Not urgent, can wait up to 1 week+

## PRE-MERGE CHECKLIST

- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)

<!-- junior-request-attribution:start -->
via @ArthurKnaus.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AD0BQH18P75H%3A1793724768.708079 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AD0BQH18P75H%3A1793724768.708079)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0BQH18P75H%3A1793724768.708079/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Arthur Knaus <[email protected]>
andreiborza added a commit to getsentry/sentry-docs that referenced this pull request Nov 11, 2026
## What

Adds the Decision Span (`gen_ai.decide`) and Extraction Span
(`gen_ai.extract`) to the AI Agents module page, and fixes the extract
op in the span relationship examples. `<ConventionAttributes>` can now
show a specific example from the conventions, so these spans show decide
and extract examples instead of chat ones.

## Why

SDKs need to know what to send for these spans. The message field
details will come from getsentry/sentry-conventions#728 once they land
there.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — 085754be Deployed Oct 23, 2026 by vercel[bot]
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.

3 participants