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

# Choosing AI steps

> When to use AI Respond, AI Think, AI Plan & Execute, AI Agent, approvals, branches, and loops.

Agent Builder gives you several AI step types because each one has a different job in the flow. The main choice is whether a step should **reply**, **reason privately**, **call tools**, **delegate**, **pause for a person**, or **choose a path**.

Use this guide when you know what the agent should do, but you are deciding which step belongs on the canvas.

## Quick chooser

| If the step should...                                                                     | Use                        |
| ----------------------------------------------------------------------------------------- | -------------------------- |
| Send the user a message or final answer                                                   | **AI Respond**             |
| Analyze, classify, extract, or prepare context for later steps without messaging the user | **AI Think**               |
| Work through a goal and call tools in the same step                                       | **AI Plan & Execute**      |
| Hand work to another saved agent                                                          | **AI Agent**               |
| Ask the user for missing information or corrections                                       | **AI Wait for User Input** |
| Ask a person to approve or reject a proposed action                                       | **AI Approval**            |
| Choose a path using judgment over messy input                                             | **AI Branch**              |
| Choose a path using fixed rules                                                           | **Rule-Based Decision**    |
| Repeat while a condition stays true                                                       | **AI While**               |
| Repeat once per item in a list                                                            | **AI For Each**            |
| Run a specific connected-system action                                                    | **By Connector action**    |

## AI Respond vs AI Think

These two are the most common pair.

| Step           | What it is for                                                                                                             | What to avoid                                                                                                             |
| -------------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **AI Respond** | User-facing replies: final summaries, explanations, status updates, and chat answers.                                      | Do not use it as a scratchpad for hidden lookup logic. If the user should not see the reasoning step, use AI Think first. |
| **AI Think**   | Private reasoning: lookup planning, classification, extraction, validation, ranking, or preparing structured handoff data. | Do not use it when the step's main job is to answer the user directly.                                                    |

Common pattern:

<Steps>
  <Step title="AI Think">
    Read the trigger input, inspect data, classify the request, or build a structured finding.
  </Step>

  <Step title="By Connector action">
    Run the deterministic tool call, such as a NetSuite query or an Erstan document action.
  </Step>

  <Step title="AI Respond">
    Explain the result to the user using the earlier step outputs.
  </Step>
</Steps>

<Tip>
  For final response steps, keep tool access off unless the response itself truly needs a fresh lookup. This makes the run easier to review.
</Tip>

## AI Plan & Execute vs separate steps

**AI Plan & Execute** is useful when one step should decide the plan, call tools, and produce an answer. It is compact and flexible.

Use it for:

* Low-risk research or analysis where the exact tool sequence can vary.
* A simple assistant that needs to search, inspect, and answer in one place.
* Early prototyping before you split the flow into more auditable steps.

Prefer separate **AI Think**, action, approval, and **AI Respond** steps for:

* NetSuite, accounting, finance, or ERP workflows.
* Any path that creates or updates records.
* Workflows that need human review before a write.
* Repeatable automations where each step should be easy to test and diagnose.

<Warning>
  For write-critical workflows, split the flow. Put lookup and drafting in read-only steps, add an approval gate, then run the write in a dedicated connector action or tool-enabled step.
</Warning>

## AI Agent

Use **AI Agent** when the step should delegate to another saved agent instead of doing the work inline.

Good uses:

* A workforce-style agent that routes work to specialist agents.
* A manager agent that asks a reporting agent, AP agent, or AR agent to handle a subtask.
* A reusable sub-process that already exists as its own agent.

Do not use AI Agent just to make a normal model call. Use **AI Think** or **AI Respond** when the logic belongs inside the current agent.

## Wait vs Approval

Both pause the run, but they mean different things.

| Step                       | Use when                                                                                     | User action                                                |
| -------------------------- | -------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| **AI Wait for User Input** | The agent needs more information, a correction, a file, or a decision with open-ended input. | The person replies with information and the run continues. |
| **AI Approval**            | The agent has a proposed action and needs a binary go/no-go gate.                            | The person approves or rejects.                            |

Examples:

* Use **AI Wait for User Input** when an invoice is missing a vendor name and the user needs to provide it.
* Use **AI Approval** when the agent has drafted a vendor bill and needs permission before creating it in NetSuite.

## Branching and routing

Use **AI Branch** when the path depends on judgment. For example, classify an incoming email as "collections", "vendor bill", "report request", or "other" based on messy message text.

Use **Rule-Based Decision** when the path is deterministic. For example, if `amount > 10000`, route to approval; otherwise continue.

| Need                                                    | Better step             |
| ------------------------------------------------------- | ----------------------- |
| Interpret a user's intent                               | **AI Branch**           |
| Route by exact field value, threshold, or boolean       | **Rule-Based Decision** |
| Explain why a path was chosen                           | **AI Branch**           |
| Guarantee the same condition always routes the same way | **Rule-Based Decision** |

## Loops

Use loops when the same work repeats.

| Step            | Use when                                                                           |
| --------------- | ---------------------------------------------------------------------------------- |
| **AI For Each** | You already have a list: invoices, vendors, customers, rows, files, or exceptions. |
| **AI While**    | The agent should keep going until a condition changes or a limit is reached.       |

For finance workflows, **AI For Each** is usually easier to review because each item is explicit. Keep loop limits tight so a bad input cannot create a runaway run.

## Connector actions vs tool-enabled AI steps

There are two ways to use tools in a builder flow.

| Approach                 | Best for                                                                                                                           |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| **By Connector action**  | A specific action you already know should run, such as create a document, load a file, post to Slack, or run a NetSuite operation. |
| **Tool-enabled AI step** | Cases where the AI needs to decide whether or how to call one of a small set of pinned tools.                                      |

For NetSuite work, the safest shape is usually:

1. **AI Think** to decide what needs to be looked up.
2. Read-only NetSuite tools or connector actions to fetch data.
3. **AI Respond** or **AI Wait for User Input** to review the draft result.
4. **AI Approval** before any write.
5. A dedicated write step for the approved NetSuite create or update.

## Common patterns

| Workflow                                | Recommended shape                                                                                                                  |
| --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| Chat assistant that answers questions   | **Chat Trigger -> AI Respond**                                                                                                     |
| Chat assistant with private lookup      | **Chat Trigger -> AI Think -> AI Respond**                                                                                         |
| Scheduled report                        | **Schedule Trigger -> AI Think -> By Connector read -> Create/Update Document -> End**                                             |
| Invoice or quote intake                 | **Email/Form Trigger -> Load File -> AI Think -> AI Wait for User Input if needed -> AI Approval -> NetSuite write -> AI Respond** |
| Collections prioritization              | **Schedule/Form Trigger -> NetSuite read -> Analyze Dataset -> AI Think -> Create Tasks -> AI Respond or End**                     |
| Manager agent delegating to specialists | **Trigger -> AI Branch -> AI Agent -> AI Respond**                                                                                 |

## Next steps

<CardGroup cols={2}>
  <Card title="The visual builder" icon="workflow" href="/agents/builder">
    Place these steps on the canvas and wire them together.
  </Card>

  <Card title="Step reference" icon="list" href="/agents/step-reference">
    See every trigger, AI step, action, and utility step.
  </Card>

  <Card title="Tools by connector" icon="plug" href="/tools/by-connector">
    Understand connector-backed action steps.
  </Card>

  <Card title="Approvals" icon="shield-check" href="/chat/approvals">
    Review write actions before they run.
  </Card>
</CardGroup>
