What are Procedures?
Procedures are document-style workflows that guide your AI agent through structured processes. They support conditional logic, data fetching, and escalations.Procedure Syntax
Procedures use special syntax markers embedded in natural language:Actions: {{action:action_name}}
Call a data connector to fetch data from external systems:
Conditions: {{if:condition}} ... {{else}} ... {{endif}}
Add branching logic based on data:
Escalations: {{escalate:escalation_path_id}}
Escalate to human support:
Complete Example
Creating Procedures
Step 1: Create Agent Actions
First, create the actions your procedure will use:- Navigate to Agents → Your Agent → Actions
- Click “Create Action”
- Configure the action:
- Name:
get_order_details - Description: Fetch order details from API
- HTTP Method: GET
- URL:
https://api.example.com/orders/{{order_number}}
- Name:
- Click “Save”
Step 2: Create Escalation Paths
Create escalation paths for human handoff:- Navigate to Agents → Your Agent → Escalations
- Click “Create Escalation Path”
- Configure the escalation:
- Name: Support Team
- Platform: Slack
- Destination: #support-channel
- Click “Save”
Step 3: Create Procedure
- Navigate to Agents → Your Agent → Procedures
- Click “Create Procedure”
- Configure the procedure:
- Title: Order Status Check
- Content: Write your procedure using the syntax described above
- Enable the procedure
- Click “Save”
How Procedures Execute
- Document is parsed for syntax markers
- Actions execute and results are stored in context
- Conditions evaluate using context data
- Appropriate blocks execute based on conditions
- Escalations trigger when needed
- Processed document is provided to AI agent
- AI agent responds using the enhanced context
Context Variables
After actions execute, data is available in context:{{action:get_order_details}}→ stored in@context['get_order_details']- Access nested fields:
order.status,customer.email - Use in conditions:
{{if:order.status == "shipped"}}
Condition Syntax
Comparison Operators
==- Equal to!=- Not equal to>- Greater than<- Less than>=- Greater than or equal<=- Less than or equal
Examples
Best Practices
- Test actions first: Ensure actions work before using in procedures
- Use clear condition expressions: Keep conditions simple and readable
- Handle errors gracefully: Actions may fail - design procedures accordingly
- Test escalation paths: Ensure escalation paths are configured
- Use descriptive variable names: Makes conditions easier to understand
Troubleshooting
Action not executing
- Verify action name matches exactly
- Check action is enabled
- Review action configuration (URL, method)
- Check Rails logs for errors
Condition not working
- Verify variable exists in context
- Check condition syntax
- Test condition expression separately
- Review context data structure
Escalation not triggering
- Verify escalation path ID is correct
- Check escalation path is active
- Ensure escalation path belongs to agent
- Review escalation service logs
Next Steps
Procedures Example
See a complete procedure execution example
Workflows
Build automation workflows