Outcomes
Outcomes define the possible states your execution can end in. Think of them as exit codes or status labels that help you understand how and why your agent finished. Instead of being limited to just “success” or “failure”, you can define custom outcomes that match your specific use case.Common Use Cases
- Success/Failure States:
success
,failed
,error
- Business Logic States:
item_purchased
,out_of_stock
,login_required
- Conditional Results:
approved
,rejected
,needs_review
Example Outcomes
For an e-commerce checkout agent, you might define outcomes like:purchase_completed
payment_failed
item_unavailable
session_expired
Best Practices
- Use clear, descriptive names (e.g.,
payment_completed
instead ofdone
) - Define all possible end states your agent might encounter
- Keep outcome names consistent across similar workflows
- Use snake_case for outcome names
Result Schema
You can configure a custom JSON Schema to define the structure of data returned by the output node. This is optional but useful when you need structured data in a specific format. Our schema format follows OpenAI’s Structured Outputs specification, which is a subset of JSON Schema. Your schemma result will be returned by the API atexecution_result.result
. See the full guidance and examples in Output & Status → Result Schema.
When to Use Custom Schemas
- You need structured data in a specific format
- You’re integrating with other systems that expect certain fields
- You want to ensure consistent output structure across executions
- You need to extract multiple pieces of information (prices, names, descriptions, etc.)
Example Schema
A schema for a product scraping agent:Schema Requirements
When defining a schema, follow these rules:- All objects must include
"additionalProperties": false
- All object properties must be required - include all property keys in the
required
array - Use the
description
field to guide the AI in populating fields correctly
Tips
- Start Simple: Begin with just outcomes, add a custom schema only if you need structured data
- Test Your Outcomes: Make sure your agent logic can reach all defined outcomes
- Validate Your Schema: Use the schema examples as a starting point to ensure proper formatting
- Plan Your End States: Think through all the ways your agent’s task might conclude before defining outcomes