Add API usage tracking and dynamic task reloading
Features: - Usage tracking system (usage_tracker.py) - Tracks input/output tokens per API call - Calculates costs with support for cache pricing - Stores data in usage_data.json (gitignored) - Integrated into llm_interface.py - Dynamic task scheduler reloading - Auto-detects YAML changes every 60s - No restart needed for new tasks - reload_tasks() method for manual refresh - Example cost tracking scheduled task - Daily API usage report - Budget tracking ($5/month target) - Disabled by default in scheduled_tasks.yaml Improvements: - Fixed tool_use/tool_result pair splitting bug (CRITICAL) - Added thread safety to agent.chat() - Fixed N+1 query problem in hybrid search - Optimized database batch queries - Added conversation history pruning (50 messages max) Updated .gitignore: - Exclude user profiles (memory_workspace/users/*.md) - Exclude usage data (usage_data.json) - Exclude vector index (vectors.usearch) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -47,6 +47,11 @@ config/scheduled_tasks.yaml # Use scheduled_tasks.example.yaml instead
|
||||
# Memory workspace (optional - remove if you want to version control)
|
||||
memory_workspace/memory/*.md
|
||||
memory_workspace/memory_index.db
|
||||
memory_workspace/users/*.md # User profiles (jordan.md, etc.)
|
||||
memory_workspace/vectors.usearch
|
||||
|
||||
# Usage tracking
|
||||
usage_data.json
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
|
||||
Reference in New Issue
Block a user