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

# Execution & Watch Mode

> Understanding how workflows run and how to debug them in real-time

# Execution Engine

LyznFlow's execution engine is the heart of the platform. It takes your visual workflow and turns it into actual running code.

## How Execution Works

Every time a workflow runs, it creates an **Execution**. An execution is a single instance of your workflow running from start to finish.

```mermaid theme={null}
sequenceDiagram
    participant User
    participant Trigger
    participant Engine
    participant Nodes
    
    User->>Trigger: Webhook / Chat / Schedule
    Trigger->>Engine: Start Execution
    Engine->>Nodes: Execute Node 1
    Nodes-->>Engine: Result 1
    Engine->>Nodes: Execute Node 2 (using Result 1)
    Nodes-->>Engine: Result 2
    Engine->>User: Final Response
```

### Execution Lifecycle

1. **Trigger**: An event (like a chat message or a scheduled time) initiates the process.
2. **Queuing**: The execution is placed in a queue (`Pending` state).
3. **Running**: The engine picks up the job and starts executing nodes one by one (`Running` state).
4. **Completion**:
   * **Success**: All nodes finished correctly.
   * **Error**: A node failed, and the workflow stopped (unless error handling was configured).

## Watch Mode

Watch Mode is a powerful feature for developers. It allows you to "watch" the backend execution engine in real-time directly on your canvas.

### How it Works

When you toggle **Watch Mode** ON:

1. The editor subscribes to a real-time WebSocket channel for this workflow.
2. As the backend engine executes each node, it broadcasts events (`nodeStarted`, `nodeFinished`, `nodeError`).
3. The editor receives these events and animates the nodes:
   * **Pulse Green**: Node is currently running.
   * **Solid Green Border**: Node finished successfully.
   * **Red Border**: Node failed.
   * **Output Preview**: You can click a finished node to see exactly what output it produced.

<Note>
  **Note**: Watch Mode only affects *your* view of the editor. It does not change how the workflow runs on the server.
</Note>

## Publishing Your Agent

Once your workflow is working perfectly in Watch Mode, you are ready to publish.

### Public vs Private

* **Private (Default)**: Only you (and your team) can trigger or chat with this agent. Perfect for development and internal tools.
* **Public**: The agent is listed in the Lyzn Marketplace or accessible via a public link. Anyone can use it.

### Versioning

LyznFlow handles versioning automatically.

* **Draft**: The version currently on your canvas.
* **Published**: The version that is live for users.
* When you click **Publish**, your current Draft becomes the new Published version.

***

**Next Steps**: Learn how to build advanced [AI Agents](/lyznflow/guides/ai-agent-deep-dive).
