Chinese
Uncategorized

Pi 1.5 Makes Durable Agent Runs an Operations Problem

Cloudflare’s Agents SDK v0.33.0 moves to Pi 1.5, reducing streaming writes and improving throughput. Durability still needs an operations plan.

Jacky Wang 4 min read 51 views

When I run long jobs on Kubernetes, I usually worry about state before I worry about the model. How often are streamed outputs written? What happens after a restart? Can a small SQLite deployment keep up with frequent commits? Cloudflare’s Agents SDK v0.33.0, released on November 3, 2026, moves PiHarness to Pi 1.5 and puts those operational questions in plain view.

The official changelog is unusually concrete. Pi now batches streamed answers and tool output, writing within about a second instead of on every update. In a SQLite benchmark, Cloudflare reports roughly 27x fewer storage transactions for long answers, 5.7x fewer for turns with parallel tools, and about a quarter less CPU. In a 2,048-session SQLite benchmark, one Pi harness went from 88 to 459 agent runs per second. Those are vendor benchmark figures, not a production SLA, so I would use them as a direction rather than a promise.

Lower write pressure is not the same as safe recovery

Batching changes the failure window. Suppose a tool request has reached an external system but the corresponding event has not been persisted yet. On resume, will the harness replay it? If it can replay, the tool needs an idempotency key. If it cannot, the application needs to expose an “unknown outcome” state instead of pretending the action never happened.

I would separate a turn into a few durable event types: input accepted, model output chunk, tool request sent, tool result confirmed, and user-visible checkpoint. Not every token needs permanent storage. Any action that changes an external system does need a reconstructable record. A basic table is enough to start:

CREATE TABLE agent_events (
  event_id TEXT PRIMARY KEY,
  session_id TEXT NOT NULL,
  turn_id TEXT NOT NULL,
  kind TEXT NOT NULL,
  payload_hash TEXT NOT NULL,
  created_at INTEGER NOT NULL
);

The trade-off is more application code and a little more storage design. The payoff is that “submitted but not confirmed” is distinguishable from “never sent”. I would also persist the request id used by the external service.

The upgrade boundary matters more than the benchmark

Cloudflare notes that sessions running on Pi 1.5 cannot be read by Pi 1.4. After upgrading, the recommended direction is to roll forward and fix deployment issues rather than roll back. That compatibility boundary matters more to me than the headline throughput.

Before an upgrade, I would inventory active sessions, take a backup, stop new work from entering the old path, and rehearse a recovery route. Callers also need changes: the changelog says to move from session.events() to session.watch() and remove retry() and the parked status. This is not a package replacement. The event subscription and control flow both need review.

A small smoke test should kill a streaming tool call halfway through and inspect the resumed session for duplicate side effects:

pnpm test --filter agents
pnpm run replay --session fixture-interrupted-tool-call

The commands are illustrative; the important test input is interruption. Pi 1.5 can make persistence more efficient, but recovery semantics still belong to the application.

Where I would use it

For a one-shot answer, a durable harness may be unnecessary. If an agent waits on an external API, spans several user turns, or must continue through a deploy or network interruption, Durable Objects, SQLite, and an event log become part of the product behaviour.

My expectation is that Pi 1.5 will make long-running agents easier to justify, while making the question “where should this run continue?” impossible to avoid. In the next upgrade I would test a process kill, a broken connection, and a repeated tool call before looking at throughput. During an incident, avoiding one duplicate payment is worth more than a few hundred extra runs per second.

I would also give retention its own design decision. Streamed text can be compacted or reduced to a summary, while tool inputs, result summaries, and external request ids should live longer. Otherwise a team may save database space by deleting exactly the evidence needed to explain an incident. For a small service, a clear event boundary is usually a better first step than a large event-sourcing platform. I would verify the compatibility note in the Cloudflare changelog, then compare it with the Agents SDK docs and the Pi Durable notes before upgrading.

The same rule applies to alerts. I would page on a growing queue of sessions waiting for recovery, not merely on CPU. A service can look healthy while every useful run is paused behind an unhandled state transition. That is the sort of operational detail a benchmark cannot reveal.

发表评论