The App Journey · Part 3
How to Run AI Agents in Production: Five Rules We Build To
By Robert Golabek · 5 November 2026 · Updated 22 November 2026 · 15 min read
Who can approve an action an AI agent proposes for a customer? In our design, the model suggests an action. Code checks whether it’s allowed and records what happened. Here are the five rules we use to decide when an agent can act.

The design rule is simple: the model proposes, the code decides. A proposal is plain data. The model never touches a tool, a database or a user directly.
The short version
- The problem. A production agent is a loop that acts. Left open, the loop has no edge: no end, no owner, no budget and no record anyone can check.
- The rules. Five of them, from a pattern we are writing up alongside the app: bound the work, declare ownership, expose contracts, enforce boundaries mechanically and integrate only verified evidence.
- The design. One portable engine per app that runs one agent toward one goal, with guards, budgets, approval gates, a trace and an evaluator, and talks to the app only through ports.
- At the October review. The engine’s core, its configuration layer and a reference app exist as code with tests, behind a switch that is off. No live agent runs on it yet.
- Next. Close the enforcement gaps a review found, wire one agent, run it for real and write that run up as Part 4.
Why “the model proposes, the code decides”
The first agent flows in our app were built the way most teams build their first ones: a prompt, a model call, a bit of code that acts on the answer, and another call. It works until it is asked to work unattended. Then three things go wrong at once. The model’s output is trusted as an instruction instead of being treated as a claim. The loop has no ceiling, so cost and time are whatever the model makes them. And when something looks off, there is no record that says what the agent saw, what it proposed and why it was allowed.

Turning the model’s output into a proposal fixes the trust problem at its root. A proposal is data: an action name and its arguments, a reason, and nothing else. Code can check data. It can refuse an action the agent is not allowed to take, cap how much it may spend, ask a person before an irreversible step and write every step to a trace. None of that is possible when the model’s text is executed as it arrives. The same rule also makes the agent testable: a proposal can be replayed, a guard can be given a broken proposal on purpose, and the engine can be proven to stop where it should.

