feat: recipes can retry with success criteria (#3474)

This commit is contained in:
Prem Pillai
2025-07-22 10:49:21 +10:00
committed by GitHub
parent 5f3c7d339c
commit 99cc0a9c81
17 changed files with 1078 additions and 82 deletions
@@ -87,6 +87,12 @@ You can turn your current Goose session into a reusable recipe that includes the
goose_provider: $provider # Provider to use for this recipe
goose_model: $model # Specific model to use for this recipe
temperature: $temperature # Model temperature setting for this recipe (0.0 to 1.0)
retry: # Automated retry logic with success validation
max_retries: $max_retries # Maximum number of retry attempts
checks: # Success validation checks
- type: shell
command: $validation_command
on_failure: $cleanup_command # Optional cleanup command on failure
```
</details>
@@ -529,6 +535,37 @@ When scheduling Goose recipes with the CLI, you can use Goose's built-in cron sc
- Help users understand what the recipe can do
- Make it easy to get started
## Advanced Features
### Automated Retry Logic
Recipes can include retry logic to automatically attempt task completion multiple times until success criteria are met. This is particularly useful for:
- **Automation workflows** that need to ensure successful completion
- **Development tasks** like running tests that may need multiple attempts
- **System operations** that require validation and cleanup
**Basic retry configuration:**
```yaml
retry:
max_retries: 3
checks:
- type: shell
command: "test -f output.txt" # Check if output file exists
on_failure: "rm -f temp_files*" # Cleanup on failure
```
**How it works:**
1. Recipe executes normally with provided instructions
2. After completion, success checks validate the results
3. If validation fails and retries remain:
- Optional cleanup command runs
- Agent state resets to initial conditions
- Recipe execution starts over
4. Process continues until either success or max retries reached
See the [Recipe Reference Guide](/docs/guides/recipes/recipe-reference#automated-retry-with-success-validation) for complete retry configuration options and examples.
## What's Included
A recipe captures:
@@ -539,6 +576,7 @@ A recipe captures:
- Project folder or file context
- Initial setup (but not full conversation history)
- The model and provider to use when running the recipe (optional)
- Retry logic and success validation configuration (if configured)
To protect your privacy and system integrity, Goose excludes: