mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-30 01:41:43 +00:00
fix(cli): increase max iterations for child agents and extend API call timeout for improved reliability
This commit is contained in:
parent
20177660bb
commit
de0829cec3
2 changed files with 5 additions and 4 deletions
2
cli.py
2
cli.py
|
|
@ -201,7 +201,7 @@ def load_cli_config() -> Dict[str, Any]:
|
||||||
"max_tool_calls": 50, # Max RPC tool calls per execution
|
"max_tool_calls": 50, # Max RPC tool calls per execution
|
||||||
},
|
},
|
||||||
"delegation": {
|
"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
|
"default_toolsets": ["terminal", "file", "web"], # Default toolsets for subagents
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1199,7 +1199,7 @@ class AIAgent:
|
||||||
"model": self.model,
|
"model": self.model,
|
||||||
"messages": api_messages,
|
"messages": api_messages,
|
||||||
"tools": self.tools if self.tools else None,
|
"tools": self.tools if self.tools else None,
|
||||||
"timeout": 600.0,
|
"timeout": 900.0,
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.max_tokens is not None:
|
if self.max_tokens is not None:
|
||||||
|
|
@ -2160,9 +2160,10 @@ class AIAgent:
|
||||||
raise api_error
|
raise api_error
|
||||||
|
|
||||||
wait_time = min(2 ** retry_count, 60) # Exponential backoff: 2s, 4s, 8s, 16s, 32s, 60s, 60s
|
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}")
|
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
|
# Sleep in small increments so we can respond to interrupts quickly
|
||||||
# instead of blocking the entire wait_time in one sleep() call
|
# instead of blocking the entire wait_time in one sleep() call
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue