5-Minute Quickstart

From zero to agent observability in 5 minutes flat.

📋 Prerequisites

Python 3.9+ and Node.js 18+ installed.

Step 1: Clone & Start Backend (1 min)

git clone https://github.com/sauravbhattacharya001/agentlens.git
cd agentlens/backend
npm install
node seed.js    # demo data
node server.js  # starts on :3000

Open http://localhost:3000 — you should see the dashboard with demo sessions.

Step 2: Install SDK (30 sec)

In a new terminal:

cd agentlens/sdk
pip install -e .

Step 3: Run the Demo (30 sec)

cd examples
python mock_agent.py

You'll see output like:

🔍 AgentLens Demo — Mock Agent Example
==================================================

📊 Starting research agent session...
   Session ID: a1b2c3d4e5f6g7h8
   Result: Research complete for: What is the weather in SF?

💡 Explanation:
## Session Explanation: research-agent-v2
...

Refresh the dashboard — your new sessions appear with full event traces.

Step 4: Instrument Your Own Agent (3 min)

Create a file called my_agent.py:

import agentlens
from agentlens import track_agent, track_tool_call

# 1. Connect
agentlens.init(endpoint="http://localhost:3000")

# 2. Decorate your tools
@track_tool_call(tool_name="calculator")
def calculate(expression: str) -> str:
    return str(eval(expression))

# 3. Decorate your agent
@track_agent(model="gpt-4")
def math_agent(question: str) -> str:
    # Your real LLM call goes here
    agentlens.track(
        event_type="llm_call",
        model="gpt-4",
        input_data={"prompt": question},
        output_data={"response": "Let me calculate that."},
        tokens_in=20,
        tokens_out=10,
        reasoning="User asked a math question",
    )
    result = calculate("42 * 1.15")
    return f"The answer is {result}"

# 4. Run with session tracking
session = agentlens.start_session(agent_name="math-agent")
answer = math_agent("What is 42 times 1.15?")
print(answer)
print(agentlens.explain())
agentlens.end_session()
python my_agent.py

Check the dashboard — your math agent session is there with the full trace.

What's Next?

🎨 Decorators

Learn all the decorator options. Read →

📖 Full SDK

Every function and parameter. Read →

🔌 REST API

Build custom integrations. Read →

🚀 Deploy

Run in production. Read →