Skip to main content
AgentMark uses OpenTelemetry to provide distributed tracing for your prompt executions. This gives you complete visibility into how your prompts perform in production.
Developers set up tracing in your application. See Development documentation for setup instructions.
Traces panel showing prompt execution timeline with spans, token usage, and response times

Understanding Traces

A trace represents the complete execution of a prompt, including all its steps, tool calls, and metadata. Each trace contains: Execution Timeline - See exactly when each step occurred and how long it took. Token Usage - Track input tokens, output tokens, and total tokens consumed. Costs - Monitor spending on a per-request basis. Tool Calls - View all tool executions, their parameters, and results. Custom Metadata - Add context like user IDs, session IDs, and custom attributes. Error Information - Detailed error messages and stack traces when issues occur.

Collected Spans

AgentMark records the following OpenTelemetry spans:
Span TypeDescriptionAttributes
ai.inferenceFull length of the inference calloperation.name, ai.operationId, ai.prompt, ai.response.text, ai.response.toolCalls, ai.response.finishReason
ai.toolCallIndividual tool executionsoperation.name, ai.operationId, ai.toolCall.name, ai.toolCall.args, ai.toolCall.result
ai.streamStreaming response dataai.response.msToFirstChunk, ai.response.msToFinish, ai.response.avgCompletionTokensPerSecond

LLM Span Attributes

Each LLM span contains attributes that vary slightly depending on the adapter you use. The table below shows common attributes across integrations:
AttributeDescription
ai.model.idModel identifier
ai.model.providerModel provider name
ai.usage.promptTokensNumber of prompt tokens
ai.usage.completionTokensNumber of completion tokens
ai.settings.maxRetriesMaximum retry attempts
ai.telemetry.functionIdFunction identifier
ai.telemetry.metadata.*Custom metadata
ai.response.textResponse text
ai.response.toolCallsTool calls array
ai.response.finishReasonFinish reason
All adapters also support custom metadata via agentmark.metadata.* attributes.

Grouping Traces

Organize related traces together using custom grouping. This is useful for understanding complex workflows that span multiple prompt executions. Grouped Traces You can create hierarchical trace groups to represent:
  • Multi-step agent workflows
  • Nested component execution
  • Parallel processing pipelines

Graph View

For complex AI agent workflows, AgentMark provides an interactive graph visualization that shows the relationships between different components, execution flow, and dependencies. Learn more about Graph View →

Viewing Traces

Access traces in the AgentMark dashboard under the “Traces” tab. Each trace shows:
  • Complete prompt execution timeline
  • Tool calls and their durations
  • Token usage and costs
  • Custom metadata and attributes
  • Error information (if any)
  • Graph visualization (when graph metadata is present)
  • Manual annotations for quality assessment
Find specific traces using:
  • Function ID - Filter by specific prompt or function
  • Session ID - View all traces in a session
  • User ID - See all activity for a specific user
  • Time Range - Narrow results to specific periods
  • Status - Filter by success, error, or specific finish reasons
  • Model - View traces for specific LLM models

Integration

AgentMark works with any application that uses OpenTelemetry. For detailed setup instructions, see the Development Observability documentation.

MCP Trace Server

For debugging traces directly from your IDE, AgentMark provides an MCP server that exposes list_traces and get_trace tools. This lets you query and inspect traces without leaving your development environment.

Best Practices

Use Meaningful IDs - Choose descriptive function IDs for easy filtering and debugging. Add Context - Include relevant metadata like user IDs, session IDs, and business context. Monitor Regularly - Check traces frequently to catch issues early. Set Up Alerts - Configure alerts for cost, latency, or error thresholds. Analyze Patterns - Use the dashboard’s filtering to identify trends and patterns.

Next Steps

Have Questions?

We’re here to help! Choose the best way to reach us: