Skip to main content

From your app to the store

An agent app sends traces with OpenTelemetry (HTTP port 4318 or gRPC port 4317) to magpie-server, the one writer, which stores them in one folder. The web viewer, the query API and MCP for AI agents read them.An agent app sends traces with OpenTelemetry (HTTP port 4318 or gRPC port 4317) to magpie-server, the one writer, which stores them in one folder. The web viewer, the query API and MCP for AI agents read them.
With the server, a trace goes this way:
  1. Your app or its framework makes spans with an OpenTelemetry SDK.
  2. The app sends the spans over OTLP: HTTP on port 4318, gRPC on port 4317.
  3. magpie-server maps each span to a Magpie span. With a mask policy (--mask, off by default), it replaces private data before it stores anything.
  4. The server writes the spans to the store: one folder of files.
  5. You ask questions in JSON over the query API, on port 4318. The read-only web viewer at / uses the same API.
With the library (magpiedb in Rust, Node.js or Python), there is no network part. Your app opens the store folder itself, then writes and queries it. Both ways use the same engine and write the same kind of store.
One writer per store. Only one process may write to a store folder at a time. A second writer is refused; read-only opens are fine. For many apps, send traces to one magpie-server.
New data is searchable after the next commit. The store commits 0.5 s after the first write that waits.

The parts of the data

A trace is one agent run. Each row is a span: the agent run, two model calls and a failed tool call. Magpie can ask about the whole run, search the text of prompts and replies, and add up tokens and cost per model, user or time range.A trace is one agent run. Each row is a span: the agent run, two model calls and a failed tool call. Magpie can ask about the whole run, search the text of prompts and replies, and add up tokens and cost per model, user or time range.
A span with the same trace id and span id replaces the one before. So a retry makes no copy, and you can write a span again when it ends.

Span kinds

kind tells what a step did. From OpenTelemetry, Magpie takes it from gen_ai.operation.name. With the library, you set it yourself.

What you can search and sum

Tokens and cost come from model calls and embeddings only. An agent span reports the sum of the model calls under it, so Magpie does not count those tokens twice. Attribute values have no text search: an attribute filter matches a whole value.

Quick start

Start the server, send a trace and ask questions.

Queries

Every query type, with examples.

Send traces with OpenTelemetry

The setup for your framework, and how Magpie maps a span.