Skip to content

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 statement

AOP 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
- /continue

How to Write an AOP

Basic Structure

  1. Start with a section header: ## Section Name
  2. Add statements as list items: - Statement text
  3. Use keywords for control flow: /if, /else, /use, etc.
  4. Indent nested blocks with exactly 2 spaces

Indentation Rules

  • Base level statements: no indentation
  • Nested statements (inside /if or /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
- /continue

Managing AOPs

Creating an AOP

  1. Navigate to the AOPs page
  2. Click "Create AOP"
  3. Enter a name and description
  4. 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.

  1. Open the AOP from the list
  2. Edit the content in the editor (only available for draft AOPs)
  3. A "Save" button appears in the header when you make changes
  4. Click "Save" to update your changes
  5. 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:

  1. Open the AOP
  2. Ensure all validation errors are fixed and changes are saved
  3. Click the menu icon (⋮) in the top-right corner
  4. Select "Publish AOP" from the dropdown
  5. 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

  1. Open the AOP
  2. Click the menu icon (⋮) in the top-right corner
  3. Select "Archive"
  4. 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 @toolname for external operations
  • End or Continue: Always end sections with /end or /continue for clarity
  • Test Thoroughly: Validate your AOP syntax before publishing

Next Steps