Skip to content
The AI Agent Factory

22.1 The worker leaves the laptop

Approved by
Panaversity ·
14 min read

Part A. What a hosted agent is. Half 1, Milestone 1. Five concepts, then the lab's setup and Sitting 1, where you set up your first hosted agent and read its sessions.

In everyday life. A small bakery bakes every loaf in its own oven, at the back of the shop. When it starts selling to three cafés across town, it rents time in a shared commercial kitchen instead. The kitchen owns the ovens, the power and the cleaning. The bakery still owns the recipes, decides which café gets which order, and checks every loaf before it leaves. Moving the ovens did not move the decisions. In this concept, the shared kitchen is the hosting platform, and the recipes and orders are your product's decisions.

What you will learn. What changes when the AP worker's loop runs on someone else's servers, which decisions stay with your product, and why that alone does not make an AI Worker.

Why it matters. Hosting moves the machinery, not the decisions. If your product forgets who each run is for, one person's question can reach another person's data.

Words that mean something different in this chapter. Seven words you already know change meaning here. Each is flagged again where it first appears.

WordElsewhereIn this chapter
SessionA sign-in in a browser (Chapter 18), or a saved conversation you resume (Chapter 21)A worker session: one running worker, with its own sandbox, history and budget (22.2)
EnvironmentStaging or production (Chapter 17)Also a runtime environment: where a worker runs and what it may reach (22.2)
Stop reasonWhy one model call stopped writing (Chapter 20)Why a whole session went quiet (22.3)
Allow listTools that run without asking (Chapter 21), or hosts a sign-in server accepts documents from (Chapter 18)Hosts a sandbox may reach (22.7)
BudgetAny of a loop's three stops (Chapter 20)Only the dollar cap on one session (22.5)
InterruptAn interruption: a tool call waiting for approval (Chapter 21)A request to stop a session's current work (22.3)
TokenA unit of text a model reads (Chapter 20), or a sign-in token (Chapter 18)Usually a sign-in token. The kinds are in the word list (Part C)

One request, start to finish. On Monday morning, Brightline's controller, Dave Kowalski, asks the builder a simple question: "Why can only you use the AP worker?" The builder shows him where it runs today:

  1. The builder runs the Chapter 21 program on a laptop and types Ana's question for her.
  2. The agent SDK runs the loop on that laptop (21.3): the model asks for the connector's list_open_invoices tool, the SDK runs it and sends back the result, and the model writes an answer.
  3. The connector checks the token. It is the builder's own test token, for Brightline, as in Chapters 20 and 21.
  4. The answer appears on the builder's screen. Ana reads it over the builder's shoulder.

Every step happens on one computer, as one person. Ana cannot ask it herself. Luis at Cedar Ridge cannot ask it at all, because the token is for Brightline. And when the laptop sleeps, the worker stops.

What is a hosted agent?

You know the loop by now. In Chapter 20 you followed it line by line: call the model, keep what it sent, check whether it asked for a tool, run the tool, return the result, and call again until it stops. In Chapter 21 an agent SDK ran the same loop inside your own program. The program around a model that runs the loop, offers tools, keeps the conversation, checks permissions and enforces limits is the harness (21.1). A hosted agent is an agent whose harness runs on someone else's servers. Your product talks to it over the internet: it sends a question, and it watches the work happen. The AP worker is more than its agent. It is a role, with an owner, limits and a person it acts for each time (Chapter 2), and most of this chapter is about the parts of that role the platform does not hold.

What does the platform take over from Chapter 21's list?

21.9 ended with what an SDK in your own process still leaves to you. A hosted platform takes most of it, row by row:

21.9's rowOn a hosted platformStill yours
A process, and a diskThe platform runs the loop on its own servers, one session per questionNothing to keep running
A container and a sandboxEach session gets its own small computer, the sandbox (22.7)Which tools it has, and where its network may reach (22.7, 22.8)
What the process inheritsNothing from your computer: only what the agent definition lists (22.4)Keeping that definition as reviewed files
CredentialsThe platform holds each person's token in a vault, and adds it on the way out (22.10)Which person, which company and which vault, on every run (22.9 to 22.11)
Where transcripts and traces liveThe platform keeps each session's events (22.3)Who may read them (22.12)
Cost and timeThe platform enforces a budget on each session (22.5)Setting the budget on every run, and a time limit of your own (22.5)
UpgradesThe platform upgrades its own harnessPinning what you can: the command-line tool, the model id and the platform's version header (the API version each request names), with the worker's definition kept as reviewed files (20.13, 22.4)
What counts as doneNothingYour checks (22.16)

The right column is the whole of this chapter. A hosted platform will run whatever you ask it to run, as whoever you tell it the run is for. Choosing the person, the company, the tools, the reach and the budget is your product's job, on every run.

Why does Brightline want it?

Three reasons, each from the story above. Brightline's clerks should ask from its own web page, without the builder's program. Each clerk's question should run as that clerk, so the connector's logs say who asked and the connector serves the right company. And a run should not depend on one laptop being awake.

Is a hosted agent already an AI Worker?

The platform hosts the agent, the mechanism. An AI Worker is the role built around it, and most of this chapter builds that role:

A hosted agentAn AI Worker built on it
The question it answers"Can it do this task?""Whose job is this, within what limits, and who answers for it?"
Who it acts forWhoever calls itOne named person and one company per run, chosen by your product
What limits itThe tools it was made withA Role Contract: what it may answer, use, reach and spend
What a customer buysA task done, per requestA role filled for a company, month after month

A white box in the middle labeled agent: a model in a loop with tools, the mechanism. Around it, a larger gold box labeled AI Worker, a role you can sell, with six small cards on its edge: an owner, a person it acts for each run, limits on tools and network, a budget, checks on every result, a schedule and a record. To the right, two cards: a customer buys from an agent a task done, and a customer buys from an AI Worker a role filled.

Figure 22.5. Hosting gives you the agent. Your product adds what makes it an AI Worker.

The rest of this chapter adds what turns this agent into the AP worker: whose token it carries, one person and company per run, a budget, a schedule, and a loop that checks its work.

At work. In Lab 22, Task 1, Claude Code interviews the builder, who plays Ana, and rewrites Lab 21's portable specification, docs/worker-spec.md, for a hosted worker: the worker answers questions about open invoices, vendors, purchase orders and AP policy, using the connector's four read tools and the invoice-triage skill. It never pays, approves or changes anything. Each run is for one signed-in person and one company, with a budget of $0.50. The contract names no product.

The operating rule: host the loop, keep the decisions. Write down who the worker acts for, what it may use, where it may reach and what it may spend.

Check yourself

Question 1 / 10 · drawn from 12

0 answered

Which addition turns Brightline's hosted agent into the AP worker?

Owner
Panaversity