# Run workflows

#### **Executing an AI Workflow in CogniBlocks**

Before running a **CogniBlocks Workflow**, ensure that:\
✅ All necessary **Cognitive Units (Blocks)** are placed in the workspace.\
✅ Connections between Blocks are properly established.\
✅ Required **inputs** (if applicable) are provided.\
✅ Any **modified Blocks** are saved and compiled before execution.

Once everything is set, initiate the workflow by clicking the **"Execute"** button.

***

### **Monitoring Execution Logs**

Once the workflow starts running:

* Click the **Logs** button to view **real-time execution details**.
* If this is the first time running a workflow, **Docker images** will be built before execution.
* On subsequent runs (if no changes were made), containers will execute **without rebuilding**, reducing execution time.

***

### **Workflow Execution History & Data Storage**

When a **CogniBlocks Workflow** is executed, a dedicated directory is created to **store execution details**.

📂 **Workspace Storage Structure:**

```
bashCopyEdit/workspace/.cache/workflow-${workflow_id}/
  ├── {run_uuid}/
  │   ├── outputs/   # Stores generated output files  
  │   ├── logs/      # Execution logs for debugging  
  │   ├── results.json  # Detailed workflow execution report  
  ├── workflow.json  # Workflow structure & Block connections  
```

* Each workflow run creates a **unique subdirectory** named after a **UUID** for version tracking.
* The **workflow\.json** file outlines the **structure & links** between Blocks.
* If the run is **successful**, a `results.json` file is generated, logging:
  * **Block Inputs & Outputs**
  * **Execution timestamps**
  * **Processing metadata**

***

🚀 **Now you’re ready to execute, monitor, and analyze workflows in CogniBlocks!**
