Skip to content

Conversation

@nagkumar91
Copy link

@nagkumar91 nagkumar91 commented Dec 22, 2025

Motivation

GenAI semantic conventions cover model, agent, and tool operations, but they don’t provide a vendor-neutral way to observe security guardian/
guardrail evaluations (allow/deny/modify decisions) and the specific security findings produced during those evaluations. This limits
auditability, incident investigation, and cross-provider correlation for systems using guardrails across different vendors and frameworks.

What this PR adds

  • Adds apply_guardrail to the gen_ai.operation.name enum for guardrail/guardian evaluations.
  • Adds new attributes under gen_ai.guardian.* and gen_ai.security.* to describe:
    • Guardian identity (gen_ai.guardian.*)
    • Decision outcomes (gen_ai.security.decision.*)
    • Target being evaluated (gen_ai.security.target.*)
    • Findings and policy context (gen_ai.security.risk.*, gen_ai.security.policy.*)
    • Opt-in content capture (gen_ai.security.content.*)
  • Note: gen_ai.security.risk.category is a free-form string with suggested values aligned with OWASP LLM Top 10 2025.
  • Adds a new span: span.gen_ai.apply_guardrail.internal (guardian evaluation).
  • Adds a new event: gen_ai.security.finding (individual findings under a guardian evaluation).
  • Adds documentation: docs/gen-ai/gen-ai-security.md (linked from docs/gen-ai/README.md).

References

Prototypes / instrumentation links

Tests

  • make table-generation registry-generation
  • make markdown-toc
  • make SED=sed check-policies (macOS note: the repo defaults to gsed)

Changelog

This is user-facing (new conventions). Add a .chloggen/*.yaml entry with component: gen-ai, or apply the “Skip Changelog” label if
maintainers agree it’s not required for this proposal stage.

@github-actions github-actions bot added enhancement New feature or request area:gen-ai labels Dec 23, 2025
@adityamehra
Copy link

@nagkumar91 We have a similar use-case and when a security incident happens for a chat span we create a new span as a chat span and add an attributed called gen_ai.security.event_id. The value for this attribute can either be in the response body of the inspection call, which is separate from the actual LLM call, or can be in the response header when inspection happens along with the LLM call. Is it possible to add support for this attribute in here? Thanks!

Here's the sample of how we add it as of now - https://github.com/signalfx/splunk-otel-python-contrib/tree/main/instrumentation-genai/opentelemetry-instrumentation-aidefense#trace-integration

@adityamehra
Copy link

Also, it will be great if we can have another entry in the otel-genai-util for this new span type like we have for chat span - https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py#L96. Or probably this new type can extend the LLMInvocation type

`span.gen_ai.inference.client` or `span.gen_ai.execute_tool.internal`).
Multiple guardian spans MAY exist under a single operation span if multiple guardians are chained.
attributes:
Copy link

@adityamehra adityamehra Jan 8, 2026

Choose a reason for hiding this comment

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

Can we add an attribute called gen_ai.security.event_id?

Copy link
Author

Choose a reason for hiding this comment

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

The event being proposed would be a gen_ai.security.finding

Apply guardrail span will have these for IDs:

  • gen_ai.guardian.id
  • gen_ai.security.target.id
  • gen_ai.security.policy.id

Would any of those fit your need?

Choose a reason for hiding this comment

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

Would this be better as an event (security finding event as proposed in this span)? Wondering why its a chat span?

Currently, the domain team is using event_id and it's as per their requirement. Also, in our case the event is generated elsewhere and not instrumentation side. We used chat span to use existing types in the genai-utils for now and manage span life cycle using it.

@nagkumar91
Copy link
Author

@nagkumar91 We have a similar use-case and when a security incident happens for a chat span we create a new span as a chat span and add an attributed called gen_ai.security.event_id. The value for this attribute can either be in the response body of the inspection call, which is separate from the actual LLM call, or can be in the response header when inspection happens along with the LLM call. Is it possible to add support for this attribute in here? Thanks!

Here's the sample of how we add it as of now - https://github.com/signalfx/splunk-otel-python-contrib/tree/main/instrumentation-genai/opentelemetry-instrumentation-aidefense#trace-integration

Would this be better as an event (security finding event as proposed in this span)? Wondering why its a chat span?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gen-ai enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants