Files
agentlens/examples/README.md

49 lines
1.3 KiB
Markdown

# AgentLens Examples
Example scripts demonstrating the AgentLens SDK for tracing and observing AI agent behavior.
## Setup
```bash
pip install vectry-agentlens
```
## Examples
| Script | Description |
|--------|-------------|
| `basic_agent.py` | Simplest usage — init, trace, log decisions, shutdown |
| `openai_agent.py` | OpenAI integration — wrap the client for automatic LLM call tracing |
| `multi_agent.py` | Nested traces — planner delegates to researcher, writer, and editor sub-agents |
| `customer_support_agent.py` | Realistic support workflow — classification, routing, escalation, error handling |
| `seed_demo_traces.py` | Seeds the live dashboard with 11 realistic traces via direct HTTP POST (no SDK) |
## Running
Each SDK example follows the same pattern:
```bash
# Set your API key and endpoint
export AGENTLENS_API_KEY="your-key"
# Run any example
python examples/basic_agent.py
```
For the OpenAI example, you also need:
```bash
pip install openai
export OPENAI_API_KEY="sk-..."
```
### Seed Script
The seed script sends pre-built traces directly to the API — no SDK or OpenAI key needed:
```bash
python examples/seed_demo_traces.py
```
This populates the dashboard with varied traces (COMPLETED, ERROR, RUNNING) across multiple agent types.