Five rules for running agents in production
The rules below come from a pattern we are writing up alongside the app. It started life in another product and is private while we validate it on a real project. This app is that project, so the rules here are the ones we hold the design to, not advice we read somewhere.
- Bound the work. Every agent receives a finite objective, an authority, an evidence requirement, a budget and a stop condition. In production that means no agent runs with an open-ended goal, an unlimited number of steps or no notion of what counts as done.
- Declare ownership. Features, state, schemas, files and decisions have identifiable owners. In production that means an agent never acts on identity it chose for itself: who it acts for is supplied by the app, never by the model.
- Expose contracts. Dependencies and cross-capability interactions are explicit. In production that means the agent reaches the model, prices, approvals and state through named ports with declared shapes, so each one can be swapped, mocked and tested alone.
- Enforce boundaries mechanically. Important rules become tests, lints, schemas, CI gates or runtime guards. A rule that lives only in a document is a hope. The questions to ask are: which test fails if this rule is broken, and which guard refuses at run time?
- Integrate verified evidence. Agent output is a proposal until it passes evaluation. In production that means an evaluator judges each step’s result before the next step is allowed, and the run carries its evidence with it.
- Bound the work no agent runs with an open-ended goal, an unlimited number of steps or no notion of what counts as done
- Declare ownership an agent never acts on identity it chose for itself
- Expose contracts so each one can be swapped, mocked and tested alone
- Enforce boundaries mechanically which test fails if this rule is broken, and which guard refuses at run time?
- Integrate verified evidence an evaluator judges each step’s result before the next step is allowed
That second question has engineering answers.
Together they move the question from “is the model good enough?” to “is the loop around the model bounded, owned, explicit, enforced and checked?” That second question has engineering answers.
How the engine is designed
The run side of our system is one Agentic Engine: a library each app carries, not a service they share. It is a small thing by design. It runs one Agent toward one goal in one Run. The names below are the ones we agreed for the whole system; they are decided, which is more than can be said for the code behind some of them, and I mark that difference as I go.
One run, step by step
A run is a cycle. A reasoning step asks the model for a proposal as plain data. The guards check the proposal: is this action allowed for this agent, is the budget left, is the step count under the ceiling? If it passes, the engine performs the Capability the proposal names, through a Tool the app supplied. An Evaluator judges the result. The engine then continues, suspends to wait for a person, or stops with a named Stop reason. Every step lands in the Trace, and the run ends in an Outcome with its Evidence.
Guards and budgets
The ceilings are numbers in code, not prose. A single reasoning call may wait at most 30 seconds; a configuration that asks for more is refused when the engine starts (engine source, read 2026-10-23). A trace is capped at 50 steps and 64 KiB, with the oldest steps dropped first and the cut marked, so a long run can never grow a record nobody can read (decided 2026-10-16, Spec 109 DEC-109-010). Both figures are design limits, not measured results; they exist to make the loop finite before anyone has watched it run.
Approval gates
Each agent carries an approval policy with three settings: review each step, approve the run as a whole, or none. The first two require an approval lifetime; an approval that has expired is no approval, and the engine will not start an agent on a reviewed policy without that lifetime set. This is where a person enters the loop on purpose, at a point the design chose, rather than by reading logs afterwards.
Ports and adapters
The engine’s core imports nothing from this app. It talks to the outside through four ports: a model port, a price port, an approval port and state adapters. The app provides an Adapter for each. That is the portability claim in one sentence: move the core, write the adapters, run the same checks. It is also the testing claim, because every port can be replaced by a fixture.
Runtime Configuration and the switch
Above the engine sits the Runtime Configuration, the layer that declares which agents exist, how they are routed to models and what each is allowed. It owns the switch that decides whether the engine is used at all. The switch is deliberately hard to turn on: it reads as on only for an explicit true, and anything else, including a typo or a source that does not answer within two seconds, reads as off. A production switch must fail closed, and this one does by construction (engine source, read 2026-10-23).
The Conformance Suite and the Reference App
Two more pieces exist so that the design can be checked rather than believed. A Conformance Suite feeds the engine broken fixtures, such as proposals that name actions the agent does not have, and asserts that it refuses, stops or suspends exactly as the rules say. A Reference App is a minimal app with its own adapters and profiles that runs the engine end to end with one command, so a change to the core shows up as a failure there before it could show up for a user.
Profiles and Handoff
An Agent Profile is the declared shape of one agent: its capabilities, its policy, its budget. A Handoff is how one agent passes a bounded piece of work to another with its evidence attached, rather than sharing a conversation. The design has them; the first version runs one agent at a time, and anything beyond that waits for the run that proves the single case.
Five questions to ask about your own agent
You do not need our engine to use the rules. Take any agent you run or plan to run and answer five questions about it, in writing. The first one you cannot answer is where to start.
- What is its finish line? Name the objective, the step limit and the budget. If you cannot say when it is done, it is not bounded.
- Who is it acting for? Say where that identity comes from. If the model can set it, the agent owns itself.
- What does it reach, and how? List the model, the tools, the data and the approvals it touches, and whether each sits behind a declared contract you could swap for a test double.
- Which test fails if a rule is broken? A rule with no failing test and no run-time guard is a hope.
- What checks its work before the next step? If the answer is the same model, you have a proposal, not evidence.
- What is its finish line? If you cannot say when it is done, it is not bounded.
- Who is it acting for? If the model can set it, the agent owns itself.
- What does it reach, and how? whether each sits behind a declared contract you could swap for a test double
- Which test fails if a rule is broken? A rule with no failing test and no run-time guard is a hope.
- What checks its work before the next step? If the answer is the same model, you have a proposal, not evidence.
The first one you cannot answer is where to start.
Write the answers down, then ask what surprised you. The answers you had to guess are your gaps, and they are where the first test, guard or approval belongs.
Try the approval and cost limits on one test ticket
Imagine a support agent that can draft a delivery update. A supervisor must approve sending it to the customer. Before trying it on a live queue, run the same ticket against a test inbox three ways.
- Withhold approval. Can the supervisor see the proposed recipient and draft? While approval is pending, the test inbox should stay empty. Check the trace for the step that is waiting.
- Approve one draft. Match the message in the test inbox to the draft the supervisor approved. Look up that run and check who approved it and which send action followed.
- Use up the budget. Have a test lookup return the same incomplete order record on each attempt. Set a small step or cost limit and check the last allowed lookup, the recorded stop reason and whether any more calls were billed. Investigate any work that continued past the limit.
These are checks you can run against your own design. The project record below describes what we had actually built and tested at the time of writing.
What is true today, and what is not
This is the part that would be easiest to overstate, so here is the record as it stands on 23 October 2026.
- Decided. The specification and the plan for the engine were approved on 16 October 2026 and the build phase started the next day (Spec 109 STATUS). The names used in this post were approved on 15 October 2026.
- Built as code. The engine core, the Runtime Configuration layer and the Reference App are in the repository. At the last recorded check the tests over those three directories numbered 28 suites and 2,472 tests, all passing, and the pull request that carried them passed the project’s CI gate on 22 October 2026 (measured, Spec 109 STATUS). The reference app runs end to end with one command.
- Not running. The switch is off, on my instruction. No agent in the app is wired to the engine. The live assistants users see still run on the older single-path flow that Part 1 described. Nothing in this post should be read as the engine working in production, because it is not there yet.
- Gaps found. A review on 23 October 2026 checked the app against the five rules. The architecture is mostly there; the enforcement is not. Several boundary rules are still warnings rather than failing tests, one older agent path is not yet metered the way the new one will be, and a few feature flags fail open where they should fail closed. Those are the next tasks, not footnotes.

