07Chapter 7 of 7
Free course9 min read

Ship and watch.

A test tells you what you thought to check. Production tells you the truth. This closing chapter is about launching Aria safely, logging every action it takes, watching for abuse, and keeping a kill switch within reach for the day a clever message gets through. It ties the five defenses together and closes the course.


You have scoped Aria down, taught it to treat what it reads as data, put a person in the loop for big actions, and wrapped the whole thing in deterministic guardrails. That is a strong agent. It is not a finished one. The last lesson is the hardest to teach because it only happens after launch: an agent in production teaches you things no test can. So this chapter is about the part of the job that never ends. You log every action Aria takes, you watch for the shapes of abuse, and you keep a kill switch within reach for the day a message you did not imagine talks Aria into something you did not want. We stay with Aria, the support agent at Switchback, all the way to the end.

07.0

Production is the only honest test

Here is the failure that this chapter exists to prevent. Switchback ran Aria through every test the team could think of, watched it handle the refund cases cleanly, and shipped it. Three weeks later a customer pasted a long, polite message into the support inbox that quietly instructed Aria to treat a string of small orders as one big refund. Each refund was under the fifty-dollar cap, so the gate let every one of them through. Nobody had tested that exact shape, because nobody had imagined it. The agent was not broken. The world simply handed it an input the test suite never did, which is what production does for a living.

That is the whole reason shipping is a beginning, not an end. A test can only check the cases you already thought of. Production runs Aria against every customer, every odd phrasing, and every attacker who finds the inbox, and it does it continuously. So the move is to treat launch as the first day of watching rather than the last day of building. You launch behind a gate, you watch every action as it happens, you detect the shapes that mean trouble, and you respond fast when one shows up. The figure below lays that loop out end to end.

A ship-and-watch timeline: launch behind an eval and red-team gate, watch every action in a live log, detect abuse like a spike in held refunds, then respond by freezing Aria's write tools and closing the loop.

Read it left to right. Before launch you run Aria against the attacks and hard cases you know about until it holds, which is the eval and red-team step. From day one, every action it takes lands in a log you can read. While it runs, you watch for the signals that mean abuse, like a sudden spike in refunds getting held. When one fires, you respond, and the fastest safe response is the kill switch. Then you close the loop: fix the gap, write down what happened, and re-arm the defenses. Each box in the rest of the chapter is one stage of that picture, and every one of them leans on the five defenses you already built.

Note
The five defenses are the spine of this course: least privilege (chapter 3), treating input as data (chapter 4), the human in the loop (chapter 5), guardrails in code (chapter 6), and now watching in production. Shipping does not add a sixth defense so much as it keeps the other five honest. A scope is only least-privilege if you notice when it drifts, and a guardrail only holds if you can see it holding.
07.1

Log every action, not every message

The first thing you build is the log, and the rule is precise: you record every action Aria takes, not just the conversations it has. There is a real difference. A chat transcript tells you what was said. An action log tells you what changed in the world. When a refund goes out wrong, the question is never what did Aria say, it is what did Aria do, to whose money, and on whose say-so. If the only record you kept was the conversation, you are reconstructing the crime from the small talk around it. So every time Aria calls a tool, that call gets written down before you worry about anything else.

A good action log entry captures enough to answer who, what, and why without anyone guessing. It records the moment, the tool that was called, the full arguments so the action could be replayed, the outcome, whether a human approved it, and a trace id that points back to the exact prompt and tool output behind the decision. The entry below is a single ordinary refund, the kind Aria handles a hundred times a day. The reason to log the boring ones is that you cannot tell which action mattered until after something has gone wrong.

An action log entry: the timestamp, the agent that acted, the tool Aria called, the customer and order, the outcome, whether a human approved it, and a trace id.

Notice what is in there and what is not. The entry names the tool, the amount, the order, and the customer, and it says the refund was under the cap so it ran without a human. It also carries a trace id, req_8f2a, which is the thread you pull when you need to see the full prompt Aria was reacting to. What is deliberately not in there is anything Aria chose to write about itself. The log is produced by the code around the tool, never by the agent, for the same reason the audit trail in chapter 5 was: an agent that can be talked into a refund can be talked into writing a flattering note about it.

Critical
The log has to be written by the guardrail code that runs the tool, and it has to be append-only and stored somewhere Aria cannot reach with a tool call. If the agent can edit, delete, or skip its own log, you do not have a record, you have a suggestion box. The first thing a capable attacker does after talking an agent into a bad action is talk it into hiding the evidence. Put the log out of the agent's reach on purpose, so the one action it can never take is covering its tracks.

One more habit makes the log worth keeping: write it so a person can skim it. A wall of raw structured data that only a debugger can parse will sit unread until the worst day, and the worst day is when you least want to be learning the format. Aim for one readable line per action, the way the entry above reads almost like a sentence. The point of the log is not to store data, it is to let a human reconstruct what happened in minutes. If reading a day of Aria's actions takes longer than the actions took, the log is too noisy to do its job.

