fix(cli): increase max iterations for child agents and extend API call timeout for improved reliability

This commit is contained in:
teknium1
2026-02-27 17:35:26 -08:00
parent 20177660bb
commit de0829cec3
2 changed files with 5 additions and 4 deletions

2
cli.py
View File

@@ -201,7 +201,7 @@ def load_cli_config() -> Dict[str, Any]:
"max_tool_calls": 50, # Max RPC tool calls per execution
},
"delegation": {
"max_iterations": 25, # Max tool-calling turns per child agent
"max_iterations": 45, # Max tool-calling turns per child agent
"default_toolsets": ["terminal", "file", "web"], # Default toolsets for subagents
},
}

View File

@@ -1199,7 +1199,7 @@ class AIAgent:
"model": self.model,
"messages": api_messages,
"tools": self.tools if self.tools else None,
"timeout": 600.0,
"timeout": 900.0,
}
if self.max_tokens is not None:
@@ -2160,9 +2160,10 @@ class AIAgent:
raise api_error
wait_time = min(2 ** retry_count, 60) # Exponential backoff: 2s, 4s, 8s, 16s, 32s, 60s, 60s
print(f"⚠️ OpenAI-compatible API call failed (attempt {retry_count}/{max_retries}): {str(api_error)[:100]}")
print(f"⏳ Retrying in {wait_time}s...")
logging.warning(f"API retry {retry_count}/{max_retries} after error: {api_error}")
if retry_count >= max_retries:
print(f"{self.log_prefix}⚠️ API call failed after {retry_count} attempts: {str(api_error)[:100]}")
print(f"{self.log_prefix}⏳ Final retry in {wait_time}s...")
# Sleep in small increments so we can respond to interrupts quickly
# instead of blocking the entire wait_time in one sleep() call