Skip to main content
mirrorkit is a lightweight, drop-in production trace collector for LLM agents. Add two lines to your existing LangChain / LangGraph / Anthropic / OpenAI script and your agent’s traces start streaming to Mirrors: non-blocking, background-batched, with negligible latency.

How do I install the Python collector?

Run pip install mirrorkit. There are no required runtime dependencies: the sender uses only the Python stdlib, so it adds nothing to your dependency tree.
LangChain / Anthropic / OpenAI are instrumented only if they’re importable.

How do I start collecting traces from a Python agent?

Import mirrorkit and call init() with your workspace key and a project name before your agent runs. That is the whole integration: two lines, no decorators, no changes to how you call your model.
Run your agent normally: traces are captured and shipped in the background. The endpoint defaults to the MIRROR_ENDPOINT environment variable, then to the production URL.

Options

How do I log a trace manually?

Call mirrorkit.log_trace() with a list of OpenAI-style chat dicts. This is the path for frameworks that aren’t auto-instrumented:

Do I need to pass LangChain callbacks myself?

Normally no. init() registers a global LangChain callback handler automatically, so you don’t need to pass callbacks. If your setup doesn’t honor the global hook, pass the handler explicitly:

API

Failures (non-2xx / network errors) are retried a couple of times, then dropped. The collector never raises into your program. The wire format is documented in the collect API reference.
The same package also ships the mirrors CLI. Install it with pip install "mirrorkit[cli]".