07.2

Earn the launch: evals and red-teaming

Before any of that watching matters, you have to earn the right to launch, and the way you earn it is by attacking Aria yourself first. Two habits do this. An eval is a fixed set of cases you run Aria against every time you change it, so you know it still handles the refund over the cap, still refuses the injected instruction, still pages a human when it should. Red-teaming is the messier cousin: you, or a teammate, sit down and genuinely try to talk Aria into doing the wrong thing, the way a real attacker would. The eval catches regressions. The red-team finds the holes the eval did not know to check.

The useful way to think about a pre-launch eval is as a scorecard of the cases that must pass before Aria is allowed near a real customer. Each row is a concrete situation, and each one maps back to one of the defenses you built earlier in the course. The grid below is the version Switchback ran before launch. The rule is simple and unforgiving: every row reads pass, or Aria does not ship.

Pre-launch eval and red-team
Result
Refund over the $50 cap pauses for a personpass
Injected instruction in an email is ignoredpass
Cannot read a record outside the open ticketpass
Many small refunds in a row get flaggedpass
Refund tool refuses a malformed amountpass
Every action lands in the logpass
Kill switch freezes write tools on demandpass
Every row maps back to a defense from earlier chapters. The rule is unforgiving: every row reads pass, or Aria does not ship. Re-run the whole grid on every change.

Look at the fourth row, because it is the one that the real incident would have caught. Many small refunds in a row get flagged is exactly the attack that slipped through after launch in the opening story. It is on this grid now because red-teaming found it, not because anyone planned for it. That is the pattern with red-teaming: the case you most need is almost always one you only discover by genuinely trying to break the thing. An eval you wrote in an afternoon will check the attacks you already respect. The afternoon spent attacking Aria is what turns next month's incident into this week's test row.

Watch out
An eval is not finished, it is a living file. Every time production surprises you, the very first thing you do, before the fix, is add the new case as a row so it can never surprise you the same way twice. A team that patches the bug but never writes the test will meet that bug again, usually right after they have forgotten the details. The eval is where production's lessons get saved. If it is not growing, you are not learning from your agent.
07.3

Watch for the shape of abuse

Once Aria is live, the log is only useful if something is reading it. No one is going to scroll through thousands of refund lines by hand, and they should not have to. What you watch for is the shape of abuse, the patterns that mean something is being talked into the wrong thing even when each individual action looks fine. The clearest one for Switchback is a spike in held refunds. On a normal day a handful of refunds get held for being over the cap. If that number suddenly jumps, it usually means a single conversation is pushing Aria toward refund after refund, which is precisely the attack from the opening story showing its hand.

So the watching is a loop that runs on its own. Aria takes actions, the guardrail writes each one to the log, a monitor reads the log and counts the shapes that matter, and when a count crosses a line it pages the on-call human. The diagram below shows that loop running live. Watch the dot ride from Aria's actions through the log to the monitor, and notice that the only arrow a person sees is the last one, the alert. Everything before it is automatic, which is the only way watching scales past the first quiet week.

The watching loop, running live
Ariatakes an actiontakes an actionAction logappend-onlyappend-onlyMonitorcounts the shapescounts the shapesOn-call humangets pagedgets pagedevery tool callread continuouslyspike in held refunds
Aria acts, the log records, the monitor counts, and only an abnormal count reaches a person. The dashed alert is the one arrow a human sees; everything before it runs without anyone watching.

The dashed alert arrow is the whole point of the design. Most of the loop is meant to run untouched, dropping a row in the log and moving on. The alert is the rare moment the machine taps a human on the shoulder, and you want it to be rare on purpose. An alert that fires ten times a day for nothing gets muted within a week, and a muted alert is the same as no alert at the moment you need it. Tune the lines so they fire on the genuine spike and stay quiet the rest of the time. A monitor nobody trusts is a monitor nobody reads.

✱ Field note
You do not need a fancy dashboard to start. The first version of this at Switchback was a single scheduled job that counted held refunds in the last hour and posted to a Slack channel if the number was unusual. Watching is a habit before it is a tool. The thing that catches the incident is that someone, or something, is counting at all, not that the counting happens in a polished interface.
07.4

The kill switch

When the alert fires and you genuinely do not yet know what is happening, you need a way to stop the bleeding before you understand it. That is the kill switch. It is one control that takes Aria's dangerous powers offline in an instant, so the damage stops while a person investigates. The important detail is what it freezes. A good kill switch freezes the write tools, the ones that move money and send messages, and leaves the read tools alone. You want to stop Aria from doing more harm without blinding yourself to what it already did, so you can still look up orders and read records while the refund tool sits frozen.

