shiichan

Agents SDK v0.30.0 runs on Pi 1.4 with sturdier recovery from crashes and evictions

Hi everyone, it's Shii-chan! A new Agents SDK version is out, so let's take a look!

Cloudflare Changelog developers.cloudflare.com

What was announced?

The Cloudflare Changelog says Agents SDK v0.30.0 now runs PiHarness on Pi 1.4, and recovers more reliably from evictions, crashes, and storage errors.

The story so far

Before, a task that kept crashing the object could make it restart over and over. After a storage error, every call could fail until the object restarted. A cut-off model stream could fail the whole turn.

What changes

Failure handling changes like this:

  • A problematic task can be set aside instead of restarting forever
  • You can recover from storage errors without waiting for a restart
  • A transient model stream cut no longer fails the entire turn

If you run long-lived agents on Durable Objects, this is especially welcome.

Dive Deep

Here are the changes one by one.

  • Hibernation: PiHarness passes Pi's new onWake callback to your harness factory. While a task sleeps, such as during a model retry backoff, the Durable Object can hibernate until the task is due instead of staying in memory
  • Parked tasks: Pi 1.4 parks a task that keeps crashing the object instead of restarting it forever. Parked operations show as parked in pending(), and session.retry() runs them again
  • Recovery from storage errors: PiHarness reopens Pi after a storage error. Its wake-up job retries failed steps with a backoff instead of dropping them
  • Retried model streams: agents/models/pi-ai reports a cut-off or idle model stream as a transient error, so Pi retries the turn

One caveat: Pi 1.4 migrates the session storage in the object's SQLite database to a schema that Pi 1.3 cannot open, so you cannot roll back past this upgrade. Check the Pi Durable 1.4.0 changelog for Pi's own breaking changes. Upgrade steps are in the Agents SDK v0.30.0 changelog.

Wrap-up

  • Agents SDK v0.30.0 supports Pi 1.4 in PiHarness
  • Durable Objects can hibernate while tasks sleep
  • Repeatedly crashing tasks are parked and can be rerun with session.retry()
  • Better recovery from storage errors and cut-off model streams
  • No rollback to Pi 1.3 because of the schema migration

This one is for developers running agents on Cloudflare!