Research & Papers

Spanlens: Open-source tool replaces print() debugging for LLM agents with one-line setup

Debug AI agents by just swapping the baseURL – no heavy SDKs needed.

Deep Dive

Debugging LLM agents is notoriously painful: infinite loops, hallucinations on the third step, or silent API credit burn. Developers typically resort to littering code with print() statements or adopting heavy observability SDKs like Langfuse, which come with vendor lock-in and setup overhead. Spanlens solves this with a radically simple approach – just replace the baseURL in your existing OpenAI/Anthropic/Gemini client. No code refactoring, no heavy libraries.

Once pointed to the Spanlens proxy, you instantly get parent-child agent tracing to pinpoint where a multi-step workflow crashed or bottlenecked. The unified dashboard shows all provider calls (OpenAI, Anthropic, Gemini) in one view, tracks cost per user or feature, and automatically masks sensitive data like API keys. The entire project is open source under MIT, self-hostable with a single Docker command, and aims to give developers full control without vendor lock-in. Spanlens is currently seeking feedback from the community on GitHub.

Key Points
  • Replace baseURL in existing LLM clients to activate tracing – no code changes beyond one line.
  • Provides parent-child agent visualization and cross-provider dashboard for OpenAI, Anthropic, and Gemini.
  • Lightweight, MIT-licensed, self-hostable via Docker with automatic PII masking and cost tracking.

Why It Matters

Saves developers hours of debugging and eliminates vendor lock-in with a simple, open-source tracing layer for agents.