TngSHoO/agentcase-lab

AI Agent failure replay and root cause analysis platform

AgentCase Lab — What It Is

AgentCase Lab is a platform for teams that build AI products and applications. Its purpose is to help them review failures and find root causes when AI agents misbehave.

What It Does

When an AI agent runs, the platform records the entire execution as a replayable trace. Teams can then step through what happened and pinpoint problems in:

  • Prompts — the instructions given to the model
  • Knowledge retrieval — how the agent fetched information
  • Tool calls — actions the agent took
  • Context — what the agent had in view
  • Long-term memory — what the agent remembered across sessions
  • Permissions — access restrictions
  • Model hallucinations — fabricated or incorrect outputs

The platform also lets teams compare before and after a fix, checking changes in success rate, latency, token usage, and cost.

Core Features

  • Data dashboard — shows success rate, fix rate, root cause distribution, latency, and cost
  • Failure cases — filter incidents by scenario, status, and root cause
  • Trace replay — inspect user input, the agent's plan, tools used, memory, model output, and final result
  • Root cause analysis — uses rule-based patterns by default, with an optional AI-powered analysis via an OpenAI-compatible model
  • Version comparison — verify whether a fix actually improved task status and key metrics

Current Status

This repository is a portfolio MVP (minimum viable product). The built-in cases are explicitly labeled simulated data — they do not represent any real model's public ranking or production performance.

How to Run It

Requires Python 3.11 or higher. On Windows PowerShell:

python -m venv .venv
.\venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
streamlit run app.py

Then open http://localhost:8501. On first launch, the app automatically creates a SQLite database and populates it with 30 demo cases.

Optional: Live AI Root Cause Analysis

To enable AI-powered analysis, copy .env.example to .env and fill in an OpenAI-compatible service's configuration:

AGENTCASE_API_KEY=your-key
AGENTCASE_API_BASE=https://api.deepseek.com/v1
AGENTCASE_MODEL=deepseek-chat

The README warns: never commit .env or real API keys to GitHub.

Testing

python -m pip install -r requirements-dev.txt
pytest
ruff check .

Project Structure

agentcase-lab/
├── app.py                 # Product home page
├── pages/                 # Five core pages
├── agentcase/             # Data models, SQLite, metrics, and analysis logic
├── data/                  # Local database generated at runtime
├── docs/                  # PRD, user journey, metrics, and decision records
└── tests/                 # Automated tests

Documentation

The repo includes four product documents:

  • PRD — product requirements
  • User journey — how users interact with the product
  • Metrics — the measurement framework
  • Product decisions — design choices and rationale

Development Note

The README states this is a personal portfolio project built from scratch, with AI coding tools used as assistance during development. The maintainer takes responsibility for product definition, scope decisions, metric design, acceptance, and final content.

License

Released under the MIT License — you may use, modify, distribute, or commercially use the project, provided you retain the original author and license notice.


In short: AgentCase Lab is a debugging and analytics tool for AI agent teams — it records what an agent did, helps you find why it failed, and lets you verify that your fixes actually worked.

Related

  • Project
  • Project
  • Project
  • Project