mirror of
https://github.com/usestrix/strix.git
synced 2026-08-25 20:32:38 +02:00
fix(agent): fix agent loop hanging and simplify LLM module
- Fix agent loop getting stuck by adding hard stop mechanism - Add _force_stop flag for immediate task cancellation across threads - Use thread-safe loop.call_soon_threadsafe for cross-thread cancellation - Remove request_queue.py (eliminated threading/queue complexity causing hangs) - Simplify llm.py: direct acompletion calls, cleaner streaming - Reduce retry wait times to prevent long hangs during retries - Make timeouts configurable (llm_max_retries, memory_compressor_timeout, sandbox_execution_timeout) - Keep essential token tracking (input/output/cached tokens, cost, requests) - Maintain Anthropic prompt caching for system messages
This commit is contained in:
@@ -430,10 +430,8 @@ class Tracer:
|
||||
"input_tokens": 0,
|
||||
"output_tokens": 0,
|
||||
"cached_tokens": 0,
|
||||
"cache_creation_tokens": 0,
|
||||
"cost": 0.0,
|
||||
"requests": 0,
|
||||
"failed_requests": 0,
|
||||
}
|
||||
|
||||
for agent_instance in _agent_instances.values():
|
||||
@@ -442,10 +440,8 @@ class Tracer:
|
||||
total_stats["input_tokens"] += agent_stats.input_tokens
|
||||
total_stats["output_tokens"] += agent_stats.output_tokens
|
||||
total_stats["cached_tokens"] += agent_stats.cached_tokens
|
||||
total_stats["cache_creation_tokens"] += agent_stats.cache_creation_tokens
|
||||
total_stats["cost"] += agent_stats.cost
|
||||
total_stats["requests"] += agent_stats.requests
|
||||
total_stats["failed_requests"] += agent_stats.failed_requests
|
||||
|
||||
total_stats["cost"] = round(total_stats["cost"], 4)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user