contents
Handing work to another agent
Start a worker, wait for it to be ready, then send a task and read the reply. This example needs Claude Code and jq installed:
TAB=$(ship tab create --name workers | jq -r .id)WORKER=$(ship pane create --tab "$TAB" --name worker -- claude | jq -r .id)ship pane wait --pane "$WORKER" # until it's readyship pane send --pane "$WORKER" "Write a haiku about ships" --key enter --wait \ | jq -r '.program[""].state'ship pane read --pane "$WORKER" --lines 40--wait prints the pane when the agent reports done, idle, blocked or error, and the jq line above picks out which one. Read it before assuming success. done or idle means it's ready, blocked means it needs an answer, and error means something went wrong.
To answer a prompt, send the keys and say you expect it to be blocked:
ship pane send --pane "$WORKER" --key down --key enter --wait --if blocked--if idle,done only sends if the agent is in one of those states, so you don't type into an agent that's still busy.
Use --status to choose which outcomes end a wait:
ship pane wait --pane "$WORKER" --status done,blocked,errorProcess exit is a separate outcome, so add exited to --status if that should end the wait too, and create the pane with --exit-behavior keep if you want to look at it afterward. send --wait accepts --status as well.
If a send stalls
Section titled “If a send stalls”After sending to an agent that isn't working, send --wait gives it five seconds to report a changed state, and if it doesn't, the command fails even though the input was sent. Read the pane or use pane wait, and don't send the task again just because the wait failed. Command errors shows how to tell whether input went out.
Once the state changes, there's no deadline for the agent to finish, and plain pane wait has none either. To limit a wait, put timeout 600 in front of the command (gtimeout on macOS, from coreutils). That doesn't extend the initial five-second check.
Waiting uses program status reports, not text on screen. For a program that doesn't report status, use plain send and read, or wait for its process to exit.