> ## Documentation Index
> Fetch the complete documentation index at: https://docs.magpiedb.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Magpie is a trace store for AI agents, used as a library (crate `magpiedb`, npm `magpiedb`, PyPI `magpiedb`) or as `magpie-server`, which takes OpenTelemetry (OTLP over HTTP on 127.0.0.1:4318 and gRPC on 127.0.0.1:4317 by default).
> Use only the commands, flags, routes and JSON shapes that these pages show. Do not guess a flag or a query field: if a page does not show it, say that the docs do not show it.
> Packages and server binaries are not published yet: build from source, as the quick start shows. Check the status note on the introduction page before you suggest `cargo add`, `npm install` or `pip install`.
> Only one process may write to a store folder at a time. For many apps, send traces to one `magpie-server`.

# The same queries in the library

> The Node and Python calls that take the same JSON as the server routes.

The Node and Python packages take the same JSON as the server.

| server | Node | Python |
| - | - | - |
| `POST /v1/search` | `store.search(q)` (rows), `store.searchPage(q)` (with `nextCursor`) | `store.search(q)`, `store.search_page(q)` |
| `POST /v1/count` | `store.count(filter)` | `store.count(filter)` |
| `POST /v1/traces/find` | `store.findTraces(q)` | `store.find_traces(q)` |
| `POST /v1/aggregate` | `store.aggregate(q)` (the rows) | `store.aggregate(q)` |
| `GET /v1/traces/:id` | `store.getTrace(id)` (the spans) | `store.get_trace(id)` |
| `GET /v1/traces/:id/spans` | `store.traceSpans({traceId, limit, cursor})` | `store.trace_spans({...})` |
| `GET /v1/traces/:id/spans/:spanId` | `store.getSpan({traceId, spanId})` | `store.get_span({...})` |
| `POST /v1/sessions/find`, `GET /v1/sessions/:id` | `store.findSessions(q)`, `store.getSession(id)` | `store.find_sessions(q)`, `store.get_session(id)` |
| `POST /v1/scores` | `store.writeScores(scores)` | `store.write_scores(scores)` |
| `GET /v1/traces/:id/scores` | `store.getScores(id)` | `store.get_scores(id)` |
| `POST /v1/scores/aggregate` | `store.aggregateScores(q)` | `store.aggregate_scores(q)` |
| `POST /v1/export` | `store.export({filter})` | `store.export({"filter": ...})` |

In Python, `true` is `True` and `null` is `None`. In Rust, the same queries are typed structs (`Filter`, `TraceQuery`, `AggregateQuery`, ...) with the same field names in snake\_case; their JSON shape is the one in these pages. The full API of each package: [Node](https://docs.magpiedb.com/libraries/node.md) and [Python](https://docs.magpiedb.com/libraries/python.md) (Rust: [/libraries/rust](https://docs.magpiedb.com/libraries/rust.md)).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.