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

# Building Flows

> Create multi-step browser automation workflows using the visual instruction editor

Agents are built using a visual instruction editor. The editor presents a canvas where you compose a sequence of instructions that the agent follows step by step.

***

## Instruction Types

| Instruction            | Description                                                                    |
| ---------------------- | ------------------------------------------------------------------------------ |
| **Visit URL**          | Navigate the browser to a specific address                                     |
| **Click Element**      | Click on a page element identified by a selector                               |
| **Type Input**         | Type text into a form field                                                    |
| **Upload File**        | Upload a file to a designated element                                          |
| **Download File**      | Download a file from a URL                                                     |
| **Enter Iframe**       | Switch the agent's context into an embedded iframe                             |
| **Take Screenshot**    | Capture a screenshot of the current page                                       |
| **Wait for Element**   | Pause until a specific element appears on the page                             |
| **Wait for URL**       | Pause until the browser URL contains a specific pattern                        |
| **Solve CAPTCHA**      | Attempt to solve a CAPTCHA challenge                                           |
| **AI Instruction**     | Give the agent a natural-language instruction and let AI determine the actions |
| **Run JavaScript**     | Execute custom JavaScript code in the browser                                  |
| **Fetch OTP**          | Retrieve a one-time password from a configured source                          |
| **Loop Over Data**     | Iterate over a data array, executing child instructions for each item          |
| **Conditional Branch** | Evaluate a condition and follow the TRUE or FALSE path                         |
| **Terminate**          | End the agent's execution                                                      |

***

## Element Selection

When an instruction targets a page element, the agent identifies it using one of these methods:

| Method                | Description                     |
| --------------------- | ------------------------------- |
| **CSS Selector**      | Standard CSS selector syntax    |
| **XPath**             | XPath expression                |
| **ID**                | Element's HTML ID attribute     |
| **Class Name**        | Element's CSS class             |
| **Tag Name**          | HTML tag name                   |
| **Link Text**         | Full text of a hyperlink        |
| **Partial Link Text** | Partial match on hyperlink text |
| **Text Containing**   | Match by text content           |

***

## How Agents Are Triggered

| Method                | Description                                                                                   |
| --------------------- | --------------------------------------------------------------------------------------------- |
| **Automation Action** | The "Run AI Agent" automation action triggers execution with application context              |
| **Form Step**         | An "AI Agent" step in a hiring flow triggers the agent when the candidate reaches it          |
| **Manual Trigger**    | Admins can trigger an agent directly, selecting a hiring flow and the applications to process |
| **Test**              | Run the agent from the editor with streaming output and debug mode                            |

***

## Testing

The test interface allows you to run the agent with:

* **Streaming mode** — Watch the execution output in real-time
* **Debug mode** — Verbose logging for troubleshooting
* **Input variable values** — Provide text or file values for each input
* **Loop data** — For agents with loop instructions, provide the data array

***

## Execution History

Every agent execution creates a record that tracks:

* Execution status and timing
* Input data provided
* Output data captured
* Detailed execution logs
