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

# Editor de flujo de trabajo

> Construya flujos de conversación con el editor visual de flujo de trabajo

## Descripción general

El Editor de flujo de trabajo es una herramienta visual basada en nodos para diseñar la lógica de conversación. Arrastre, suelte y conecte nodos para crear flujos de conversación complejos.

## Tipos de nodos

### Nodo de inicio

El punto de entrada de cada flujo de trabajo. Cada flujo de trabajo tiene exactamente un nodo de inicio.

### Nodo LLM

Envía un mensaje al modelo de IA configurado y devuelve la respuesta.

**Configuración:**

* Temperatura (0.0 - 1.0)
* Máximo de tokens
* Anulación personalizada del prompt del sistema

### Nodo de condición

Ramifica el flujo de trabajo según condiciones. Soporta:

* Coincidencia de palabras clave
* Análisis de sentimiento
* Expresiones personalizadas

### Nodo de llamada a herramienta

Ejecuta una función externa o llamada API. Los resultados se pasan de vuelta al contexto de la conversación.

### Nodo de llamada de voz

Gestiona interacciones específicas de voz — reconocimiento y síntesis de voz.

### Nodo final

Termina la conversación con un mensaje de cierre opcional.

## Conexión de nodos

Haga clic en el puerto de salida de un nodo y arrastre hasta el puerto de entrada de otro nodo para crear una conexión. Cada conexión representa una ruta posible de la conversación.

## Mejores prácticas

<Tip>
  Construya siempre rutas explícitas entre nodos con condiciones claras. Sin embargo, en algunos casos la IA puede enrutar autónomamente a un nodo que no tiene arista directa — esto se denomina **sinapsis**. Las sinapsis ocurren cuando la IA determina que las condiciones de enrutamiento existentes son poco claras o insuficientes y decide alcanzar un nodo por su cuenta. Si bien esto proporciona flexibilidad, las sinapsis frecuentes generalmente indican que sus condiciones de arista necesitan ser más específicas.
</Tip>

* Mantenga los flujos de trabajo simples — los flujos complejos son más difíciles de depurar
* Use nodos de condición para manejar casos límite
* Pruebe cada ruta individualmente antes de publicar

***

## Generar workflow con Claude Code

Si desea crear un workflow personalizado para su agente de IA basado en sus requisitos de negocio, puede usar **Claude Code** para generar una plantilla de workflow JSON lista para usar.