What we want to do next
The plan we set in October followed the pattern’s own advice: enforce the boundaries before adding capability, and prove one case before generalising.
- Now: make the boundaries mechanical. Add a test that fails if any file under the agent code writes to the database directly, so the only path to a write is through a capability the guards see. Add a guard on what the engine may reach on the network. Hash each prompt so the trace can prove which prompt a step ran with. Make identity a value the app supplies, never a parameter the model can set.
- Next: make the runtime observable. Give each agent its own runtime flag, with every flip recorded, so one agent can be moved to the engine while the rest stay where they are. Add a degraded outcome to the usage record for runs that finished but not well. Build the operator’s page that lists agents, their runs and their stop reasons.
- Later: measure and learn. Put a latency benchmark in CI so a slow step is caught before release. Close the loop from a person’s judgement of an outcome back into the evaluator, so what a run teaches becomes a change request rather than a memory.
- Then: the switch. Turn it on for one agent, with a review-each policy, and watch the first real run with its trace in hand.
How PM functions and workflows guide a blog release
Our Product Manager already used skills to do this work. What changed in November was how I find them. The catalogue groups PM functions by job, gives each a consistent name and points to the skill or command behind it. For example, I can ask for pm seo briefs to see the article briefs we have. Its label tells me that reading a brief is part of the job. Changing one needs my go-ahead.
We already had a workflow for publishing a blog post. The editorial instructions set out who writes the brief, who reads the draft and who can approve release. We put those steps in a file a runner can read. It follows the same order each time and checks the evidence for each handoff. For example, it can check that the brief file exists and later that the article is listed as staged. To record my review, it needs my quoted words approving release. The next chat can open the record and see which step is waiting.
The runner keeps track of work in our repository. People and their tools write the copy, review it and release it.
When the chat doing the work changes
In Part 2 I had to open chat after chat to find out who needed me. Suppose a writer tells me a draft is ready, then hands the work to another chat before I read it. The PM’s work ledger lists the branches and workspaces. In a chat roll call, the PM checks each chat’s account against Git, the pull request and the handoff for the spec. That gives the next writer a way to find the revision I need to read. If the review step is open in the workflow record, the draft is waiting on me.
For a request that has to reach another chat, I can authorize the PM to send a message to a seat, our name for a job one chat holds at a time. The message goes in a GitHub issue addressed to that seat. If the seat changes hands overnight, the request is there in the morning. The holder replies with the result or explains what blocked it, then closes the issue. I can follow the answer back to the work without searching the original conversation.
What I can hand to Autopilot
Once we know whose turn it is, some of the checking can run automatically. Our Autopilot can read the approved task queue and report what it would pick next. On 22 November its unattended start was switched off. To start work I name the task or workflow in a chat, the PM checks the target and who owns it, and I give the go-ahead for the handoff. That keeps the decision visible even when another chat takes the next step.
For the engine inside the customer app, the 19 November design decision keeps it in our Next.js service and assigns work that outlasts a request to a background worker. The project status on 19 November still recorded the switch as off and the first live comparison as awaiting approval.
Next in The App Journey
The next part is that first real run: what the trace showed, where the guards fired, what the evaluator refused, and what it cost. It gets written when the run exists, not before. Until then this post is the plan, and the repository is the evidence for how much of the plan is code.
Frequently asked questions
What is an agentic engine?
In our design, it is the small library inside an app that runs one AI agent toward one goal: it asks the model for a proposal, checks the proposal against the rules, performs the allowed action, evaluates the result and decides whether to continue or stop. The model never acts directly. The engine is owned by the app, not shared as a service, so it can be carried from one app to the next.
Is this an agent framework?
No. A framework hands you building blocks and leaves the safety model to you. Our engine fixes the safety model, with bounded work, guards, budgets, approval gates and a trace, and leaves only the app-specific parts open: which model, which prices, who approves, and where state is kept.
Why keep the switch off?
Because the engine exists as code and tests, not yet as a feature. The app’s live assistants still run on the older path. The switch stays off until one agent has been wired to it and has a real run to show, with its trace and its evidence, and the owner has read that run.
Can another app use it?
That is the point of the design: the engine’s core imports nothing from this app and talks to the app only through ports. A second app would supply its own adapters and runtime configuration and run the same conformance suite. No second app has done so yet, so treat portability as a design goal, not a proven result.
Where the plan lives
Running agents in production starts long before the first run, with a plain statement of what the agent is for, what it may do and who decides. Agentic AI Canvas helps with that planning side: it keeps the business context, the decisions and the plan together for people to review. It does not run agents or write the code. Start a planning conversation when you are ready to write the first decisions down.