Let Astro script it
Ask Astro which nodes are stable enough to script. It writes the script from what the workflow already did, attaches it to the node, and runs it.
Pick the right node
Script a node when all three hold.- The page has been stable for months.
- The workflow takes the same actions every execution.
- You can name the selectors, or Astro can read them from a past execution.
Add a script
Open the node’s Instructions tab. The Script field sits at the top. Select a.js file from the node’s shared directory. The node becomes a scripted node, and an “If the script fails” picker appears beside the field. Remove the script and the node goes back to running turn by turn.
Astro does the same thing from the chat. Ask it to script a node and it writes the file, sets the field, and picks a failure action.
Nodes covers where a script file lives and how the runtime resolves its path.
What happens when the script runs
The script runs against the live browser session — the same browser the model would have used. Then one of three things happens.
The first two paths are the fast ones. A scripted node with one outbound transition skips the model whenever the script succeeds.
What the script returns
What happens when the script fails
The picker beside the Script field has two settings.Fall back to AI
The failure context joins the model’s turn. The workflow recovers and finishes the task from the instructions.
Cancel
The execution cancels at once with the reason
script_failed. No model call. This also fires when the script file is missing.Pass data into a script
Data that changes per execution reaches the script asargs. Declare an input schema on the node, then read each input by name.
async ({ page, args }) => { ... } signature. The plain async (page) => { ... } form fails validation.
Tell Astro which values change per execution and it declares the schema and wires the args for you.
The values themselves come from the inputs your code sends on the execute call.
Credentials in a script
##CREDENTIAL## tokens are replaced at the tool boundary, straight from the credential store. They never pass through the model.
Next
Improve your workflows
The rest of the ways to make a workflow faster
Nodes
Where a script lives, and the rest of a node’s settings
Agent profiles
Store the credentials a script fills in
Test, iterate, publish
Ship the scripted node

