In agent.py:36-38, a new anthropic.Anthropic client is created on every call to _call(). This means every analyze_issues, suggest_next, etc. creates a fresh HTTP client with a new connection pool. For users with anthropic_api_key configured, this adds unnecessary latency and resource overhead, especially during cmd_suggest which calls both analyze_issues and suggest_next sequentially.
Fix: Create the Anthropic client once and reuse it. Either initialize it in a module-level variable when api_key is first provided, or use a simple cache pattern:
_anthropic_client = None
def _get_client(api_key):
global _anthropic_client
if _anthropic_client is None:
_anthropic_client = anthropic.Anthropic(api_key=api_key)
return _anthropic_client
Identified by minbot code review
In
agent.py:36-38, a newanthropic.Anthropicclient is created on every call to_call(). This means everyanalyze_issues,suggest_next, etc. creates a fresh HTTP client with a new connection pool. For users withanthropic_api_keyconfigured, this adds unnecessary latency and resource overhead, especially duringcmd_suggestwhich calls bothanalyze_issuesandsuggest_nextsequentially.Fix: Create the Anthropic client once and reuse it. Either initialize it in a module-level variable when
api_keyis first provided, or use a simple cache pattern:Identified by minbot code review