How it worksScripts

Updated 28 Oct 2026View as Markdown

Scripts

A script holds an agent to an order of phases, each with a gate it must pass. Most agents don't need one.

MCP serverSDK and APIYour own cloud:AWSGCPAzureor hosted by MindsetMindset platformAgentScriptVersionRunConnectionOperationFunctionWidgetSecurity and complianceone posture · audit trail · personal data redactionBuilderscoding agentOperatorsAI clientor the StudioYour appthe SDKYour serverthe APIThe Huband schedulesBuilderscoding agentOperatorsAI client or the StudioMCP serverYour own cloud:AWSGCPAzureor hosted by MindsetMindset platformAgentScriptFunctionConnectionOperationWidgetVersionRunSecurity and complianceone posture for the org,audit trail and personal data redactionSDK and APIYour appthe SDKYour serverthe APIThe Huband schedules

A script splits an agent's work into phases. It belongs to the agent and is saved in the agent's version, with no publish step of its own.

Add one only for an instruction the agent must not be able to skip: wait for a person's answer, don't move on until something is true, or don't reach a tool before an earlier step is done. A prompt can't make an agent wait.

Why it matters#

Mindset checks each gate after every turn, so the order holds whatever the model decides, and a write held for a later phase can't run early.

Phases and gates#

Each phase has its own instructions and resources, the values it must collect, and a gate: the condition that moves the run on. A gate either checks the collected values or asks a model, which passes only a clear yes. A phase that lists its resources offers only those.

Put a phase boundary only where the conversation must wait. "Collect the supplier, the invoice number and the amount" is one phase. "Confirm the total before you continue" is a boundary.

A script can't repeat an action for every item in a list. Use a function for that.

Who the session is for#

A gate, a step or a phase's instructions can read the labels your backend set on the session, as attribution.<key>. A gate on attribution.plan routes an enterprise customer one way and everyone else another, and the model can't change a label, so the route holds whatever anyone types. A session without the label reads nothing there, so give that case a route of its own.

Asking a person#

A phase can stop to put a decision to a person. The run parks, spending nothing, until someone answers or the wait the author set runs out, then carries on with the answer. It's the only way to put a person's yes or no in front of one particular action.

Live demoGuided intake · Harbour InsuranceA home insurance claim runs through fixed phases, moving on only when each gate passes.

The invoice exceptions agent#

Its script has four phases: Gather, Assess, Prepare and Close. Only Prepare holds the register_supplier_query write, so the agent can't register a query before the comparison and the contract check.

To write one, see Make it follow steps.