> ## Documentation Index
> Fetch the complete documentation index at: https://omniloy.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Protocols and flows

> What a protocol is, its versions, and the conversational flow the agent follows

A **protocol** defines the agent's behavior on a call: which questionnaire applies and how it runs the conversation. It is OlivIA's central unit, for both follow-up (outbound) and triage (inbound).

## Versions and publishing

A protocol has **versions** with a lifecycle: `draft → in_review → active → superseded/discarded`. Only one version is **active** at a time; calls always use the active version. Before activation, each version passes a **publish validation** that checks flow consistency (targets exist, no cycles, decision branches with a guaranteed exit, valid score bands, etc.).

A version holds: questions, flow phrases, flow webhooks, and decision nodes, plus version-level catalogs (custom variables, score bands, alert rules, guardrails, system phrases, and scheduling config).

## The flow as a graph of nodes

<img src="https://mintcdn.com/omniloy/Q9jZm4-SeFtgd8-M/images/olivia/builder-canvas.png?fit=max&auto=format&n=Q9jZm4-SeFtgd8-M&q=85&s=84bd1aa476630972b549dc0d7c9a4a4a" alt="Protocol builder: flow canvas" width="1687" height="1080" data-path="images/olivia/builder-canvas.png" />

The flow is modeled as a graph of connected nodes. Node types:

| Node              | What it does                                      | Speaks? |
| ----------------- | ------------------------------------------------- | ------- |
| **Question**      | Asks a question and captures/validates the answer | Yes     |
| **Phrase**        | Says a message to the patient                     | Yes     |
| **Decision node** | Routes the flow based on rules, without speaking  | No      |
| **Webhook**       | Calls an external system mid-call                 | No      |
| **Start / End**   | Flow entry and exit points                        | —       |

The path is governed by node order and by [conditional rules](/olivia/en/reglas) that decide, at each step, what comes next.

```mermaid theme={null}
flowchart TD
  Start([Start]) --> Q1[Question]
  Q1 --> D{Decision node}
  D -->|high risk| F1[Phrase]
  D -->|normal| Q2[Follow-up question]
  F1 --> U([Unresolved])
  Q2 --> End([End])
```

## Key limits

| Limit                   | Value                           |
| ----------------------- | ------------------------------- |
| Questions per protocol  | 30                              |
| Options per question    | 10 (multiple choice: minimum 2) |
| Rules per node          | 10                              |
| Condition depth         | 50                              |
| Free-text length        | 2000 characters                 |
| Red flags per version   | 10                              |
| Alert rules per version | 10                              |

## In this section

* [Questions and validation](/olivia/en/preguntas)
* [Conditional rules and variables](/olivia/en/reglas)
* [Decision nodes](/olivia/en/decisiones)
* [Phrases](/olivia/en/frases)
* [Guardrails and red flags](/olivia/en/guardrails)
