Chain β Batched Sub-Actions
Android Supported iOS Supported
chain runs an ordered list of sub-actions in a single tool call, settling
between each one. Itβs the agent-loop cousin of run_flow:
where run_flow batches an MCP round-trip, chain lets the agent collapse a
short βdo this, then this, then thisβ into one step without re-reading the
screen between every action.
Each sub-action is {"tool": "<name>", "args": {...}}:
chain({"actions": [ {"tool": "launch_app", "args": {"package": "com.android.settings"}}, {"tool": "find_on_screen", "args": {"text": "Wi-Fi"}}, {"tool": "tap", "args": {"x": 540, "y": 300}}]})Settle between actions
Section titled βSettle between actionsβThe settle param controls the pause between sub-actions:
"stabilize"(default) β a fixed 0.6 s settle so the UI can catch up."delay"β sleepdelay_ms(default 600 ms, capped at 3 s).
No settle runs after the final action.
Fail-fast, fail-closed
Section titled βFail-fast, fail-closedβ- Max 15 actions per chain; a longer batch is refused.
- The whole batch is validated before anything runs. Every sub-actionβs
tool must be in the safe-tool allow-list (
SAFE_DEVICE_TOOLS) β if any step names a disallowed tool, the entire chain is refused and nothing executes. A chain canβt hide a privileged call after a few benign steps. - Chains canβt nest (a step naming
chainis refused). - At runtime, the first sub-action that raises aborts the rest of the chain and reports how far it got.
Not chainable itself
Section titled βNot chainable itselfβchain is a meta-executor, so itβs EXEC_CAPABLE, not SAFE β it canβt be
smuggled inside a run_flow or another chain. Its own children stay
restricted to the safe allow-list, so higher-privilege tools (like
sub_agent) can never run inside a chain.
Related
Section titled βRelatedβ- Run Flow β the MCP-level batch primitive
- Screenshot Sequence β chainable frame burst