Subscribe to the Non-Human & AI Identity Journal

Span

A span is one discrete operation inside a trace, such as a retrieval query, prompt assembly step, or model call. Spans make it possible to pinpoint which part of an AI workflow consumed time, introduced error, or passed bad context to the next stage.

Expanded Definition

In AI and software observability, a span is the smallest meaningful unit of work recorded inside a trace. It marks one operation, such as a retrieval query, prompt formatting step, token generation request, tool invocation, or a downstream API call. The term is used to show not only that a workflow executed, but how each stage behaved, how long it took, and whether it passed the right context to the next step.

Definitions vary across vendors on how much metadata a span should carry, but the core idea is consistent: a span represents a bounded action with a start, an end, and attributes that help explain the action. In practice, spans become most valuable when they are correlated into a full trace, because a single span rarely tells the whole story. This is especially relevant for AI systems where failures may originate in prompt assembly, retrieval quality, model selection, or tool output rather than in the model call itself. The NIST Cybersecurity Framework 2.0 is useful context here because it reinforces the need for visibility, monitoring, and disciplined incident investigation across digital services.

The most common misapplication is treating a span as a general log entry, which occurs when teams record event messages without preserving timing, parent-child relationships, or enough context to reconstruct the workflow.

Examples and Use Cases

Implementing span-level observability rigorously often introduces overhead in instrumentation and data handling, requiring organisations to weigh debugging depth against added telemetry volume and performance cost.

  • A retrieval span records the query, index used, latency, and number of documents returned, helping teams judge whether poor answers came from weak retrieval rather than the model.
  • A prompt assembly span captures template version, system instructions, and inserted context, which is critical when malformed inputs cause inconsistent AI outputs.
  • A model-call span measures request and response timing, token counts, and error codes, making it easier to distinguish model slowness from upstream pipeline delays.
  • A tool-invocation span shows when an agent executed an external action, such as sending a ticket or querying a database, which is important for reviewing execution authority and side effects.
  • A security review span inside an identity or access workflow can show where secrets were read, transformed, or passed onward, supporting investigations into exposure paths and unsafe automation.

For teams building observability standards, guidance from NIST Cybersecurity Framework 2.0 helps anchor span data to broader detection and response practices.

Why It Matters for Security Teams

Spans matter because they turn opaque AI and distributed workflows into auditable sequences of actions. Without them, security teams often cannot tell whether a failure was caused by bad retrieval data, unsafe prompt construction, a compromised tool, or a model response that propagated incorrect context. That distinction is essential for incident triage, root-cause analysis, and control validation. For agentic AI, spans are especially important because tool use creates a record of what the agent tried to do, when it did it, and which downstream systems were touched. That makes spans useful for governance as well as debugging.

Spans also support identity and NHI visibility when service identities, API keys, or delegated credentials are involved. They help show which non-human actor initiated an operation and whether the action stayed within expected authority. In practice, span data becomes a security artifact when teams need to prove or disprove misuse of access, prompt injection effects, or unsafe automation paths. Organisational problems often become visible only after an investigation into a bad answer, a leaked secret, or an unintended tool action, at which point span-level telemetry becomes operationally unavoidable to explain what happened.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Agentic AI Top 10 and OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST CSF 2.0, NIST AI RMF and NIST SP 800-63 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
NIST CSF 2.0 DE.CM-01 Span telemetry supports continuous monitoring and event visibility across AI workflows.
NIST AI RMF AI RMF governance and mapping functions need trace evidence to assess AI system behaviour.
OWASP Agentic AI Top 10 Agentic AI guidance relies on tracing tool use and execution paths to spot unsafe actions.
OWASP Non-Human Identity Top 10 NHI governance depends on tracing service identity actions and secret handling across workflows.
NIST SP 800-63 Identity assurance concepts inform how span records can evidence authenticated actions.

Instrument spans so monitoring can detect abnormal workflow behaviour and speed investigation.