Failure handling
Control how workflow steps behave when an agent step fails.
Workflows are useful because they define both success and failure paths.
Each step can choose what happens after success and what happens after failure.
Success transitions
Use OnSuccess(...) to move to another step:
Use OnSuccessEnd() to end the workflow after a successful step:
If a step has no success target, the workflow ends after that step succeeds.
Failure behaviors
| Method | Behavior |
|---|---|
OnFailureStop() | Stop the workflow and return failure. |
OnFailureContinue("next") | Continue to a specified next step. |
OnFailureGoTo("fallback") | Go to a fallback step. |
The travel sample intentionally allows some specialist steps to fail without killing the whole workflow:
This makes sense because final planning can still produce a response with partial context. If the final planner fails, the workflow should stop.
Choosing failure behavior
Use OnFailureStop() when the step is required.
Use OnFailureContinue(...) when the next step can still work with partial context.
Use OnFailureGoTo(...) when you have a dedicated fallback agent, such as:
Failure handling is part of the product behavior. Define it intentionally rather than leaving every decision to a single agent.