Skip to main content

Spans Overview

In AgentOps v0.4, the concept of “Events” has been replaced with “Spans” for all operation tracking. Spans represent different types of operations and are organized hierarchically. A span is a unit of work or operation in your agent workflow. Spans are created using decorators and are automatically nested to create a hierarchical trace of your agent’s execution.

Span Types

AgentOps supports several types of spans, each representing a different kind of operation:

Session Spans

Session spans serve as the root for all other spans. They represent a complete execution of your agent workflow.

Agent Spans

Agent spans represent operations performed by a specific agent. They are typically children of session spans.

Operation/Task Spans

Operation spans represent specific tasks or operations performed by an agent. They are typically children of agent spans.

Workflow Spans

Workflow spans represent a sequence of operations that form a workflow. They can contain multiple operations.

LLM Spans

LLM spans are automatically created when you make calls to supported LLM providers. They represent interactions with language models.

Span Attributes

All spans share a set of common attributes: Additionally, spans automatically capture:
  • Input parameters to the decorated function
  • Return values from the decorated function
  • Exceptions that occur during execution

Span Hierarchy

Spans are organized hierarchically to create a trace of your agent’s execution. The typical hierarchy is:
  1. Session (root)
  2. Agent
  3. Operation/Task
  4. Nested Operations
This hierarchy allows you to visualize the flow of your agent’s execution and understand how different operations relate to each other.

Error Handling

When an exception occurs within a decorated function, it’s automatically recorded in the span. This allows you to easily identify and debug errors in your agent workflow.