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.

Metadata

Release files for loupe-agent 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for loupe-agent 0.2.0
File Size Uploaded Provenance
loupe_agent-0.2.0.tar.gz 31.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for loupe-agent 0.2.0
File Interpreter ABI Platform
loupe_agent-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 55.1 kB

Release files / loupe_agent-0.2.0.tar.gz

Download URL loupe_agent-0.2.0.tar.gz
Size 31.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2ffc00fef4941052296cec1312e4998ec98f008175ec349987e0627fea0ee444
BLAKE2b-256 checksum
How to use checksums
841c0c8b99e0e0b1ce5b683b8ab40041e0b21f471ff2246c6a27b2768e4fab78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / loupe_agent-0.2.0-py3-none-any.whl

Download URL loupe_agent-0.2.0-py3-none-any.whl
Size 23.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f69450ba4832896dbb09826ab9198dbbe7ef193f3c0179f8fec0b31bf174ea1
BLAKE2b-256 checksum
How to use checksums
a37393e57fc88845ac326aebfd2217d0c46a3a25973e8bd2d16878d77a8c9cef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Security for loupe-agent 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for loupe_agent-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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