Skip to content
The AI Agent Factory

Chapter 32. Choosing the Foundation: Claude Managed Agents or an Open Stack

Approved by
Panaversity ·
11 min read

The point

Nobody builds an agent platform from scratch. The real choice is the foundation you build on. In Part III you hosted Brightline's AP worker on Claude Managed Agents, and taught it to learn. Anthropic ran everything under it. That was the fastest way to a working worker.

This chapter asks whether it is the cheapest way to keep one. It compares two foundations. The first is Claude Managed Agents, which you know. The second is an open stack: Pi Durable, an open-source harness, running on Cloudflare Durable Objects and Workflows. You did not write either one, and you will not. On both, you add only the professional layer: the worker's memory, its rules, its learning and its cost control.

The model decides the choice. Model calls are the largest running cost of an AI worker that you can control. Claude Managed Agents runs only Claude models. An open stack can run any model, Claude included, so each kind of work can go to the cheapest model that does it well. This chapter shows how much that is worth, honestly, including when it is worth very little.

A map of the Part IV platform in four rows, foundation at the bottom, then work, platform and learning, with economics as a column on the right. Highlighted as this chapter, Chapter 32: Harness (Pi Durable); Runtime (Durable Objects); Process engine (Cloudflare Workflows); Model access (any model, AI Gateway). Dashed, later in this part: Memory (facts, source, expiry); Dreaming (proposes candidates); Evaluation (held-out cases, new judge); Releases (approve, canary, roll back); Control plane (workers, versions, tenants); Model router (filter, then rank); Role contracts (one authorize check); Tenant walls (and proven deletion); The AP worker (one object per conversation); Waits, approvals (asleep, not paying); Workflows (month-end reconciliation); Events, schedules (per-worker coordinator); economics (Chapter 37). A note at the foot says approved knowledge, case files and the governed door are stand-ins here, and Part VI replaces them with the systems of record.

Where this chapter sits in Part IV. The same map opens every chapter, with that chapter's parts highlighted.

Why it matters

This story is invented, but the numbers in it come from the Panaversity paper this part is built on.

A two-person firm in Lahore sells an AP worker to small distributors for $100 a month. Its first ten customers love it. Then the firm looks at its costs. On Claude Managed Agents, each worker costs about $56 a month to run, review and teach. That leaves $44. Most of the $56 is model calls and the minutes a person spends checking the worker's work. The firm cannot cut its price to win bigger customers, because it cannot choose a cheaper model for the simple jobs.

A rival firm runs the same kind of worker on an open stack. It sends routine invoice reading to an economy model and keeps Claude for the hard cases. Its cost is about $30 a month for the same work. It can charge less and still earn more.

Neither firm wrote an agent platform. They chose different foundations. This chapter teaches you to make that choice with numbers, not with loyalty or fashion.

Words this chapter uses

The words of Chapters 23, 29 and 31 keep their meaning: session, run, harness, memory store, dreaming, golden set.

WordMeaning
FoundationWhat your worker runs on: the harness, the runtime, the process engine and the model access. You choose it; you do not write it
HarnessThe software around the model that runs its loop, calls its tools and keeps its state
Open stackA foundation made of parts you can see, change and run where you choose, here Pi Durable on Cloudflare
DurableAble to survive a crash: work already done is not lost or done twice
CheckpointA saved point in a run. After a crash, the run starts again from the last checkpoint
Durable ObjectA small Cloudflare program with its own storage. Your worker gets one per conversation
HibernateTo sleep without being billed, and wake on the next event
Economy modelA low-priced model that does routine work well, such as Qwen Flash or DeepSeek Flash
Lock-inWhen moving away from a product costs so much that you stay even if a better choice exists
Variable costA cost that grows with the work: model calls, runtime, review minutes
ContributionWhat a worker earns minus its variable costs. It is not profit: fixed costs come out later
Idempotency keyA unique label on an action, so that doing it twice has the effect of doing it once

What you will build

Where you are. Brightline's AP worker runs on Claude Managed Agents for two companies, and learns from its runs (Chapter 31). Brightline now wants to sell it to more distributors at a lower price.

What you build. As in every chapter of this part, Claude Code writes the code. You write the spec and the tests, and you review.

  1. The setup for the whole part: a free Cloudflare account with a billing notification, Wrangler, a free Neon database, and a CLAUDE.md that pins the versions.
  2. A first worker on Pi Durable, in a Durable Object, with one read-only AP tool. You kill it in the middle of a run and watch it carry on.
  3. The same worker on the OpenAI Agents SDK, from the same spec. The same kill loses the step. You ask Claude Code to fix it, and count the code it adds.
  4. One model change: the Pi Durable worker moves to an economy model, and you compare quality and cost on five golden questions.
  5. A one-page memo that chooses a foundation for Brightline, with the numbers.

By the end of this chapter, you can price an AI worker on two foundations, explain where the difference comes from, and choose one with evidence. You can also say what would change your choice.

In this chapter

  • 32.1 The foundation, not the platform
  • 32.2 Claude Managed Agents first
  • 32.3 The model is the biggest bill
  • 32.4 Price your own worker
  • 32.5 Why this open stack
  • 32.6 The fair alternative: the OpenAI Agents SDK
  • 32.7 When each foundation fits
  • 32.8 Set up once, and build with Claude Code
  • 32.9 How today's tools realize it
  • Lab 32 One worker, two foundations, one memo

What this chapter is built on

The chapter follows Panaversity's paper Building Affordable, Self-Improving AI Workers (29 November 2026), its technical companion and its cost model, model.ts. Every cost in the chapter comes from that model, with the prices checked on 29 November 2026. The figures are the paper's illustration, not a promise: you will replace them with your own measured numbers in the lab.

  • Building Affordable, Self-Improving AI Workers: Pi Durable and Cloudflare as the Foundation for an Open, Model-Independent Alternative to Claude Managed Agents (Panaversity, 29 November 2026)
Owner
Panaversity