Spaces:
Sleeping
🚀 Quick Start - API Monitoring Now Active!
⚠️ IMPORTANT: You Must Restart the App
The API monitoring UI has been added to app.py, but it won't appear until you restart the Gradio app.
🎯 Three Ways to Restart:
Option 1: Use the Restart Script (Recommended)
cd /home/gpaasch/overgrowth
./RESTART_APP.sh
Option 2: Manual Restart
# Stop any running instance
pkill -f "python.*app.py"
# Start fresh
cd /home/gpaasch/overgrowth
source venv/bin/activate
nohup python app.py > app.log 2>&1 &
# Check logs
tail -f app.log
Option 3: HuggingFace Space
If deployed to HuggingFace Spaces:
- Go to your Space settings
- Click "Restart this Space"
- Wait for reboot
📊 What You'll See After Restart
The very first section at the top of the UI will be:
🔍 Live API Activity Monitor
Real-time visibility into all API calls - LLM, GNS3, and more
┌─────────────────────────────┬──────────────────────────────────────────┐
│ 📊 Session Statistics │ 📡 Recent API Calls │
├─────────────────────────────┼──────────────────────────────────────────┤
│ Session Duration: 0m 0s │ *No API calls yet. Start using the │
│ Total API Calls: 0 │ system to see activity here.* │
│ LLM Calls: 0 │ │
│ GNS3 Calls: 0 │ │
│ Total Tokens: 0 │ │
│ Total Cost: $0.0000 │ │
│ Errors: 0 │ │
│ │ │
│ [🔄 Refresh Stats] │ [🔄 Refresh Activity] │
└─────────────────────────────┴──────────────────────────────────────────┘
---
🌿 Network Automation Pipeline
[Rest of the UI continues below...]
🎬 Demo Flow for Judges
Page loads → See API monitor with $0.00 cost
Enter network description → Click "🚀 Run Full Pipeline"
Watch in real-time as API calls appear:
✅ 🤖 ANTHROPIC claude-3-haiku-20240307 📝 1,247→892 tokens | 💰 $0.0043 | ⏱️ 2,314ms ✅ 🤖 ANTHROPIC claude-3-haiku-20240307 📝 2,105→1,543 tokens | 💰 $0.0201 | ⏱️ 3,127msPipeline completes → Status shows:
💰 API Usage This Session - Total Cost: $0.0823 - LLM Calls: 3 | GNS3 Calls: 5 - Tokens: 8,456 (4,123 in / 4,333 out)Click "🔄 Refresh Stats" → Dashboard updates instantly
✅ Verification Checklist
After restarting, verify these features work:
- "Live API Activity Monitor" section appears at top
- Session Statistics shows $0.00 initially
- Running pipeline populates API calls
- Each call shows: provider, model, tokens, cost, timing
- Total cost updates in real-time
- Refresh buttons work
- Pipeline status includes API usage summary
🐛 Troubleshooting
"I don't see the API monitor"
→ You didn't restart the app. Run ./RESTART_APP.sh
"API calls show but no tokens/costs"
→ This happens with mock responses (no API keys configured)
→ Set ANTHROPIC_API_KEY or OPENAI_API_KEY in .env
"App won't start"
→ Check logs: cat app.log
→ Verify virtual environment: source venv/bin/activate
"Port 7860 in use"
→ Kill existing process: pkill -f "python.*app.py"
📝 Files Changed
agent/api_monitor.py- New monitoring system (343 lines)agent/llm_client.py- Added tracking to all LLM callsagent/local_mcp.py- Added tracking to GNS3 callsapp.py- Added monitoring UI at top of interfaceAPI_MONITORING.md- Full documentationRESTART_APP.sh- Convenient restart script
🎯 Quick Test
cd /home/gpaasch/overgrowth
source venv/bin/activate
# Test the monitor
python -c "
from agent.api_monitor import monitor
print(monitor.get_stats().format_dashboard())
print(monitor.format_activity_feed())
"
# Should output dashboard and activity feed
🚀 For Hackathon Submission
Make sure to:
- ✅ Restart the app before demo
- ✅ Test with a simple network description
- ✅ Show judges the real-time API tracking
- ✅ Highlight the cost transparency
- ✅ Mention this is enterprise-grade observability
The monitoring is fully implemented - just restart to see it! 🎉