Problem
When a subagent's primary model fails (rate limit, overloaded, API error), the entire subagent crashes and propagates the error to the main session. This requires manual intervention and disrupts the workflow.
Common scenario:
- GPT-5.5 rate limit reached → reviewer fails → main session must handle manually
Proposed Solution
Add fallback_model field to agent .md frontmatter:
---
name: my-reviewer
model: openai-codex/gpt-5.5
fallback_model: anthropic/claude-sonnet-4-6
thinking: high
---
When the primary model fails with a retryable error (429, 529, overloaded_error), pi-subagents-lite automatically retries with the fallback model.
Benefits
- Resilient workflows: Multi-agent pipelines continue running despite API issues
- Cost optimization: Use cheaper primary model, fallback to reliable secondary
- Developer experience: No manual intervention needed for transient failures
Implementation Notes
Retry logic should:
- Only retry on retryable errors (rate limit, overloaded, timeout)
- Preserve all other parameters (thinking level, max turns, tools, etc)
- Log the fallback attempt for debugging
- NOT retry on non-retryable errors (invalid API key, model not found, etc)
Problem
When a subagent's primary model fails (rate limit, overloaded, API error), the entire subagent crashes and propagates the error to the main session. This requires manual intervention and disrupts the workflow.
Common scenario:
Proposed Solution
Add
fallback_modelfield to agent.mdfrontmatter:When the primary model fails with a retryable error (429, 529, overloaded_error), pi-subagents-lite automatically retries with the fallback model.
Benefits
Implementation Notes
Retry logic should: