Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Agent Debugging Replay Tool

A full stack observability tool for AI agents. Record every LLM call, tool call, and error your agent makes β€” then replay, inspect, and debug it visually on a live dashboard.

Built with FastAPI Β· Streamlit Β· Groq Β· SQLite Β· bcrypt

🌐 Live Demo: ["https://agent-debugging-replay-tool.streamlit.app/"]


🎯 The Problem This Solves

When an AI agent breaks, your terminal shows one line:

Error: Tool not found

That tells you nothing. You don't know:

  • Which step caused it
  • What prompt the LLM received at that point
  • How much money was wasted before it failed
  • Whether this is the same bug from last week

Agent Debugging Replay Tool fixes this. It records every single step your agent takes and lets you inspect it like a flight recorder.


✨ Features

  • πŸ” Auth system β€” signup, login, unique API key per user
  • πŸ•΅οΈ Step recorder β€” captures every LLM call, tool call, and error
  • πŸ“‹ Step timeline β€” expand any step to see full input/output
  • πŸ—ΊοΈ Flow graph β€” visual diagram of your agent's path
  • πŸ“Š Cost analysis β€” token usage chart + efficiency tips
  • πŸ‘₯ Multi-user β€” every user sees only their own agent runs
  • ☁️ Fully hosted β€” server on Railway, dashboard on Streamlit Cloud

πŸš€ Quick Start (Local)

1. Clone the repo

git clone https://github.com/cookieshop02/Agent-Debugging-Replay-Tool.git
cd Agent-Debugging-Replay-Tool

2. Install dependencies

pip install -r requirements.txt

3. Create your .env file

# create a .env file in the project root
GROQ_API_KEY=your_groq_key_here
TRACKER_API_KEY=your api key provided to you after you create account on platform (you can directly add into your code or write it here)

Get a free Groq API key at console.groq.com

4. Start the server (Terminal 1)

uvicorn server:app --reload --port 8000

5. Start the dashboard (Terminal 2)

streamlit run app.py

6. Open browser

Go to http://localhost:8501 β†’ Create an account β†’ You're in.


🧩 Add the Tracer to Your Own Agent

Install

pip install requests python-dotenv

Use it

from tracer.recorder import AgentTracer

# 1. create tracer with your API key (from dashboard after signup)
tracer = AgentTracer(api_key="at_sk_your_key_here", name="My Agent Run")
tracer.start()

# 2. record every LLM call
tracer.record_llm(
    prompt="What should I do first?",
    response="I should search the web.",
    tokens=85
)

# 3. record every tool call
tracer.record_tool(
    tool_name="web_search",
    input_data="latest AI news",
    output_data="Results: ...",
    duration_ms=320
)

# 4. record errors
try:
    result = some_tool()
except Exception as e:
    tracer.record_error("Calling some_tool", e)

# 5. finish
tracer.finish(status="success")  # or "error"

Then open the dashboard β€” your run appears instantly in the sidebar.


πŸ“ Project Structure

Agent-Debugging-Replay-Tool/
β”‚
β”œβ”€β”€ server.py               ← FastAPI backend (deployed on Railway)
β”œβ”€β”€ server_db.py            ← Server database logic (SQLite)
β”œβ”€β”€ auth.py                 ← Password hashing (bcrypt)
β”‚
β”œβ”€β”€ app.py                  ← Streamlit dashboard
β”œβ”€β”€ pages/
β”‚   └── 1_login.py          ← Login / signup page
β”‚
β”œβ”€β”€ groq_agent.py           ← Example real agent using Groq
β”‚
β”œβ”€β”€ tracer/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ recorder.py         ← AgentTracer class (the spy)
β”‚   └── queries.py          ← Fetches data from server
β”‚
β”œβ”€β”€ .env.example            ← Environment variable template
β”œβ”€β”€ .gitignore              ← Keeps secrets out of GitHub
└── requirements.txt

πŸ”Œ API Endpoints

See at:

Full interactive docs at: https://your-railway-url.up.railway.app/docs


☁️ Deployment

Service Platform URL
FastAPI Server Railway https://agent-debugging-replay-tool-production.up.railway.app/
Streamlit Dashboard Streamlit Cloud https://agent-debugging-replay-tool.streamlit.app/

Deploy your own

Server (Railway):

  1. Push to GitHub
  2. Connect repo on railway.app
  3. Add GROQ_API_KEY environment variable
  4. Set start command: uvicorn server:app --host 0.0.0.0 --port $PORT

Dashboard (Streamlit Cloud):

  1. Go to share.streamlit.io
  2. Connect GitHub repo
  3. Set main file: app.py
  4. Deploy

πŸ’‘ Why This Is Better Than Just Reading Terminal Logs

Terminal Logs This Tool
See full prompt history ❌ βœ…
Compare runs ❌ βœ…
Cost per step ❌ βœ…
Visual flow diagram ❌ βœ…
Shareable with teammates ❌ βœ…
Persistent history ❌ βœ…
Works across multiple agents ❌ βœ…

πŸ› οΈ Tech Stack

  • Backend: Python, FastAPI, SQLite
  • Frontend: Streamlit, Graphviz
  • Auth: bcrypt password hashing
  • LLM: Groq (llama3-8b-8192)
  • Hosting: Railway (API) + Streamlit Cloud (UI)

πŸ“„ License

MIT License β€” free to use, modify, and distribute.


Made with πŸ” to make AI agent debugging less painful.

About

πŸ” Record, replay, and debug AI agent runs β€” visualize every LLM call, tool call, and error with cost analysis. Built with FastAPI + Streamlit.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages