Summary
The LLM class has a known issue documented directly in code at praisonaiagents/llm/llm.py:73-74:
# TODO: Include in-build tool calling in LLM class
# TODO: Restructure so that duplicate calls are not made (Sync with agent.py)
Impact
- Direct cost impact: Duplicate LLM API calls double token usage and billing
- Latency: Each duplicate call adds round-trip time to LLM provider
- Rate limiting: Doubles the chance of hitting provider rate limits
- This affects every agent interaction since LLM is the core execution path
Context
The issue appears to stem from the interaction between llm.py and agent.py — the agent layer and LLM layer are not properly synchronized, causing the same request to be sent twice.
Suggested Fix
- Audit the call path from
agent.py → llm.py to identify where duplication occurs
- Restructure so tool calling is handled in a single pass
- Add request deduplication or caching for identical prompts within the same turn
- Add telemetry to track and alert on duplicate calls
- Add a test that verifies exactly N API calls are made for N-turn conversations
Summary
The LLM class has a known issue documented directly in code at
praisonaiagents/llm/llm.py:73-74:Impact
Context
The issue appears to stem from the interaction between
llm.pyandagent.py— the agent layer and LLM layer are not properly synchronized, causing the same request to be sent twice.Suggested Fix
agent.py→llm.pyto identify where duplication occurs