Agent Operating Procedure (AOP)
Agent Operating Procedure (AOP) is a powerful feature that allows you to define your Standard Operating Procedures (SOPs) in a structured language that intelligent agents can understand and execute.
Overview
AOP bridges the gap between your business processes and intelligent automation. Instead of just providing information, AOP enables your intelligent assistant to actually execute complex, multi-step workflows following your exact procedures.
What is AOP?
AOP is a structured way to describe your business processes so that intelligent agents can:
- Understand the steps involved in a procedure
- Follow your business logic and decision points
- Execute actions in the correct sequence
- Handle exceptions and edge cases
- Maintain consistency across all interactions
Why Use AOP?
- Process Automation: Automate entire workflows, not just responses
- Consistency: Every customer interaction follows your exact procedures
- Scalability: Handle more customers without increasing staff
- Flexibility: Adapt procedures without reprogramming
- Control: Define exactly how processes should be executed
How AOP Works
You define your Standard Operating Procedures in a language that intelligent agents can interpret. The agent then follows these procedures step-by-step when helping customers, making decisions based on your defined logic.
AOP vs Traditional Automation
Traditional automation requires rigid programming. AOP allows you to describe procedures in a more natural, flexible way while maintaining the precision of automated workflows.
AOP Structure
AOPs are written in a structured format that consists of:
- Sections: Defined with
## Section Name(markdown heading) - Statements: List items marked with
-(dash followed by space) - Indentation: Nested blocks use exactly 2 spaces
Example structure:
## Section Name
- First statement
- Second statement
- /if condition
- Nested statement (2 spaces)
- Another nested statementAOP Keywords
/if condition
Creates a conditional branch based on the specified condition. The condition is written in natural language.
- /if customer_has_account
- Load customer profile
- Check account status/else
Provides an alternative path when the /if condition is false. Must follow an /if block.
- /if payment_successful
- Process order
- /else
- Send payment failure notification/wait_until condition
Pauses execution until the specified condition becomes true. Useful for waiting on external events or user input.
- /wait_until payment_confirmed
- Process order shipment/use @toolname
Invokes a specific tool during execution. Tools are referenced with the @ prefix.
- /use @payment_processor
- /use @email_service/end
Terminates the procedure at the current point. Use when the workflow should stop.
- /if order_cancelled
- Send cancellation email
- /end/continue
Proceeds to the next section. Indicates the current section completes successfully.
- Validate input
- /continueHow to Write an AOP
Basic Structure
- Start with a section header:
## Section Name - Add statements as list items:
- Statement text - Use keywords for control flow:
/if,/else,/use, etc. - Indent nested blocks with exactly 2 spaces
Indentation Rules
- Base level statements: no indentation
- Nested statements (inside
/ifor/else): 2 spaces - Double nesting: 4 spaces
- Empty lines between sections reset indentation
Example AOP
## Order Validation
- Receive order request
- /use @order_validator
- /if order_valid
- Create order ID
- /use @logger
- /continue
- /else
- Send error response
- /end
## Payment Processing
- /use @payment_processor
- /wait_until payment_confirmed
- Update order status
- /continueManaging AOPs
Creating an AOP
- Navigate to the AOPs page
- Click "Create AOP"
- Enter a name and description
- Write your AOP content following the DSL syntax
Important: The description helps the system determine when to use this AOP, so be specific about the use case.
Editing an AOP
Note: Only AOPs with "draft" status can be edited. Published or archived AOPs are read-only.
- Open the AOP from the list
- Edit the content in the editor (only available for draft AOPs)
- A "Save" button appears in the header when you make changes
- Click "Save" to update your changes
- Validation errors will appear if syntax is incorrect and prevent saving
If an AOP is published or archived and you want to edit it, you'll need to create a new version.
Publishing an AOP
Draft AOPs are not active. To make an AOP available:
- Open the AOP
- Ensure all validation errors are fixed and changes are saved
- Click the menu icon (⋮) in the top-right corner
- Select "Publish AOP" from the dropdown
- The AOP status changes to "published" and becomes active
Note: You must save any pending changes before publishing. The publish option will show "Save changes first" if there are unsaved edits.
Archiving an AOP
- Open the AOP
- Click the menu icon (⋮) in the top-right corner
- Select "Archive"
- Click "Are you sure?" to confirm
Note: Archiving an AOP changes its status to "archived" and makes it read-only. The AOP will no longer be available for use in conversations.
Best Practices
- Clear Sections: Name sections based on the workflow stage
- Descriptive Conditions: Write conditions in plain, understandable language
- Proper Indentation: Always use exactly 2 spaces for nesting
- Use Tools: Leverage
/use @toolnamefor external operations - End or Continue: Always end sections with
/endor/continuefor clarity - Test Thoroughly: Validate your AOP syntax before publishing