Files
ajarbot/test_agent_hybrid.py
Jordan Ramos 8afff96bb5 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>
2026-02-13 23:38:44 -07:00

37 lines
1.0 KiB
Python

"""Test agent with hybrid search."""
from agent import Agent
print("Initializing agent with hybrid search...")
agent = Agent(provider="claude")
print("\n" + "="*60)
print("TESTING AGENT MEMORY RECALL WITH HYBRID SEARCH")
print("="*60)
# Test 1: Semantic query - ask about cost in different words
print("\n1. Testing semantic recall: 'How can I save money on API calls?'")
print("-" * 60)
response = agent.chat("How can I save money on API calls?", username="alice")
print(response)
# Test 2: Ask about birthday (semantic search should find personal info)
print("\n" + "="*60)
print("2. Testing semantic recall: 'What's my birthday?'")
print("-" * 60)
response = agent.chat("What's my birthday?", username="alice")
print(response)
# Test 3: Ask about specific technical detail
print("\n" + "="*60)
print("3. Testing keyword recall: 'What search technology are we using?'")
print("-" * 60)
response = agent.chat("What search technology are we using?", username="alice")
print(response)
print("\n" + "="*60)
print("Test complete!")
print("="*60)
agent.shutdown()