Core Concepts
Traces
A trace represents a complete request or workflow in your application. Each trace is identified by a unique trace ID and contains one or more spans. Traces carry top-level attributes such as metadata, tags, user ID, and session ID.Spans
Spans are individual operations within a trace, forming a tree structure. AgentMark records three span types:ai.inference— the full lifecycle of an LLM call, including model, tokens, cost, and responseai.toolCall— a single tool execution, including name, arguments, and resultai.stream— streaming response metrics such as time to first token and tokens per second
Span Kinds
Every span has a semantic kind that categorizes the operation. Span kinds determine how spans appear in the graph view, how they can be filtered, and how analytics are grouped on dashboards.| Kind | Description |
|---|---|
| function | Generic computation step (default) |
| llm | A call to a language model |
| tool | An external tool or API call |
| agent | An orchestration loop that decides what to do next |
| retrieval | A vector database query or document search |
| embedding | A call to an embedding model |
| guardrail | A content safety or validation check |
observe() or ctx.span().
Sessions
Sessions group related traces together by session ID. Track multi-turn conversations, agent workflows, and batch processing runs. Each session aggregates cost, tokens, and latency across its traces. Learn more about Sessions →Scores
Numeric evaluations attached to spans or traces. Set scores programmatically via the SDK usingsdk.score(), or manually through annotations in the Dashboard.
Metadata & Tags
Metadata — Custom key-value pairs attached to traces for context (environment, feature flags, customer tier). Automatically discovered as filter fields. Tags — String labels for categorization (environment, team, feature, release). Metadata → · Tags →What Gets Tracked
Inference Spans — Full prompt execution lifecycle: token usage, costs, response times, model information, completion status. Tool Calls — Tool name, parameters, execution duration, success/failure status, return values. Streaming Metrics — Time to first token, tokens per second, total streaming duration. Sessions — Group related traces by user interaction, multi-step workflow, or batch run. Alerts — Monitor cost thresholds, latency spikes, error rates, and evaluation scores.Quick Start
Enable telemetry when formatting your prompts:AgentMarkSDK, child spans, observe(), and span kinds, see Tracing Setup.
How Data Flows
Your application sends telemetry via the AgentMark SDK, which exports OpenTelemetry spans to the AgentMark gateway. The gateway processes and stores the data, powering the traces, metrics, and analytics views.- Cloud
- Local
Spans are exported to the AgentMark cloud gateway and stored in ClickHouse. View traces, dashboards, alerts, and analytics in the Dashboard.
Programmatic access
You can query traces, spans, sessions, scores, metrics, datasets, experiments, prompts, and runs programmatically using the REST API or theagentmark api CLI command. Use this to build custom integrations, pull data into external tools, or automate monitoring workflows.
The local dev server and cloud gateway support the same API endpoints, so you can develop and test integrations locally before deploying. Use the capabilities endpoint to check which features a server supports.
Next Steps
Tracing Setup
Instrument your app with the SDK
Traces and Logs
View execution timelines in the Dashboard
Sessions
Group related traces together
Alerts
Get notified of critical issues
Dashboards
Analyze usage, performance, and scores
API Reference
Query traces, scores, and metrics via REST API
Have Questions?
We’re here to help! Choose the best way to reach us:
- Email us at hello@agentmark.co for support
- Schedule an Enterprise Demo to learn about our business solutions