Increase recusion limit; Handle 429 better; Improve prompts.

This commit is contained in:
AI Christianson 2025-01-09 15:52:51 -05:00
parent 63be5248e1
commit 0c39166172
3 changed files with 6 additions and 3 deletions

View File

@ -571,8 +571,10 @@ def run_agent_with_retry(agent, prompt: str, config: dict) -> Optional[str]:
except (KeyboardInterrupt, AgentInterrupt):
raise
except (InternalServerError, APITimeoutError, RateLimitError, APIError, ValueError) as e:
if isinstance(e, ValueError) and 'code 429' not in str(e):
raise # Re-raise ValueError if it's not a Lambda 429
if isinstance(e, ValueError):
error_str = str(e).lower()
if 'code' not in error_str or '429' not in error_str:
raise # Re-raise ValueError if it's not a Lambda 429
if attempt == max_retries - 1:
logger.error("Max retries reached, failing: %s", str(e))
raise RuntimeError(f"Max retries ({max_retries}) exceeded. Last error: {e}")

View File

@ -697,6 +697,7 @@ Remember:
- Never announce that you are going to use a tool, just quietly use it.
- Do communicate results/responses from tools that you call as it pertains to the users request.
- If the user gives you key facts, record them using emit_key_facts.
- E.g. if the user gives you a stack trace, include the FULL stack trace into any delegated requests you make to fix it.
- Typically, you will already be in the directory of a new or existing project.
- If the user implies that a project exists, assume it does and make the tool calls as such.
- E.g. if the user says "where are the unit tests?", you would call request_research("Find the location of the unit tests in the current project.")

View File

@ -16,7 +16,7 @@ from ..console import print_task_header
CANCELLED_BY_USER_REASON = "The operation was explicitly cancelled by the user. This typically is an indication that the action requested was not aligned with the user request."
RESEARCH_AGENT_RECURSION_LIMIT = 2
RESEARCH_AGENT_RECURSION_LIMIT = 3
console = Console()