What changed in Cloudflare Agents SDK Pi 1.6 for tools that wait?
Cloudflare Agents SDK v0.34.0, released November 20, 2026, moves to Pi 1.6: tools park on signals while the Durable Object hibernates.
Key takeaways
- Cloudflare Agents SDK v0.34.0, released November 20, 2026, upgrades PiHarness to Pi 1.6.
- A Pi 1.6 tool can park on a signal or deadline, and harness.signal() wakes it.
- A beforeTool hook can park any tool call until a person approves it.
- The upgrade is one-way: Pi 1.5 cannot run a conversation that has run on Pi 1.6.
On this page
Cloudflare Agents SDK v0.34.0, released November 20, 2026, upgrades its PiHarness to Pi 1.6. The main change is that a tool can now pause until a person responds, a deadline passes or another session finishes, without keeping the Durable Object awake while it waits. Your code wakes the tool with the new harness.signal(), and a beforeTool hook can hold any tool call for approval [1].
What changed in Agents SDK v0.34.0 and Pi 1.6?
The release adds waiting tools and approval gates, plus session, MCP and error-handling changes. Pi is the agent harness behind PiHarness: it runs the agent loop, including the transcript, model calls, tools, retries and crash recovery, and the docs describe it as a "minimal, extensible agent harness" [2]. The table groups the changes listed in the changelog [1].
| Area | What is new in v0.34.0 |
|---|---|
| Waiting tools | A tool can park on a signal or deadline; harness.signal() wakes it |
| Subagents | submit() and continue() accept notify, so a parked tool wakes when another session settles |
| Approvals | A beforeTool hook can park a tool call before it runs |
| Sessions | harness.root(), sessions.create() and sessions.fork() accept init to seed history |
| Aborts | submit(input, { onAbort: "keep" }) keeps queued input when an answer is stopped |
| MCP | MCPAuthorizationRequiredError and reconnectMcpServer(id) |
| Errors | Generic 500 and WebSocket close 1011, customizable with onFetchError() |
| Models | FLUX.2 in ai.image() and ai.images(); claudeCode() defaults to claude-sonnet-5-5 |
Smaller fixes ship in the same release. Chat stop, clear, regenerate and resume now work across tabs and during recovery, and cancelled or replaced schedules, queue items and Task runs no longer rerun [1].
How do tools that wait work?
A waiting tool returns a park instead of a result. In the Pi harness docs the shape is { sleep: { signals, until } }, and Pi runs the tool again when one of the listed signals arrives or the until deadline passes [2]. While parked, the call holds no invocation, so the Durable Object can hibernate.
Signals are typed values. You define one with defineSignal({ name, version, schema }), and each wait listens on a key built from it, such as Answer.key("answer") [2]. The tool reads the value with api.readSignal() on each run. If the value is there, it returns output; if not, it parks. This sketch follows the ask_user pattern from the docs:
// Inside the tool's execute()
const answer = await api.readSignal(Answer, "answer", context);
if (answer !== undefined && "value" in answer) {
return { output: [{ type: "text", text: answer.value.text }] };
}
await showQuestion(api.taskId, args.question);
return { sleep: { signals: [Answer.key("answer")] } };
// Later, in the agent, when the person replies
await this.harness.signal(taskId, Answer, "answer", payload);harness.signal() returns delivered, or duplicate, invalid, closed or not_found when the value was not taken. It schedules the wake-up job before it hands the value to Pi, so a crash during the woken call is recovered [2]. The Pi Durable 1.6.0 changelog adds two useful rules: a value that arrives before its sleep is kept and wakes the sleep at once, and one key serves one wait [3].
A woken task can see why it woke. state.wake reports one of four reasons, time, expired, signal or tasks [3]. A tool may also define cancel(), which Pi runs when a parked call is aborted, so you can clean up the external work you started [2].
How do subagent waits and approval gates work?
Subagent waits use the same mechanism with a built-in signal. A parent tool creates a child session it owns, submits work with notify: { taskId, key }, and parks on Pi's SubmissionSettled signal under that key; because the parent owns the child, aborting the parent also stops the child [2]. The docs pass a requestId such as subagent:<taskId> so that a rerun of the parent does not submit the same work twice.
Approval gates sit one step earlier. PiHarness has no built-in approval step, so you hold a call with a beforeTool hook that parks it before it runs, and you deliver the person's answer with harness.signal() [2]. In Pi Durable, a beforeTool hook may return { sleep: { until?, signals? } } to park the call [3].
The hook must be idempotent. Pi runs it again each time it reopens, and the docs suggest the same pattern for rate limits and budgets as well as approvals [2]. Pi Durable 1.6.0 ships examples 38 to 46 for these patterns, including asking a person, webhook waits, polling, waiting subagents and approval gates [3].
What does this mean for teams running AI agents?
The practical change is that an agent can wait for a person in the middle of a tool call without staying awake. A tool can park on a signal with no deadline, which leaves nothing due, so the object can hibernate until the person answers [2].
That matters for the work teams most often hand to agents with a person in the loop: a refund that needs a manager, a deploy that needs a reviewer, or a research task that waits for a subagent. The approval lives in the harness rather than in the prompt, so a model cannot talk its way past a parked beforeTool gate; the call does not run until your code delivers the signal. If your team already routes agent requests into shared channels, a parked tool is the point where that request should appear and where the reply should come back through harness.signal().
The other changes help long-running agents stay usable. When an MCP server needs the user to sign in again, callTool(), readResource() and getPrompt() throw MCPAuthorizationRequiredError, which exposes error.authUrl to send the user to [4]. reconnectMcpServer(id) clears a recorded failure and connects at once, while calling addMcpServer() on a failed server throws the recorded error instead of retrying [4].
How do you upgrade to Pi 1.6?
Upgrade forward only. Once a conversation runs on Pi 1.6, Pi 1.5 cannot run its tool calls or model requests, so plan to roll forward rather than back [1]. Pi Durable 1.6.0 raises the pi.tool schema to version 4 and pi.generation to version 3, and an older harness blocks such tasks with task_too_old [3].
The changelog lists these code changes [1]:
- Replace
(await harness.pi()).signal()withharness.signal(). - Call
harness.root()before you reach the root session throughharness.pi(); the root session is now created on first use. - If you use Pi Durable directly, rename
RunEndTasktoHookTask, and take code mode namespaces fromExtension.namespace. - Catch
MCPAuthorizationRequiredErrorand direct users toerror.authUrl. - Implement
onFetchError()if you relied on error details in failed responses.
Two type changes can break wrappers and tests. A tool's execute() now returns Promise<ToolExecutionResult | ToolPark>, so code that calls execute() directly must handle parks, and until is now optional on sleeping task states [3]. An invalid park ends the call with an invalid_park result.
For error handling, failed requests now return a generic 500 with "Internal Server Error", and failed WebSocket upgrades close with code 1011 [5]. onFetchError(request, error) runs after the error is logged; return a Response to send it, or nothing to keep the default [5].
What are the limits and open questions?
Pi Durable is experimental, and its API can change in minor releases [2]. Build on parked tools, but pin versions and read each changelog before you upgrade.
The docs give no maximum wait for a parked tool and no maximum number of parked tools. Wake-up jobs run in alarm invocations of up to 15 minutes, the harness hands off to a new alarm every 10 minutes, and a heartbeat alarm fires every 30 seconds while Pi has work [2]. Crashes are bounded too: Pi ends a task interrupted settings.restartLimit times in a row, 5 by default [2].
Cost is the main open question. The docs do not describe pricing for parked tools, alarms or the storage they use, so measure Durable Object usage on your own workload before you rely on long waits. The beforeTool hook's exact signature is also documented in the Pi Durable changelog rather than on the Cloudflare page, so check both when you write your first gate [3].
Frequently asked questions
What is a parked tool in the Cloudflare Agents SDK?
It is a Pi tool that returns a sleep result listing signals and an optional deadline instead of output. Pi reruns it when a signal arrives or the deadline passes, and the Durable Object can hibernate in between.
How do you send a person's answer to a waiting tool?
Call harness.signal() with the task id, the signal definition, the key and the payload. It returns delivered, or duplicate, invalid, closed or not_found when the value was not taken.
Does PiHarness have a built-in approval step?
No. You add approvals with a beforeTool hook that parks the tool call before it runs, then deliver the decision with harness.signal(). The hook reruns whenever Pi reopens, so it must be idempotent.
Can you roll back from Pi 1.6 to Pi 1.5?
Not for conversations that already ran on Pi 1.6, because Pi 1.5 cannot run their tool calls or model requests. Cloudflare's changelog says to roll forward rather than back.