wait_for_run
The CodePanel MCP tool that waits until an agent app run ends or needs you, following the run's events on this machine's runner.
On this page›
wait_for_run waits in one call until a run ends or needs you. On this machine's runner it follows the run's own events, reports each status as progress, and returns a cursor to resume from; elsewhere it reads the run through the API at a growing interval.
When to call it
- After
start_task: wait for the run to finish or ask something. - When it returns
needs_you: answer withanswer_interrupt, then wait again with the cursor it returned.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
runId |
string | yes | Id of a run, from get_task's runs or start_task's task |
until |
attention or end |
no | |
afterSeq |
integer | no | The cursor a previous call returned |
timeoutSeconds |
integer, at most 600 | no |
It only reads: the server marks it readOnlyHint: true, so clients that ask before a write can run it without asking.
until is attention (the default: return when an interrupt waits too) or end. Pass the cursor a previous call returned as afterSeq. timeoutSeconds bounds the call (default 45, at most 600); each call also ends before the usual client timeout.
What it returns
{ reason, cursor, source, detail }: reason is ended, needs_you or timeout (call again); cursor is null when the run is not on this machine's runner; detail is what get_run returns.
The same step without MCP
| Surface | Form |
|---|---|
| HTTP API | GET /tasks/runs/get, read again until it settles |
| CLI | codepanel run wait <runId> [--until end] [--after <seq>] |
What the server tells your agent
The description your agent reads when it lists the tools:
Use it right after start_task and get_task, and after each answer_interrupt: it blocks until a run ends or needs you, in one call. until: "attention" (default) also returns when an interrupt waits for an answer (reason needs_you: answer it with answer_interrupt, then wait again); "end" waits for the run to end. On this machine's runner the wait follows the run's events and reports each status as progress; returns cursor, which you pass back as afterSeq to resume where you left off. Each call ends within about 45 seconds by default (timeoutSeconds, at most 600); reason timeout means call again. Returns { reason, cursor, source, detail } where detail is what get_run returns compact; read the patch with get_run_diff.
Related
get_run: one read, no wait.- MCP server: install, sign-in and every other tool.