Skip to main content

Langfuse trace analysis agent with CLI and built-in web console

Project description

Langfuse Lens Agent

PyPI version Python License

Korean version: README_ko.md

Langfuse Lens Agent is an open-source analysis agent for LLM operations teams.
It turns Langfuse traces into practical outputs for observability, evaluation, and prompt improvement.


✨ Features

  • Trace analytics with filters (date, metadata, user_id, session_id, trace_id, tags)
  • Observability deep-dive (error breakdown, latency/cost trends, root-cause hints)
  • Prompt engineering mode (A/B/C rewrites + scoring + recommended variant)
  • Evaluation mode (rubric scoring, confidence labels, regression checks)
  • Multi-model comparison (openai, anthropic, google_genai, openrouter)
  • Agent orchestration powered by create_deep_agent (Deep Agents)
  • Built-in FastAPI web console (chat + ops query UI)
  • Deep Agents patterns applied:
    • skills=["/skills/"]
    • memory=["/AGENTS.md", "/memories/AGENTS.md"]
    • mode-specialized subagent delegation (overview / observability / prompt / evaluation / model-compare)
    • composite backend routing (/memories/ long-term path)
  • Filesystem interaction enabled via Deep Agent backend (ls/read_file/write_file/edit_file/glob/grep, optional execute)
  • Prompt sync with Langfuse Prompt Management:
    • if missing in Langfuse → auto-create from default
    • if exists → fetch latest label/version prompt and run
    • applies to orchestrator + subagent prompts

📦 Installation

From PyPI

pip install langfuse-lens-agent

From source

git clone https://github.com/BAEM1N/langfuse-lens-agent.git
cd langfuse-lens-agent
pip install -e .

⚙️ Required environment variables

export LANGFUSE_BASE_URL=https://<your-langfuse-host>
export LANGFUSE_PUBLIC_KEY=pk-lf-...
export LANGFUSE_SECRET_KEY=sk-lf-...

Optional model provider keys:

export OPENAI_API_KEY=...
export ANTHROPIC_API_KEY=...
export GOOGLE_API_KEY=...
export OPENROUTER_API_KEY=...
export OPENROUTER_BASE_URL=https://openrouter.ai/api/v1

You can also set keys in:

  • project .env: ./.env
  • home .env: ~/.env

CLI prints a warning when LLM keys are missing.


🚀 Usage

1) CLI mode

langfuse-lens --message "mode=overview limit=20"

or

echo "mode=prompt limit=20 user_id=demo-user" | langfuse-lens

2) Web mode

langfuse-lens-web --host 0.0.0.0 --port 8010

Open: http://localhost:8010

In Web UI, use Settings · LLM API Keys to save keys into project/home .env.


🧪 Common query modes

  • mode=overview
  • mode=observability
  • mode=prompt
  • mode=evaluation

🐳 Docker

cp .env.example .env
docker compose up -d --build
curl http://localhost:8091/health

🛠️ Development

python -m unittest discover -s tests -q

📚 Documentation

  • Setup: docs/SETUP.md
  • Feature comparison: docs/POLLY_COMPARISON.md

🤝 Contributing

Issues and pull requests are welcome:


📄 License

MIT — see LICENSE

Project details


Download files

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

Source Distribution

langfuse_lens_agent-0.2.5.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

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

langfuse_lens_agent-0.2.5-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file langfuse_lens_agent-0.2.5.tar.gz.

File metadata

  • Download URL: langfuse_lens_agent-0.2.5.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for langfuse_lens_agent-0.2.5.tar.gz
Algorithm Hash digest
SHA256 212236a4e9c9d61653ca5a2eb542c6f36737ffc3dacd885e7c3b68556d53fee0
MD5 4fdae36a7ab4ed171841f9c612b9628d
BLAKE2b-256 5b9d9e99b57e98ef3a026d0032351e3c24c1c70a67bb785b7b4d956e97b8c33a

See more details on using hashes here.

File details

Details for the file langfuse_lens_agent-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for langfuse_lens_agent-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 612ce51a81092db304498cd1dd6d7851e34ba9927f3d1f746229f1625d2a8577
MD5 a7c2106d6b47c04c30819d33b5441a99
BLAKE2b-256 2fff5d208ae189de2f26549252fb5eafebd537f34a29eb9d1110e179169b5df3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page