# File Structure and Core Syntax

YFlow uses a clear, opinionated file structure designed to support readability, safety, version control, and collaboration. The structure reinforces YFlow’s declarative nature while making flows easy to author, review, validate, and deploy.

YFlow files describe flows as data, not as executable programs.

YFlow uses a single .yflow extension. A flow file can contain everything in one place:

```
    yflow: '1.0'    
         
    flow:    
      name: My Application    
      persona:    
        language: en-US    
        voice: Jessica    
        llmModel: gpt-4o    
         
    nodes:    
      - start:    
          next: greeting    
         
      - greeting:    
          type: say    
          message: Welcome to our service!    
          next: main_agent    
         
      - main_agent:    
          type: agent    
          system: Help the user with their request.    
          goals:    
            done:    
              next: farewell    
          fallback:    
            next: farewell    
      # ... more nodes    
          integrations:    
      banking_api: # ID - snake_case, immutable    
        type: rest    
        base_url: https://api.bank.com    
        # ...    
```

#### Top-Level Keys

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Key</td><td valign="top">Required</td><td valign="top">Description</td></tr><tr><td valign="top">yflow:</td><td valign="top">No</td><td valign="top">YFlow spec version (default: "1.0")</td></tr><tr><td valign="top">flow:</td><td valign="top">Yes</td><td valign="top">Flow metadata (name, persona, version)</td></tr><tr><td valign="top">nodes:</td><td valign="top">Yes</td><td valign="top">Main flow nodes (ordered array)</td></tr><tr><td valign="top">components:</td><td valign="top">No</td><td valign="top">Component definitions — see YFLOW_SPEC_COMPONENTS.md</td></tr><tr><td valign="top">integrations:</td><td valign="top">No</td><td valign="top">API/MCP integration definitions</td></tr></tbody></table>

#### Flow Versioning

Flow Versioning in YFlow provides a safe, explicit way to evolve conversational flows over time without breaking running conversations, integrations, or consumers. Versioning is a lifecycle and governance mechanism, not a control‑flow feature.

Every flow document must have a version number using Semantic Versioning&#x20;(SemVer):   &#x20;

```
    MAJOR.MINOR.PATCH    
```

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Level</td><td valign="top">When to Increment</td><td valign="top">Example</td></tr><tr><td valign="top">MAJOR</td><td valign="top">Breaking changes (removed nodes, changed contracts, incompatible routing)</td><td valign="top">1.0.0 → 2.0.0</td></tr><tr><td valign="top">MINOR</td><td valign="top">New features, backward-compatible (new nodes, new goals, new integrations)</td><td valign="top">1.0.0 → 1.1.0</td></tr><tr><td valign="top">PATCH</td><td valign="top">Bug fixes, non-functional changes (typos, prompt tweaks, refactoring)</td><td valign="top">1.0.0 → 1.0.1</td></tr></tbody></table>

```
yflow: '1.0' # YFlow spec version (format)    
         
    flow:    
      name: Banking Assistant    
      version: '2.1.0' # Flow document version (SemVer)    
      persona:    
        language: en-US    
        voice: Jessica    
```

#### Version Field Rules:

* Required: Every flow must have a version under flow:
* Format: String in "MAJOR.MINOR.PATCH" format (quotes required)
* Initial: New flows start at "1.0.0"
* Immutable per release: Once deployed, a version is immutable

#### When to Bump:

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Change Type</td><td valign="top">Version Bump</td><td valign="top">Example</td></tr><tr><td valign="top">Fix typo in prompt</td><td valign="top">PATCH</td><td valign="top">1.0.0 → 1.0.1</td></tr><tr><td valign="top">Adjust iteration_limit</td><td valign="top">PATCH</td><td valign="top">1.0.1 → 1.0.2</td></tr><tr><td valign="top">Add new goal to agent</td><td valign="top">MINOR</td><td valign="top">1.0.2 → 1.1.0</td></tr><tr><td valign="top">Add new API integration</td><td valign="top">MINOR</td><td valign="top">1.1.0 → 1.2.0</td></tr><tr><td valign="top">Add new component</td><td valign="top">MINOR</td><td valign="top">1.2.0 → 1.3.0</td></tr><tr><td valign="top">Remove a goal</td><td valign="top">MAJOR</td><td valign="top">1.3.0 → 2.0.0</td></tr><tr><td valign="top">Change component contract</td><td valign="top">MAJOR</td><td valign="top">2.0.0 → 3.0.0</td></tr><tr><td valign="top">Rename node (breaking refs)</td><td valign="top">MAJOR</td><td valign="top">3.0.0 → 4.0.0</td></tr></tbody></table>

#### Version vs YFlow Spec:

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Field</td><td valign="top">Purpose</td><td valign="top">Example</td></tr><tr><td valign="top">yflow:</td><td valign="top">YFlow language/spec version</td><td valign="top">"1.0" (rarely changes)</td></tr><tr><td valign="top">flow: version:</td><td valign="top">This flow document's version</td><td valign="top">"2.1.0" (changes with edits)</td></tr></tbody></table>

#### Pre-release and Build Metadata (optional):

```
    flow:    
      version: "2.0.0-beta.1"        # Pre-release    
      version: "2.0.0+build.123"     # Build metadata    
      version: "2.0.0-rc.1+build.456" # Both    
```

### Core Syntax

The Core Syntax of YFlow defines the minimal, canonical building blocks used to describe conversational flows. It is intentionally small, explicit, and restrictive to ensure that flows remain readable, secure, and statically analyzable.

YFlow syntax is descriptive, not executable.

#### Flow Definition

A Flow Definition is the complete, declarative specification of a YFlow conversational flow. It defines what the flow is, what data it expects, and how conversation states connect, without containing executable code or runtime logic.

A flow definition is a static artifact that can be validated, versioned, deployed, and executed safely.

```
# YFlow spec version (optional, defaults to 1.0)    
    yflow: '1.0'    
         
    flow:    
      name: Customer Service Bot    
         
      # REQUIRED: Flow document version (SemVer)    
      version: '1.0.0'    
         
      # Persona settings (voice, language, LLM model)    
      persona:    
        language: en-US    
        voice: Jessica    
        llmModel: gpt-4o # Optional: override default LLM    
         
    # The flow graph (ordered array)    
    nodes:    
      - start:    
          next: main_menu    
      # ... more nodes    
```

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Field</td><td valign="top">Required</td><td valign="top">Description</td></tr><tr><td valign="top">name</td><td valign="top">Yes</td><td valign="top">Flow display name</td></tr><tr><td valign="top">version</td><td valign="top">Yes</td><td valign="top">SemVer version ("MAJOR.MINOR.PATCH")</td></tr><tr><td valign="top">persona</td><td valign="top">No</td><td valign="top">Voice, language, LLM settings</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ixhello.com/ixhc2/technical-specifications/yflow-a-yaml-based-conversational-flow-language/file-structure-and-core-syntax.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
