Workflows
Step-by-step playbooks that tell the AI agent what to check, ask and do in a specific situation.
A workflow is a playbook the AI agent follows in a specific situation: a cancellation, a claim, a plan change, a damaged product. It says which details to collect, which actions to call, how to handle each outcome and when to hand off. Workflows are where most of your AI agent's real work is defined.
What you can do
- Follow your process step by step. Collect the order number and email, check the order, then cancel it or explain the return process.
- Act in your systems. A workflow switches on the actions the AI agent may use in that situation, such as a refund or a plan change.
- Adapt to live data. Variants give different instructions depending on the state of an order, a subscription or a policy: shipped or not, active or paused, in force or lapsed.
- Handle each channel its own way. Run an invoice workflow on email only, or a call transfer workflow on phone calls only.
- Draft first, restore any time. A draft workflow is ignored until you switch it on, and every change keeps a version you can restore.
- Compare approaches. Split customers between two variants with an A/B test.
Set it up
Create a workflow for subscription cancellations. Offer a one-month pause first, cancel if the customer still wants to, and hand off if they mention a billing dispute. Then run test conversations on web chat and email for each path.
In the dashboard, go to Settings -> Automation -> Workflows. Run test conversations after every new or changed workflow. See Test your AI agent.
Workflows, articles and bot rules
Each holds a different kind of instruction:
- Articles provide information the AI agent can look up, like an FAQ. See Knowledge base.
- Bot rules set a few short, always-on guidelines, like "never promise a delivery date". See Bot rules.
- Workflows define step-by-step processes for specific situations, often with actions that connect to your systems.
Priority: when workflow instructions and articles contradict each other, the AI agent follows the workflow. Keep bot rules free of scenario-specific steps so they don't conflict with your workflows.
When to use a workflow
Use a workflow when the AI agent needs to:
- Follow a defined process, such as "customer reports a damaged order" or "customer wants to report a claim"
- Trigger an action, such as cancelling an order, fetching tracking or account details, or processing a refund
- Make decisions based on data, such as checking an order's or account's status before responding
Don't use a workflow when:
- You only want to add information the AI agent can reference: use an article
- You need a short, always-on behavioral rule: use a bot rule
How the AI agent uses workflows
A workflow reaches the AI agent in one of two ways:
- Embedded workflows are written into the system prompt in full, so their instructions and actions are available from the first message. They must have exactly one variant, no condition provider and no required conditions.
- Non-embedded workflows are listed in the system prompt by title and trigger only. The AI agent loads one with the built-in
getWorkflowInstructionstool when the situation matches.
When the AI agent loads a non-embedded workflow:
- It recognizes that the situation matches the workflow's trigger.
- If the workflow has a condition provider, it runs to evaluate external state. Is the order shipped? Is the subscription active? Is the policy in force?
- Octocom picks the first matching variant based on those conditions.
- The AI agent follows that variant's instructions, calling actions as needed.
A loaded workflow stays available for the rest of the conversation. How the AI agent works explains loading in more depth.
Most workflows are simple: one set of instructions and no condition provider. Add variants and a condition provider only when the same situation needs different handling depending on external state.
To embed a workflow, switch on Embedded in the workflow editor. Embed only short workflows that apply to almost any conversation, such as the two defaults below: every embedded workflow adds its full instructions to the prompt on every turn. Keep workflows non-embedded when they need variant selection or condition evaluation. A change that would break the embedded requirements is rejected without removing existing data.
Live and draft workflows
The AI agent only uses live workflows. A draft workflow is ignored until you switch on Live Flow, so you can prepare and review a workflow before customers meet it.
Default workflows for a new business
New businesses start with two live, embedded workflows, available on every channel:
- Escalation request calls
transferConversationwhen a customer asks for a human. - Other queries searches available knowledge or product information, answers from verified results, and offers a human handoff when the request cannot be resolved. More specific workflows take precedence.
Both expose transferConversation immediately and require no integration. These defaults do not provide order or account lookups, cancellations, updates or subscription operations. Ask Copilot to configure those workflows and actions for your connected systems, then run test conversations for each one.
Structure of a workflow
Create and edit workflows under Settings -> Automation -> Workflows. Each field below matches the workflow editor.
Title
Flow Title: a short, descriptive name anyone can understand at a glance.
- Order tracking
- Cancel order
- Damaged product
- Claim status
- Change mobile plan
- Invoice copy request
Avoid vague names like "Order issue" or "Customer request".
Trigger: "When should this flow be followed?"
Describe when the AI agent should use this workflow. Write it like directions to a teammate: short, plain and based on what the customer says or does.
- When a customer asks to cancel their order.
- When a customer reports receiving a damaged product.
- When a customer asks about the status of an insurance claim they already submitted.
- When a business customer asks for a copy of an invoice.
Keep it to a few sentences. Be specific, and avoid overlaps with other workflows. If two workflows could match the same message, say in each trigger which situations it covers and which belong to the other.
Available channels (optional)
Available Channels restricts the workflow to specific channels, such as web chat, email, WhatsApp, Instagram or phone calls. When the customer's current channel is not in the list, the workflow is hidden from the AI agent entirely.
Leave it empty, the default, to make the workflow available on every channel.
Use this when the same situation should be handled differently per channel, for example a "Request invoice" workflow that only runs on email, or a "Transfer to live agent" workflow for phone calls.
Actions (optional)
Actions let the AI agent do things, not only reply. They connect the workflow to your systems so the AI agent can fetch order or account details, process refunds, check stock or coverage, calculate shipping costs and more. See Actions for what actions are and how they get built.
Choose the actions in Available Actions. Each variant has its own list. In the instructions, reference actions by name on the step where they should run. The AI agent sees custom actions by a camelCase name: an action saved as lookup_order is called lookupOrder.
Actions come in two main types: API actions for simple HTTP calls, and Python actions for anything that needs logic. See the technical reference in Custom actions.
Bot instructions
Bot Instructions is the playbook the AI agent follows. Write it like directions to a teammate: short, explicit and step by step.
How to write great instructions:
- Be linear. Number each step. One action or decision per step.
- Confirm first. Collect the minimum details before acting, for example an email address and an order or policy number.
- Name actions. On the step where work happens, include the action name, for example
getOrderDetails. - Handle branches. Use clear if/else for common cases: found or not found, in or out of policy.
- Ask before changing anything. Before an action that cancels, refunds or changes something, summarize what will happen and act only after the customer confirms.
- Close the loop. Tell the customer what you did or what will happen next.
- Fail safe. If blocked or facing a policy exception, hand off with
transferConversation. See Human escalation.
Instructions are guidance to a language model, not code. When something must hold every time, such as an ownership check or a refund limit, enforce it in the action or a condition provider. See How the AI agent works.
Variants
By default, a workflow has one variant: one set of instructions that always runs. That is enough for most cases.
Sometimes the same situation needs different handling depending on external state. For example, a "Cancel order" workflow might need different responses depending on whether:
- The order has already shipped
- The order was already refunded
- The payment went through a specific provider
Variants let you define several instruction sets within a non-embedded workflow. Each variant has a Variant Title and Variant Conditions: boolean flags that must all be true for that variant to be selected.
Variants are ordered by priority. Octocom checks them top to bottom and picks the first match. The last variant typically has no conditions and acts as the fallback.
Example: Cancel subscription
| Variant | Condition | What happens |
|---|---|---|
| Subscription not found | subscriptionNotFound | Ask customer to double-check email |
| Already refunded | isRefunded | Inform customer, no further action |
| Default | (none) | Proceed with normal cancellation |
To power variants with real data, you need a condition provider: a script that evaluates external state and returns the boolean conditions used to pick a variant. See Condition providers.
Examples
Simple: Escalation to a human
A minimal workflow: no actions besides the handoff, no condition provider, only instructions.
- Trigger: Customer explicitly asks to speak to a person
- Variants: 1 (default)
- Instructions:
- Collect the customer's email address
- Ask for a brief summary of their issue
- Call
transferConversation
See Human escalation.
Medium: Order tracking
A workflow that calls an external API to fetch data.
- Trigger: Customer asks about their order status
- Variants: 1 (default)
- Actions:
getOrderDetails - Instructions:
- Ask for the order ID, or the email if no ID is available
- Call
getOrderDetailswith the order ID - Share the order status, items and tracking link
- If no tracking info is available yet, explain that the order is being processed
- If the order can't be found, ask the customer to double-check the ID
The same shape works for any status lookup: a claim's status at an insurer, a ticket in a B2B customer's account, or a SIM activation at a telecom. Swap the identifier and the action.
Advanced: Cancel order with retention
A multi-variant workflow that adapts to the order's state.
- Trigger: Customer wants to cancel their order
- Condition provider: Checks order status through your API
- Actions:
cancelOrder,processPartialRefund - Variants:
| # | Variant | Condition | Instructions |
|---|---|---|---|
| 0 | Order not found | orderNotFound | Ask customer to verify order ID |
| 1 | Already refunded | isRefunded | Inform customer the order has already been refunded |
| 2 | Already shipped | isShipped | Explain the order has shipped, suggest waiting or returning |
| 3 | Default | (none) | Confirm intent -> offer partial refund to retain -> cancel if firm |
For more worked patterns, such as discounts before cancelling, refunds with policy checks, B2B quotes and decisions from a supplier, see Common patterns.
Managing workflows
- In the dashboard: Settings -> Automation -> Workflows. Each workflow keeps a version history you can restore from.
- With Copilot or MCP:
list_workflows,get_workflow,create_workflow,update_workflow,add_workflow_variant,update_workflow_variant,reorder_workflow_variants,delete_workflow_variantandarchive_workflow. For history, uselist_workflow_versions,get_workflow_version,diff_workflow_versionsandrestore_workflow_version. - With the REST API:
GET,POST,PATCHandDELETE /rest/v1/workflows, plus versions and restore. See the REST API.
For developers and AI agents
Action names and loading arguments
The AI agent calls a custom action by its camelCase tool name (lookup_order becomes lookupOrder). MCP list_actions / get_action_details and REST action responses include this identifier as toolName. Use toolName in workflow instructions. Workflow actionNames accept either the saved name or the tool name, including for embedded workflows. Non-embedded workflows make their actions available immediately after loading, within the same reply.
list_actions lists custom actions, including the editable order lookups a store connector installs, such as getOrderDetailsByOrderId. Built-in actions such as transferConversation are not listed there.
MCP and REST workflow reads include loadingRequirements, with the required Python condition-provider argument names and their source. These are arguments to getWorkflowInstructions, separate from custom action inputs. Workflows without a condition provider load without arguments. Order, account and subscription lookups belong in Python actions or condition providers; workflow loading does not perform a built-in lookup.
Workflows, providers and versions
list_workflows and get_workflow return the owning businessId, the attached conditionProviderId and its conditionProviderName. A null provider ID means no Python provider is attached, so only variants without required conditions can match.
Variant conditions always come from the attached Python provider: put condition logic in a Python condition provider, and share one provider across workflows that evaluate the same input (see Condition providers).
Creating multi-variant workflows or adding variants through Copilot requires an attached Python provider. Check the provider relationship before changing a shared provider or diagnosing variant selection.
Workflow version listings, individual versions and version diffs include both workflowId and businessId, so results remain attributable when inspecting several businesses together. Use get_workflow for current configuration and version tools for historical configuration.