fail
Ends the agent with a failure message. The message is shown to the user, and the conversation state is not saved.
Value
| Value | Type | Default | Description |
|---|---|---|---|
| the command's value | dynamic string | "Agent failed" | Ends the agent with a failure message. Agent state is not saved. The value is shown in the UI. |
Example
"if": {
"condition": "{ location['country_code'] != 'US' }",
"then": {
"fail": "{ f'You are in {location['country_name']}. This agent supports only locations in the USA.' }"
}
}Rules
failstops every function and loop that is running.- Because the state is not saved, a follow-up in the same conversation sees the state from before this run.
- A failed run is recorded in the agent errors report, with the message.
- When an invoked agent fails, the calling agent's
invokecommand raises an error with the same message. The caller'sonErrorcan handle the error.

