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

# Automation Concepts

> Understand the fundamental concepts of building automations in Agent Studio

# Automation Concepts

Before building your first automation, it's important to understand the core concepts that power Agent Studio's workflow engine.

## Nodes (Components)

Nodes are the building blocks of automations. Each node performs a specific function and can be connected to other nodes to create a workflow.

### Node Categories

| Category       | Purpose                                       | Examples                                 |
| -------------- | --------------------------------------------- | ---------------------------------------- |
| **Triggers**   | Start the automation when an event occurs     | Account Segment, Task Created, Scheduler |
| **Processing** | Transform, filter, or combine data            | Create Data, Update Data, Filter Data    |
| **Logic**      | Route data based on conditions                | If-Else, Condition                       |
| **Actions**    | Perform operations like sending notifications | Send Email, Slack Message, Create Task   |
| **AI**         | Use LLMs for intelligent processing           | Agent, LLM, Structured Output            |

## Data Flow

Data flows through your automation from node to node via connections. Each node receives data from its inputs, processes it, and passes results to connected outputs.

### The Data Object

All data in Agent Studio flows as **Data objects** - structured containers with key-value pairs:

```json theme={null}
{
  "account_id": "acc_123",
  "account_name": "Acme Corp",
  "health_score": 75,
  "renewal_date": "2024-06-15"
}
```

### Accessing Data with @ Notation

When configuring nodes, you can reference values from incoming data using the `@` notation:

| Syntax        | Description                   | Example                       |
| ------------- | ----------------------------- | ----------------------------- |
| `@key`        | Access a top-level key        | `@account_name` → "Acme Corp" |
| `@key.nested` | Access nested values          | `@account.owner.email`        |
| `@`           | Access the entire data object | Full data dictionary          |

**Example:** In an email node, you might set the subject to:

```
Health Alert: @account_name score dropped to @health_score
```

## Connections

Connections define how data flows between nodes. To connect two nodes:

1. Click on a node's **output handle** (right side)
2. Drag to another node's **input handle** (left side)
3. Release to create the connection

### Connection Rules

* Every automation must start with exactly one **Trigger** node
* Nodes can have multiple inputs and outputs
* Logic nodes (If-Else, Condition) have separate **True** and **False** outputs
* Actions always execute when reached, even if not connected to downstream nodes

## Flow Context

When a trigger fires, it establishes a **Flow Context** that provides entity information throughout the automation:

| Context Field | Description                             |
| ------------- | --------------------------------------- |
| `account_id`  | The account associated with the trigger |
| `account`     | Full account data object                |
| `task_id`     | The task (if applicable)                |
| `task`        | Full task data object                   |
| `user_id`     | The user/contact (if applicable)        |
| `activity_id` | The activity (if applicable)            |

This context is automatically available to all downstream nodes, allowing you to access related entity data without explicitly passing it.

## Execution Model

### Node Execution

When a flow runs:

1. The trigger node executes first, loading entity data
2. Connected nodes execute in order, following the data flow
3. Each node processes its inputs and produces outputs
4. **Important:** Action nodes always execute their side effects (emails, API calls, etc.) even if their outputs aren't connected to anything

### Conditional Routing

Logic nodes like **If-Else** and **Condition** split the flow into multiple paths:

```
         ┌─── True Path ──→ Send Alert
Condition ─┤
         └─── False Path ─→ Log Only
```

Only the matching path executes based on the condition evaluation.

### Error Handling

If a node fails during execution:

* The error is logged with details
* Downstream nodes on that path do not execute
* Other parallel paths continue normally
* The flow status reflects the failure

## Organizing Automations

### Folders

Automations can be organized into folders to keep your workspace tidy. Create folders for teams, use cases, or lifecycle stages.

### Global All-Flows View

The **All Flows** view in the Automations tab shows every automation across all folders in a single list. This is useful for:

* Getting a bird's-eye view of all active automations
* Quickly finding a flow without navigating folder by folder
* Reviewing execution status across your entire automation library
* Sorting and filtering across all flows at once

Access it by clicking **All Flows** in the automations sidebar.

***

## Best Practices

<Accordion title="Start simple, then add complexity">
  Begin with a basic trigger → action flow. Once working, add processing and logic nodes incrementally.
</Accordion>

<Accordion title="Test nodes individually">
  Use the play button on each node to test it in isolation before running the full flow.
</Accordion>

<Accordion title="Use meaningful names">
  Rename nodes to describe their purpose (e.g., "Check Health Score" instead of "Condition V2").
</Accordion>

<Accordion title="Document with comments">
  Add description fields to complex nodes explaining their purpose and configuration.
</Accordion>

<Accordion title="Handle edge cases">
  Consider what happens with missing data, empty lists, or unexpected values. Use conditions to handle these cases gracefully.
</Accordion>

## Next Steps

<CardGroup cols={2}>
  <Card title="Build Your First Automation" icon="play" href="/agent-studio/automations/getting-started">
    Follow a step-by-step tutorial
  </Card>

  <Card title="Explore Triggers" icon="bolt" href="/agent-studio/automations/triggers">
    Learn about available trigger types
  </Card>
</CardGroup>
