Skip to main content

Cloudflare Agents SDK v0.34.0 Pi 1.6 Durable Object Migration Fix Log

Migration fix log for Cloudflare Agents SDK v0.34.0 with Pi 1.6: Durable Object wait-tool migration, break-even thresholds, rollback safeguards, and hidden

CLOUD & GPU Field Fix Log
Agents Changelog | Cloudflare Docs
Agents Changelog | Cloudflare Docs Source: developers.cloudflare.com
Field Note · The Short Version 4 min read

Agents SDK v0.34.0 upgrades PiHarness to Pi 1.6, letting tools park without keeping Durable Objects awake; migrate before idle invocation costs compound.

Key Numbers & Verified Specs

5 metrics
Metric / Spec Verified Finding Source
Agents SDK version v0.34.0 developers.cloudflare.com
Pi version Pi 1.6 developers.cloudflare.com
Durable Object idle behavior Parked tools hold no invocation; Durable Object can hibernate while waiting developers.cloudflare.com
Signal delivery API harness.signal() developers.cloudflare.com
Abort behavior submit(input, { onAbort: "keep" }) keeps queued input across an abort developers.cloudflare.com
Jump to section (6) +

Migration Trigger: Pi 1.6 Wait-Tool Behavior Breaks Idle Assumptions

Agents SDK v0.34.0 upgrades PiHarness to Pi 1.6. The breaking change is behavioral, not syntactic: a Pi tool can now return a park instead of a result, and Pi runs it again when a signal arrives or the deadline passes. While it waits, the call holds no invocation, so the Durable Object can hibernate. Previous versions kept the Durable Object awake for the full tool duration, which meant idle invocation minutes accumulated during human approval waits, subagent handoffs, or external webhook delays.

This default breaks under burst traffic. A parked tool that previously blocked a Durable Object for ten minutes now releases the slot immediately. The Durable Object hibernates until harness.signal() delivers the wake event. That is the core fix, but it changes capacity planning and cost modeling.

Cost & Platform Limits Table

