fix: increase AI timeout to 120s and limit retries to 1

The 45s timeout was too short for generation tasks with full flow
context in the system prompt. The Anthropic SDK's default 2 retries
caused requests to hang for ~136s before failing. Now: 120s timeout
with max 1 retry = faster failure if it does timeout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-07 01:42:45 -05:00
parent fdc3be57ed
commit a9251a0ee3
2 changed files with 2 additions and 1 deletions

View File

@@ -184,6 +184,7 @@ class AnthropicProvider(AIProvider):
client = anthropic.AsyncAnthropic(
api_key=self._api_key,
timeout=self._timeout,
max_retries=1,
)
response = await client.messages.create(

View File

@@ -77,7 +77,7 @@ class Settings(BaseSettings):
AI_MODEL: str = "claude-sonnet-4-6"
AI_CONVERSATION_TTL_HOURS: int = 24
AI_MAX_CALLS_PER_FLOW: int = 10
AI_REQUEST_TIMEOUT_SECONDS: int = 45
AI_REQUEST_TIMEOUT_SECONDS: int = 120
# AI Provider selection
AI_PROVIDER: str = "anthropic" # "gemini" or "anthropic"
GOOGLE_AI_API_KEY: Optional[str] = None