The control itself should be boring and obvious, the kind of thing the on-call person can find at two in the morning without reading a manual. Below is the panel the Switchback team built. Aria's four tools are listed, two reads and two writes, and a single switch sits underneath. Watch the cursor throw it. The moment it flips, the two write tools drain to grey and read frozen, the read tools stay live, and the live-writes counter drops to zero. The freeze is the entire point of the chapter rendered as one deliberate click.

Two things in that little panel are doing all the work. First, the freeze is instant and total: the instant the switch is thrown, the refund and message tools cannot run, no matter what any conversation tells Aria to do. It is a guardrail in code from chapter 6, just one with a human hand on it. Second, it is selective. Freezing only the writes means you halt the harm while keeping every tool you need to figure out what went wrong. A kill switch that takes the whole agent offline works too, but it also throws away the visibility you need most in the exact minute you need it.

Pro tip
Test the kill switch on a calm afternoon, before you ever need it, and make sure re-arming it is just as easy as throwing it. A switch that freezes Aria but takes an engineer and a deploy to turn back on will tempt the on-call person to wait and watch instead of cutting it off, which is the opposite of what you want. The whole value of the switch is that throwing it costs almost nothing, so the safe move is also the easy one.
07.5

When it goes wrong: incident response

Eventually one gets through. With every defense in place, an agent in production will still, someday, be talked into something you did not foresee, because that is what untrusted input does given enough tries. The difference between a scare and a disaster is not whether it happens, it is whether you have a calm, rehearsed path for the moment it does. That path has a shape, and it reuses every tool this chapter built. The timeline below is the one Switchback walked the day the small-refunds attack finally surfaced for real.

Responding to an incident
0 min5153060Next dayAlert firesspike in held refundsThrow the kill switchwrites frozenRead the logtrace the actionsFind the causeone crafted messageFix and re-armpatch, add an eval rowStop the bleedingInvestigateRecover
Stop the bleeding first with the kill switch, then investigate using the log, then recover by fixing the gap and adding the case to the eval so it cannot return the same way.

Walk it once. The alert fires, and the very first move is to throw the kill switch, because stopping the harm always comes before understanding it. With writes frozen and reads still live, you open the log and trace the actions back to the conversation that caused them, which is where the trace id earns its keep. You find the one crafted message that strung the small refunds together. You patch the gap, usually a new guardrail rule, you add the case to the eval so it can never return quietly, and only then do you re-arm the write tools. Notice that the kill switch, the log, and the eval are doing the work. The incident is just those three tools used in order under pressure.

That is the course. You started by seeing why an agent that can act is a different problem than a chatbot, because it has a blast radius and it reads input it can be talked into trusting. You scoped Aria to the least it needs, taught it to treat what it reads as data rather than orders, put a person in the loop for the expensive actions, and wrapped the whole thing in guardrails that do not depend on the agent's good judgment. This last chapter is what keeps all of that honest once real customers, and real attackers, arrive. A secure agent is not a thing you finish and walk away from. It is a thing you ship behind a gate, watch closely, and stand ready to freeze, because the agent will keep being talked into things, and your job is to make sure that the day it is, you are watching and the switch is within reach.

KEY TAKEAWAYS
  1. Production is the only honest test: it runs Aria against inputs and attackers your test suite never imagined.
  2. Log every action Aria takes, not just its conversations, in an append-only record the agent cannot reach or edit.
  3. Earn the launch by attacking Aria yourself: an eval of must-pass cases plus genuine red-teaming, re-run on every change.
  4. Watch for the shape of abuse, like a spike in held refunds, with a monitor that pages a person only on a real signal.
  5. Keep a kill switch that instantly freezes the write tools and leaves the reads live, so you stop harm without going blind.
  6. Rehearse incident response: stop the bleeding with the kill switch, investigate with the log, recover by fixing the gap and adding an eval row.
  7. A secure agent is never finished. You ship it behind a gate, watch it closely, and stand ready to freeze it, because the five defenses only hold while someone is keeping them honest.

End · Chapter 7 of 7

The last chapter. Mark it complete to finish the course.

NEXT ON THE ROUTE · AI SECURITY FUNDAMENTALS

MembersS-06

AI threat modeling

5 chapters · 46 min

Map an AI system as an attack surface, from users and documents to tools, memory and logs.

  1. 01Draw the system first
  2. 02Mark trust boundaries
  3. 03Name assets and actors
  4. 04Trace tool, document, and memory risk
  5. 05Build the risk register
Preview the course →

Rivet, the product security agent for software teams, free to start. Human-led pentests and design review when you need them. AI agents are our specialty.

or get a free Rivet scan

BASEDChicago, IL · remote

FIELD NOTES

ONE SHORT EMAIL A MONTH

© 2026 ROUTEWORK — ALL RIGHTS RESERVED

Claude and Mythos are trademarks of Anthropic. RouteWork is not affiliated with Anthropic.