Skip to main content

Loupe — Open-Source Debugger for AI Agents

CI PyPI License Python pre-commit

Inspect what your agent actually did. Find out why it failed. Prove the fix works.

Loupe is a local-first, open-source debugging platform for AI agents — built for developers who ship agents in production and need to understand, replay, and verify agent behavior the way rr works for C programs or Chrome DevTools works for web apps.


Why Loupe?

AI agents fail in ways traditional software doesn't. The root cause is rarely the model — it's the system around it: bad tool inputs, unexpected state, missed edge cases, cascading errors across multi-step reasoning. Existing tools give you logs. Loupe gives you causality.

  • 88% of agent failures are caused by the system, not the model.
  • Teams spend 40% of sprint time investigating agent failures.
  • Zero open-source tools combine recording, replay, causal tracing, and CI verification in one platform.

Loupe changes that.


Quick Start

Install

pip install loupe-agent

The PyPI package is loupe-agent; the Python import package and CLI remain loupe.

Record an agent run

from loupe import record

with record("support-agent") as trace, trace.span(
    "tool.lookup", kind="tool", inputs={"query": "refund policy"}
) as span:
    span.set_outputs({"result": "30-day refund window"})

Traces are written to .loupe/traces.db automatically.

Inspect from the CLI

loupe list                              # list all recorded traces
loupe inspect <trace-id>                # inspect span tree, inputs, outputs, errors
loupe graph <trace-id>                   # render causal graph as SVG
loupe evaluate <trace-id>               # run deterministic evaluation

Or create a demo trace to explore

loupe init
loupe record-demo
loupe list

Core Features

📼 Structured Recording

Drop-in SDK captures every agent step: spans, events, inputs, outputs, errors, latency, and token counts. Zero code changes for LangChain integrations.

🔄 Deterministic Replay

Record once, replay infinitely. Stored outputs and mock patches ensure byte-identical results every time — no more "works on my machine" failures.

🔍 Causal Tracing

Automatic dependency graphs show which span influenced downstream behavior. Blame assignment ranks likely failure causes: bad input, wrong tool, bad prompt, or model hallucination.

✅ CI/CD Verification

Deterministic evaluation gates catch agent behavior regressions before they ship. Run evaluations in your existing CI pipeline.

🏗️ Local-First Storage

SQLite storage by default — your traces never leave your machine. Export summaries to Arrow/Parquet for downstream analysis.

🌐 API for Dashboards

Serve traces over FastAPI for integration with web-based trace explorers and dashboards.


Architecture

Agent Code
    │
    ▼
┌─────────────────┐     ┌──────────────────┐
│  Loupe SDK      │────▶│  .loupe/traces.db │
│  (record spans) │     │  (SQLite)          │
└─────────────────┘     └────────┬───────────┘
                                 │
                    ┌────────────┼────────────┐
                    ▼            ▼            ▼
              loupe inspect  loupe graph  loupe evaluate
              (CLI detail)   (causal DAG)  (deterministic eval)
                    │            │            │
                    └────────────┴────────────┘
                              │
                     FastAPI Server (optional)
                              │
                    SvelteKit Dashboard (optional)

Framework Support

Framework Status Integration
LangChain Scaffolded Callback handler
CrewAI Planned Event listener adapter
AutoGen / AG2 Planned Message hook interceptor
LangGraph Planned Node middleware
Raw OpenTelemetry Planned Span exporter bridge

Development Setup

# Clone and install
git clone https://github.com/itseasy21/loupe.git
cd loupe
python -m pip install -e '.[dev]'

# Run quality checks
python -m ruff check .
python -m mypy loupe
python -m pytest

# Or use pre-commit hooks (recommended)
python -m pip install pre-commit
python -m pre-commit install
python -m pre-commit run --all-files

Running the Dashboard

# Start the API server
cd loupe && uvicorn loupe.api.server:app --reload --port 8000

# In another terminal, start the frontend
cd frontend && npm install && npm run dev

Contributing

Contributions are welcome. See CONTRIBUTING.md for setup instructions, coding standards, and the PR process.


License

Loupe is open-source under the Apache 2.0 License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loupe_agent-0.2.0.tar.gz (31.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loupe_agent-0.2.0-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file loupe_agent-0.2.0.tar.gz.

File metadata

  • Download URL: loupe_agent-0.2.0.tar.gz
  • Upload date:
  • Size: 31.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for loupe_agent-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2ffc00fef4941052296cec1312e4998ec98f008175ec349987e0627fea0ee444
MD5 c070dc3bc14936843bf8bd40a3d7c82a
BLAKE2b-256 841c0c8b99e0e0b1ce5b683b8ab40041e0b21f471ff2246c6a27b2768e4fab78

See more details on using hashes here.

Provenance

The following attestation bundles were made for loupe_agent-0.2.0.tar.gz:

Publisher: changesets.yml on itseasy21/loupe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file loupe_agent-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: loupe_agent-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for loupe_agent-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f69450ba4832896dbb09826ab9198dbbe7ef193f3c0179f8fec0b31bf174ea1
MD5 a843564fa96bd60014f3a7757dae1e78
BLAKE2b-256 a37393e57fc88845ac326aebfd2217d0c46a3a25973e8bd2d16878d77a8c9cef

See more details on using hashes here.

Provenance

The following attestation bundles were made for loupe_agent-0.2.0-py3-none-any.whl:

Publisher: changesets.yml on itseasy21/loupe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page