The AI Task node uses natural language instructions to perform actions inside a real browser. It is the most flexible node type and is ideal for handling dynamic UI, multi-step interactions, and workflows that benefit from LLM reasoning. Common actions include:Documentation Index
Fetch the complete documentation index at: https://docs.asteroid.ai/llms.txt
Use this file to discover all available pages before exploring further.
Navigate
Navigate to and through pages
Fill forms
Enter and submit structured data
Use files
Read, upload, or download files
Extract data
Scrape data from a webpage
Configuration
Instructions
The core of an AI Task node is a natural language instruction block. You describe what the agent should do, and the LLM executes those steps in the browser.Recommended Structure
To achieve the most reliable behavior, structure your instructions with:- Goal: What the node is trying to accomplish
- Ordered steps: A sequence of specific actions
- Edge cases: Known variations the agent must handle
- Success criteria: Observable conditions indicating completion
Dynamic Variables
Dynamic variables make your instructions reusable across multiple runs with different inputs. Variables are passed at execution time and referenced with the{{.var_name}} syntax.
Example:
Naming Rules
Variable names must:- Start with a letter or underscore
- Contain only letters, numbers, and underscores
- Not include special characters such as
@,-,., or spaces
{{.user_name}}, {{.email}}, {{.api_key}}
Invalid: {{.user-name}}, {{.my@var}}, {{.1st_item}}
Advanced Templating
AI Task instructions support full Go Template syntax, enabling conditionals, loops, and structured data.Advanced: Conditionals
Advanced: Conditionals
Use The corresponding variable values should be:
if statements to conditionally adjust behavior:Advanced: Loops
Advanced: Loops
Iterate through lists or arrays.Simple array:Array of objects:The corresponding variable values should be:Via SDK, you’d pass:
Inside a
range, {{.}} refers to the current item.
For objects, use fields like {{.name}} and {{.price}}.Advanced: Nested Data
Advanced: Nested Data
Access nested JSON structures:The corresponding variable values should be:
Model Selection
Choose the model that best fits the complexity of the task:Asteroid Fast
Lowest latency. Best for simple, fast interactions.
Asteroid Balanced
Default model. Balanced speed and accuracy.
Asteroid Max
Highest intelligence and reasoning depth for complex flows.
Script
By default an AI Task node runs fully agentically — the model picks tool calls turn by turn using theInstructions below. To make a node run a pre-approved Playwright script first, set its Script field. The presence of a script will make the node attempt to run the script before any LLM involvement.
In the graph editor, the Script field sits at the top of the node’s Instructions tab. Selecting a .js file from the node’s shared directory turns the node into a scripted node and reveals a small “If the script fails” picker beside it. Removing the script returns the node to fully agentic behaviour.
In API or YAML exports, the same switch is the script_filepath field on the AI Task node — a node is scripted iff script_filepath is set.
Agent filesystem
Read how
shared/ keeps files across runs for the same agentIf the script fails
When a script is selected, the node exposes a failure-behaviour picker.Fall back to AI
The script’s output (or failure context) is attached to the LLM turn and the AI agent recovers and continues the task using the
Instructions.Cancel
The execution is cancelled immediately with reason
script_failed. No LLM fallback. Also fires when the referenced script is missing on disk.Where scripts live
Scripts live under the agent’s persistentshared/ tree (see Agent filesystem). The runtime resolves script_filepath relative to the node’s own shared directory:
<node-slug>is derived from the node’s display name (lowercased, punctuation stripped) and is added automatically by the runtime — authors never encode it, so renaming a node never breaks the path.script_filepathitself is the part you author. Typical values:scripts/find_patient.js,scripts/login.js,scripts/submit_order.js.- Name the file after the action it performs in
lower_snake_case. The directory already groups by node — the filename should communicate what the script does. Avoid generic names likescripts/main.jsorscripts/index.js.
script_filepath: scripts/find_patient.js resolves on disk in the sandbox to /home/agent/shared/find_patient/scripts/find_patient.js.
Placeholders inside the script
Inside the.js script file itself, two substitution systems run before the script executes:
__PLACEHOLDER__— Double underscores around anUPPER_SNAKE_CASEname (e.g.__PATIENT_NAME__). Before the script runs, a lightweight LLM pass reads the script plus the node’s Instructions and execution data, then produces a{NAME: value}map. The runtime substitutes those values into the script text before handing it to Playwright. If the substitution call cannot resolve every placeholder, the node falls back to the LLM (or cancels underfreeze: true) — the script is never executed with literal__VAR__strings.##CREDENTIAL##— Vault secrets, substituted at the tool boundary from the credential store (see Agent profiles). Separate from__PLACEHOLDER__resolution and never passed through the LLM.
Runtime behaviour
The stored script runs against the live browser session (the same browser the LLM would have used). Then:- If a selector transition matches immediately after the script (eagerly checked), the runtime takes it and skips the LLM. Fast.
- If the script succeeded and the node has exactly one outbound transition, the runtime takes it directly. No LLM. Fast.
- Otherwise, the runtime invokes the LLM with the script’s output added as context — the agent decides what to do next (pick among multiple transitions, recover from a partial failure, etc).
module.exports:
- Object (e.g.
return { patient_id: id }) — each top-level key becomes an output variable available to downstream nodes’# Execution Data. - String — wrapped under a single
script_outputvariable. - Throw — treated as a failure; behaviour then depends on
freeze.
AI Capabilities
Enable specific capabilities depending on what the node needs to perform:Web Browsing Essentials
Basic navigation, clicking, typing, and interaction
Advanced Web Browsing
Complex navigation, dynamic UIs, and robust action handling
Computer Vision
Visual understanding of the page and image-based interaction
Communication
Exchange messages and emails with the user during execution
File System
Upload, download, read, and write files
Memory & Storage
Store and retrieve data across execution steps
Google Sheets
Read from and write to Google Sheets
Authentication
Generate and manage authentication tokens
Context & Utilities
Access contextual data and system utilities
Explore all available features in AI Capabilities.
Transitions and Failure Handling
API / YAML Reference
When configuring an AI Task node via the API, SDK, or MCP, use the following type identifier:| Field | Value |
|---|---|
| Node type | ai |
| Transition types | ai, selector |
| Optional | script_filepath: relative .js path inside the node’s shared directory that turns the node into a fast-path scripted node (see rules below). freeze: when true, script failure (or a missing script file) cancels the execution instead of falling back to the LLM. Only meaningful with script_filepath. |
settings.yaml):
instructions.md file in the same directory. The Playwright script referenced by script_filepath lives in the agent’s shared directory at shared/<node-slug>/<script_filepath> and is shipped to the sandbox at execution time.