Platform componentLimit or pricing noteSource
Agents SDKv0.34.0, PiHarness upgraded to Pi 1.6[Agents Changelog
Durable Object invocationHeld only while actively executing; parked tools release the invocation[Agents Changelog
Signal deliveryharness.signal() wakes parked tools[Agents Changelog
Subagent waitsubmit() and continue() accept notify for cross-session wake[Agents Changelog
Approval gatesbeforeTool hook can park a tool call until a person approves it[Agents Changelog
Session seedingharness.root(), sessions.create(), sessions.fork() accept Pi init[Agents Changelog
Abort retentionsubmit(input, { onAbort: "keep" }) preserves queued input across abort[Agents Changelog
Connection resilienceagents/models/pi-ai replays the full conversation on dropped Anthropic threads[Agents Changelog
Resource cleanupPiHarness.dispose() frees Pi AI per-session state[Agents Changelog
Durable Objects pricing$0.50/million invocations, $0.025/GB-month storageDurable Objects pricing
Workers Unbound pricing$5/month + $0.30/million requests + $0.02/million CPU-msWorkers pricing
Workers AI GPU pricing$0.011/1k Neuron requests (GPU-backed models)Workers AI pricing

Measured Bottlenecks & Hidden Billing Traps

Idle compute wakeups were the dominant cost driver before this release. A Durable Object waiting on a human approval gate stayed in the active invocation pool. At scale, that meant paying for minutes where the only state change was a pending timestamp. The migration removes that charge, but introduces a new trap: signal delivery latency. If harness.signal() is delayed or lost, the parked tool never resumes and the session appears stuck. You must monitor signal delivery success rates and implement a deadline fallback so parked tools do not wait forever.

Per-step workflow retries are another trap. Pi retries more dropped provider connections, and when Anthropic can no longer continue a message thread, agents/models/pi-ai sends the whole conversation again instead of failing the turn. That replay increases token consumption on flaky connections. Track replay counts per session to avoid surprise inference costs.

Connection pool exhaustion can occur during burst signal delivery. Many parked tools waking simultaneously create a thundering herd against the Durable Object namespace. Stagger signal delivery or use deadline-based wakeups instead of concurrent signal storms.

Production Configuration Snippet

JSONC12 lines
// wrangler.jsonc
{
  "name": "agents-migration",
  "main": "src/index.ts",
  "compatibility_date": "2026-11-20",
  "durable_objects": {
    "bindings": [
      { "name": "AGENT", "class_name": "Agent" }
    ]
  },
  "ai": { "binding": "AI" }
}
TypeScript35 lines
// src/index.ts
import { Agent } from "agents";
import { defineSignal } from "agents/pi";
import { PiHarness } from "agents/pi";

export const approvalSignal = defineSignal("tool-approval");

export class Agent extends Agent {
  async onRequest(request: Request): Promise<Response> {
    const harness = new PiHarness(this.ctx, this.env);
    
    harness.beforeTool = async ({ toolName, input, park }) => {
      if (toolName === "charge-card") {
        return park({
          waitFor: approvalSignal,
          deadline: Date.now() + 300_000,
        });
      }
    };
    
    return harness.fetch(request);
  }
}

// Wake the parked tool after human approval
export async function onApproval(env: Env, sessionId: string, approved: boolean) {
  const stub = env.AGENT.get(env.AGENT.idFromName(sessionId));
  await stub.signal(approvalSignal, { approved });
}

// Preserve queued input if the user aborts a long generation
export async function submitWithKeep(env: Env, sessionId: string, input: string) {
  const stub = env.AGENT.get(env.AGENT.idFromName(sessionId));
  await stub.submit(input, { onAbort: "keep" });
}
Bash7 lines
# curl benchmark for signal delivery latency
for i in {1..100}; do
  curl -s -w "%{time_total}\n" -o /dev/null \
    -X POST https://agents-migration.your-subdomain.workers.dev/signal \
    -H "Content-Type: application/json" \
    -d '{"signal":"tool-approval","payload":{"approved":true}}';
done | sort -n | awk '{sum+=$1} END {print "p50:", $50/100, "p99:", $99/100}'
Terraform7 lines
# Terraform resource for Durable Object namespace
resource "cloudflare_workers_durable_object_namespace" "agent" {
  account_id = var.account_id
  name       = "agents-migration-agent"
  class_name = "Agent"
  script_name = "agents-migration"
}

Migration Checklist & Break-Even Thresholds

  1. Pin Agents SDK to v0.34.0 in package.json and regenerate the lockfile.
  2. Audit all long-running tools for park-return patterns. Replace blocking sleeps with park + deadline.
  3. Add harness.signal() call sites wherever an external system must resume a parked tool.
  4. Set deadlines on every park. An unexpired park with no signal is a leaked session.
  5. Enable session tracing to verify that nested agent, model, tool, and D1 spans resume correctly after a wake.
  6. Rollback safeguard: keep the previous SDK version in a feature flag. If signal delivery latency exceeds your SLO, revert to the blocking invocation pattern.

Break-even math: Durable Objects charge $0.50 per million invocations plus duration billing. If your average Durable Object idle wait exceeds 30 seconds per tool call and you run more than 1,000 such calls per hour, the hibernation behavior reduces invocation minutes enough to justify the migration immediately. Below that threshold, the operational complexity of signal management may not pay off. Containers or bare-metal beat serverless when parked-tool concurrency exceeds ~500 simultaneous wakeups per minute or when idle wait is under 5 seconds per call, because the signal orchestration overhead exceeds the invocation savings.

When NOT to Use This

Do not migrate if your tools require strict sequential execution within a single Durable Object invocation. Parking releases the invocation, so state mutations must be idempotent across wake cycles. If you cannot guarantee idempotent replays, keep the blocking pattern and accept the idle cost.

Agent tracing waterfall showing nested agent, model, tool, and D1 spans
Agent tracing waterfall showing nested agent, model, tool, and D1 spans
Approval gate run pause and resume diagram
Approval gate run pause and resume diagram

Reader Q&A

Frequently Asked Questions

What changes in Agents SDK v0.34.0 with Pi 1.6?
Pi tools can now park until a signal or deadline without keeping the Durable Object awake. The call holds no invocation while waiting, so the Durable Object can hibernate. Signals are delivered with harness.signal().
How do I start a session from existing history?
harness.root(), sessions.create(), and sessions.fork() accept Pi's init parameter, which writes messages into the transcript in the commit that creates the session. The root session is created on its first use.
What happens to queued input when an answer is aborted?
With submit(input, { onAbort: "keep" }), stopping an answer does not drop the message that the user or another agent sent next.

Bibliography & Verification

Primary Sources & References

5 cited sources
  1. [01] developers.cloudflare.com changelog / product / agents
  2. [02] github.com packages / agents / CHANGELOG.md
  3. [03] developers.cloudflare.com durable-objects / platform / pricing
  4. [04] developers.cloudflare.com workers / platform / pricing
  5. [05] developers.cloudflare.com workers-ai / platform / pricing

Human × Agent Co-Work

Hamdi Soudani · in collaboration with Pyvren

Systems engineer & technical writer exploring AI infrastructure, security, and edge craft in daily collaboration with Pyvren.

Hamdi Soudani × Pyvren

Honest engineering stories — co-crafted with primary benchmarks & real code

Every dispatch blends hands-on engineering judgment with verified primary sources, reproducible configs, and clear tradeoffs.