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,7 +571,9 @@ def run_agent_with_retry(agent, prompt: str, config: dict) -> Optional[str]:
except (KeyboardInterrupt, AgentInterrupt): except (KeyboardInterrupt, AgentInterrupt):
raise raise
except (InternalServerError, APITimeoutError, RateLimitError, APIError, ValueError) as e: except (InternalServerError, APITimeoutError, RateLimitError, APIError, ValueError) as e:
if isinstance(e, ValueError) and 'code 429' not in str(e): 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 raise # Re-raise ValueError if it's not a Lambda 429
if attempt == max_retries - 1: if attempt == max_retries - 1:
logger.error("Max retries reached, failing: %s", str(e)) logger.error("Max retries reached, failing: %s", str(e))

View File

@ -697,6 +697,7 @@ Remember:
- Never announce that you are going to use a tool, just quietly use it. - 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. - 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. - 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. - 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. - 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.") - 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." 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() console = Console()