wait_for
Block execution until monitored terminals finish, need input, or fail, instead of polling in a loop. Waits for one or all terminals, returning on a state change or timeout.
Instructions
Block until a terminal finishes, asks something or dies -- instead of polling.
This holds your conversation until it returns. From Claude Code, prefer a
background watch on GET /events (see the maestro skill) so the user can
keep talking to you; use this for scripts, or with a short timeout.
Returns as soon as one watched terminal reaches one of states
(default: completed, waiting_user_answer, error -- stuck is also
available), or when timeout_seconds runs out (max 900). With
require_all it waits for every watched terminal instead of the first.
terminal_ids defaults to the whole fleet. A terminal with a message
still queued counts as busy, not finished.
This is the loop to use while a fleet runs: wait, act on what came back (read its output, answer its question, restart it), wait again. Polling get_terminal_status in a loop costs a call and a turn every few seconds and tells you nothing in between.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "wait_for"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| states | No | ||
| require_all | No | ||
| terminal_ids | No | ||
| timeout_seconds | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||