mirror of
https://github.com/langchain-ai/deepagents.git
synced 2026-08-27 10:51:26 -04:00
948fea88e2
Deep Agents Code now retries transient model request failures automatically. If a request fails because of a dropped connection, a rate limit, or a provider server error, dcode waits and tries again instead of failing the turn. This covers the main agent, subagents, goal-criteria checks, conversation compaction, auto-mode classification, and rubric grading even when the grader connection drops mid-response. How retrying works: - Retries happen at the individual model call, not the whole turn, so tool calls that already completed are never replayed. - If a response started streaming to your terminal before the failure, that attempt is not retried — this prevents duplicated output. Rubric-grader messages are the narrow exception: both clients filter that nested stream, so the failed grader model call can retry without duplicating visible output. - You can see retry progress in the terminal, both interactively and in headless mode. - Rate-limit responses that carry a valid `Retry-After` header wait as directed, up to 60 seconds. Other failures use an exponential backoff (starting at 0.2s, doubling up to a 10s cap, with jitter). - Permanent failures — authentication errors, permission denials, invalid requests, context overflow — fail immediately without burning retries. - Auto-mode classification runs under a deadline, so its total retry wait is capped to fit inside it; a rate-limited classifier surfaces the provider error rather than stalling. Controlling retries: - `--max-retries N` (or `[retries] max_retries = N` in `config.toml`) sets how many retries follow the initial request. The default is 5; `0` disables retries entirely. Set `[retries.<provider>]` to override per provider. - These settings now control dcode's own retry loop. Previously they set the provider SDK's retry count; that loop is disabled so the two don't multiply. If dcode can't identify the provider's retry control, it warns you, since the provider may still be retrying underneath. - Retries outside the main agent loop (compaction summaries, classifiers, rubric grading) apply to models dcode builds itself. A model you supply directly gets the default budget of 5, with a warning if its own SDK retry loop is also still active. Rubric grading retains its earlier mid-response reliability. Grader messages stream under a nested namespace that both interactive and headless clients filter, and unidentified nested messages are excluded from hook transcripts. Only the grader's retry middleware marks that stream as hidden, allowing dropped reads and truncated bodies to retry the failed model node without replaying completed verification tools. Main-agent and other visible streams keep the duplicate-output guard. --- <details> <summary>Test plan</summary> - Focused model-retry, rubric-grader, client-rendering, transcript, and agent-wiring tests: 152 passed - Ruff checks for all touched files - `ty` checks for all touched files - Pre-commit hooks </details> Made by [Open SWE](https://openswe.vercel.app/agents/7fe4aaa6-4f25-5c78-b472-91ae81e8c1b5) --------- Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Deep Agents Code Tests
API Keys
Required
ANTHROPIC_API_KEY- Required for integration tests that use Anthropic models
Optional
LANGSMITH_API_KEY- Enables LangSmith tracing for test runs