<Accordion title="Prompt para generación de workflow">
  ```text theme={null}
  # Instruction: Generate a Revol Workflow Template JSON

  ## Context

  I use Revol — a platform for building AI sales agents. Each agent
  has a visual workflow editor with nodes and edges that define
  conversation logic.

  I need you to generate a workflow template as a JSON object that
  I can import into my Revol agent. The JSON follows a strict schema
  used by Revol's template system.

  ## JSON Schema

  The output must be a single JSON object with these top-level keys:

  {
    "nodes_data": [...],
    "edges_data": [...],
    "tools_data": {...},
    "memory_fields_data": [...]   // optional
  }

  ### nodes_data (array of objects)

  Each node object has these fields:

  | Field | Type | Required | Description |
  |-------|------|----------|-------------|
  | index | integer | yes | Unique index (0-based), used for edge references |
  | node_type | string | yes | One of: start, custom, system_stt, system_tts, system_product, system_media, system_company, system_formatter |
  | name | string | yes | Display name on the canvas |
  | position_x | integer | yes | Canvas X coordinate |
  | position_y | integer | yes | Canvas Y coordinate |
  | is_active | boolean | yes | Whether this node is active |
  | conversation_goal | string | no | System prompt for this node (custom nodes only) |
  | config | object | no | Node-specific configuration (see below) |
  | llm_provider_override | string | no | Override LLM provider: openai, anthropic, gemini, groq |
  | llm_model_override | string | no | Override model name |
  | temperature_override | number | no | Override temperature (0.0-2.0) |

  Node types and their purpose:
  - start — entry point, exactly one per workflow, no conversation_goal
  - custom — LLM-powered node with its own prompt, tools, and knowledge base
  - system_product — searches products, checks availability, shows details
  - system_media — retrieves photos, videos, documents
  - system_company — company info and support questions
  - system_formatter — combines outputs from parallel nodes into final response
  - system_stt — speech-to-text (voice input), usually inactive by default
  - system_tts — text-to-speech (voice output), usually inactive by default

  Config for system_stt:
  {
    "provider": "openai",
    "language": "en",
    "greeting_text": "Hi! How can I help you?",
    "greeting_audio_url": null,
    "farewell_text": "Thanks! Goodbye!",
    "farewell_audio_url": null
  }

  Config for system_tts:
  {
    "provider": "openai",
    "voice": "nova",
    "model": "tts-1",
    "speed": 1.0
  }

  Config for custom nodes (optional):
  {
    "save_to_memory": ["field_key1", "field_key2"],
    "max_tool_rounds": 3,
    "tool_timeout_seconds": 30
  }

  ### edges_data (array of objects)

  Each edge object connects two nodes:

  | Field | Type | Required | Description |
  |-------|------|----------|-------------|
  | source_index | integer | yes | Index of the source node |
  | target_index | integer | yes | Index of the target node |
  | condition_type | string | yes | One of: always, keyword, intent, state, fallback |
  | condition_value | object | no | Condition parameters (null for always/fallback) |
  | priority | integer | no | Evaluation priority (default: 90 for always) |

  Condition types and priorities:
  - keyword (priority: 100) — matches words in the message
    condition_value: { "keywords": ["word1", "word2", ...] }
  - state (priority: 95) — checks memory field values
    condition_value: { "conditions": [{"field": "name", "operator": "filled|empty|=|!=|contains|>|<", "value": ""}] }
  - always (priority: 90) — unconditional, enables parallel fan-out
    condition_value: null
  - intent (priority: 50) — LLM classifies the message intent
    condition_value: { "intents": ["intent_name"] }
  - fallback (priority: 10) — routes only when nothing else matches
    condition_value: null

  ### tools_data (object, keys are node indexes as strings)

  Maps node index to an array of tool names:

  {
    "2": ["search_documents", "get_company_info"],
    "3": ["get_products", "get_product_details"]
  }

  Available built-in tools (9):
  - get_products — search products by name/description
  - get_product_details — full details for one product
  - check_availability — check if product is in stock
  - search_by_parameters — filter products by attributes
  - get_company_info — company name, description, contacts
  - search_documents — semantic RAG search in knowledge base
  - get_photos — retrieve photos
  - get_videos — retrieve videos
  - get_documents — retrieve PDF/Word/Excel files

  ### memory_fields_data (optional array)

  Define structured fields the agent should collect:

  [
    {"key": "client_name", "label": "Client Name", "type": "text"},
    {"key": "client_phone", "label": "Phone", "type": "phone"},
    {"key": "topic", "label": "Topic", "type": "select", "options": ["sales", "support"]}
  ]

  Field types: text, phone, email, number, select (with options array).

  ## Workflow Patterns

  ### Pattern 1: Simple (single expert)
  Start → Custom Node → Formatter
  Best for: FAQ bots, simple support, single-topic agents.

  ### Pattern 2: Parallel experts (always routing)
  Start → Expert A → Formatter
        → Expert B → Formatter
        → Expert C → Formatter
  Best for: agents that need to search products + documents + company info simultaneously.

  ### Pattern 3: Smart router (intent/keyword routing)
  Start → (intent: sales) → Sales Expert → Formatter
        → (intent: support) → Support Expert → Formatter
        → (fallback) → General Expert → Formatter
  Best for: multi-topic agents where different questions need different expertise.

  ### Pattern 4: Lead collection (state routing)
  Start → (name empty) → Collect Name → Formatter
        → (name filled, phone empty) → Collect Phone → Formatter
        → (all filled) → Final Response → Formatter
  Best for: lead qualification, appointment booking, form-filling flows.

  ### Pattern 5: Voice agent
  STT → Start → Expert → Formatter → TTS
  Same as any pattern above, but with STT/TTS nodes active.

  ## Layout Guidelines

  - Start node at position (0, 0)
  - STT node to the left: (-200, 0)
  - Expert nodes to the right: (200, -100), (200, 0), (200, 100)
  - Formatter further right: (400, 0)
  - TTS node furthest right: (600, 0)
  - Vertical spacing between parallel nodes: 100-200px

  ## Rules

  1. Every workflow MUST have exactly one "start" node
  2. Every workflow MUST have exactly one "system_formatter" node
  3. STT and TTS nodes should be included but set to is_active: false
     unless voice is specifically requested
  4. Custom nodes should have clear, focused conversation_goal text
  5. Each custom node should have at least search_documents tool
  6. Use intent routing instead of keyword for multilingual agents
  7. The fallback edge ensures no message goes unanswered
  8. Node indexes must be sequential starting from 0
  9. All edge source_index and target_index must reference valid node indexes
  10. conversation_goal should be written in the language the agent will use

  ## Output

  Return ONLY the JSON object — no markdown, no explanation, no
  code fences. The JSON must be valid and parseable.

  ## Input

  My business: [DESCRIBE YOUR BUSINESS]
  Agent role: [e.g., sales consultant, support agent, lead collector]
  Languages: [e.g., English, Ukrainian, multilingual]
  Voice enabled: [yes/no]
  Key topics/departments: [e.g., products, billing, technical support]
  Memory fields to collect: [e.g., name, phone, email, or none]
  Special requirements: [any additional requirements]
  ```
</Accordion>

<Tip>
  Después de generar el JSON, puede revisar y ajustar los nombres de nodos, conversation goals o asignaciones de herramientas antes de importar. El formato de plantilla de workflow será importable directamente en una futura actualización de Revol.
</Tip>
