138 lines
2.7 KiB
Markdown
138 lines
2.7 KiB
Markdown
|
|
# Agent SDK Quick Reference Card
|
||
|
|
|
||
|
|
## 🚀 Quick Start
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Install dependencies
|
||
|
|
pip install -r requirements.txt
|
||
|
|
|
||
|
|
# Run bot (Agent SDK is default)
|
||
|
|
python bot_runner.py
|
||
|
|
```
|
||
|
|
|
||
|
|
## 📋 Mode Selection
|
||
|
|
|
||
|
|
### Agent SDK (Default)
|
||
|
|
```env
|
||
|
|
# No config needed - this is the default!
|
||
|
|
# Or explicitly:
|
||
|
|
USE_AGENT_SDK=true
|
||
|
|
```
|
||
|
|
✅ Uses Claude Pro subscription (no API costs)
|
||
|
|
|
||
|
|
### Direct API
|
||
|
|
```env
|
||
|
|
USE_DIRECT_API=true
|
||
|
|
ANTHROPIC_API_KEY=sk-ant-...
|
||
|
|
```
|
||
|
|
✅ Pay-per-token, usage tracking enabled
|
||
|
|
|
||
|
|
### Legacy Server
|
||
|
|
```env
|
||
|
|
USE_CLAUDE_CODE_SERVER=true
|
||
|
|
CLAUDE_CODE_SERVER_URL=http://localhost:8000
|
||
|
|
```
|
||
|
|
⚠️ Deprecated, not recommended
|
||
|
|
|
||
|
|
## 🔍 Verify Mode
|
||
|
|
|
||
|
|
Check startup message:
|
||
|
|
```
|
||
|
|
[LLM] Using Claude Agent SDK (Pro subscription) ← Agent SDK ✅
|
||
|
|
[LLM] Using Direct API (pay-per-token) ← Direct API 💳
|
||
|
|
[LLM] Using Claude Code server at ... ← Legacy ⚠️
|
||
|
|
```
|
||
|
|
|
||
|
|
## 🧪 Test Installation
|
||
|
|
|
||
|
|
```bash
|
||
|
|
python test_agent_sdk.py
|
||
|
|
```
|
||
|
|
|
||
|
|
Expected: **5/5 tests passed** 🎉
|
||
|
|
|
||
|
|
## 🛠️ Troubleshooting
|
||
|
|
|
||
|
|
### Issue: Fallback to Direct API
|
||
|
|
```bash
|
||
|
|
pip install claude-agent-sdk anyio
|
||
|
|
```
|
||
|
|
|
||
|
|
### Issue: ModuleNotFoundError
|
||
|
|
```bash
|
||
|
|
pip install -r requirements.txt
|
||
|
|
```
|
||
|
|
|
||
|
|
### Issue: Still using old mode
|
||
|
|
```bash
|
||
|
|
# Edit .env and remove conflicting variables
|
||
|
|
USE_DIRECT_API=false # or remove line
|
||
|
|
```
|
||
|
|
|
||
|
|
## 📊 Priority Order
|
||
|
|
|
||
|
|
```
|
||
|
|
1. USE_DIRECT_API=true → Direct API
|
||
|
|
2. USE_CLAUDE_CODE_SERVER → Legacy
|
||
|
|
3. USE_AGENT_SDK (default) → Agent SDK
|
||
|
|
4. SDK unavailable → Fallback to Direct API
|
||
|
|
```
|
||
|
|
|
||
|
|
## 💰 Cost Comparison
|
||
|
|
|
||
|
|
| Mode | Cost per 1M tokens |
|
||
|
|
|------|-------------------|
|
||
|
|
| Agent SDK | **$0** (Pro subscription) |
|
||
|
|
| Direct API (Haiku) | $0.25 - $1.25 |
|
||
|
|
| Direct API (Sonnet) | $3.00 - $15.00 |
|
||
|
|
|
||
|
|
## 🎯 Key Files
|
||
|
|
|
||
|
|
| File | Purpose |
|
||
|
|
|------|---------|
|
||
|
|
| `llm_interface.py` | Core implementation |
|
||
|
|
| `requirements.txt` | Dependencies |
|
||
|
|
| `test_agent_sdk.py` | Test suite |
|
||
|
|
| `.env` | Configuration |
|
||
|
|
|
||
|
|
## 📚 Documentation
|
||
|
|
|
||
|
|
- `AGENT_SDK_IMPLEMENTATION.md` - Full technical details
|
||
|
|
- `MIGRATION_GUIDE_AGENT_SDK.md` - Step-by-step migration
|
||
|
|
- `IMPLEMENTATION_SUMMARY.md` - Executive summary
|
||
|
|
- `QUICK_REFERENCE_AGENT_SDK.md` - This file
|
||
|
|
|
||
|
|
## ✅ Features Preserved
|
||
|
|
|
||
|
|
✅ All 17 tools (file ops, Gmail, Calendar)
|
||
|
|
✅ Scheduled tasks
|
||
|
|
✅ Memory system
|
||
|
|
✅ Self-healing system
|
||
|
|
✅ Telegram adapter
|
||
|
|
✅ Slack adapter
|
||
|
|
✅ Model switching (/sonnet, /haiku)
|
||
|
|
✅ Usage tracking (Direct API mode)
|
||
|
|
|
||
|
|
## 🔄 Rollback
|
||
|
|
|
||
|
|
```env
|
||
|
|
# Quick rollback to Direct API
|
||
|
|
USE_DIRECT_API=true
|
||
|
|
ANTHROPIC_API_KEY=sk-ant-...
|
||
|
|
```
|
||
|
|
|
||
|
|
Restart bot. Done! ✅
|
||
|
|
|
||
|
|
## 📞 Support
|
||
|
|
|
||
|
|
1. Check logs: Look for `[LLM]` messages
|
||
|
|
2. Run tests: `python test_agent_sdk.py`
|
||
|
|
3. Check mode: Verify startup message
|
||
|
|
4. Review docs: See files above
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**Version**: 1.0.0
|
||
|
|
**Date**: 2026-02-15
|
||
|
|
**Status**: ✅ Production Ready
|