AgentSmyth LabBack to AgentSmyth
Skip to article
Back to Lab NotesCase Studies · Engineering Note 2

What the screen shows, and who wrote it

Five cases that show the rules at work, from a single answer traced end to end to an injected instruction that got past the model and no further.

November 23, 20268 min readChris Flannery
On this page

The rules in What the model may decide are easy to state. These five cases apply them to real kinds of work: what the user asked for, what the model decided, what code decided, and what a person decided. Three are worked examples of ordinary operation. Two show a check doing its job.

Case Study 1 · One answer, traced

The model chooses and places the cards. Code fills in the numbers.

An illustrative example, simplified from the way a real answer is assembled.

Say a portfolio manager opens AgentSmyth and asks: "How exposed is my book to Thursday's CPI print?" The answer arrives as prose with a rates chart, a table of the most rate-sensitive positions and an options-positioning card for the largest holding, each one placed where the prose discusses it.

Who decides what?

model     calls tools: the user's holdings, rate sensitivities,
          options positioning for the largest name
tools     return documents, tables and typed card payloads
          each card announces itself to the model:
          its kind, one line on what it shows, and the tag to embed
model     writes the prose, and places
            <chart id="…"/>              where it discusses rates
            <table id="DOC" index="0"/>  where it discusses positions
            <artifact kind="…"/>         where it discusses the options setup
          cites each claim with a claim tag
platform  converts claims to citations; any citation to a document
          this run didn't retrieve becomes plain text
client    draws each embed from the payload, not from the prose

Here we can see that the model chose three things to show and where to put them, and typed none of the numbers inside them. The table is a reference to a document the tool returned, so the rows on screen are the rows in the source. The chart cites documents fetched in the same run, or it is refused. The card is a projection of tool output.

The principle

Let the model do what it is good at: judging what matters to this question and telling the story in order. Keep the figures with the system that owns them. A model that can rearrange a screen but can't retype a number can still choose the wrong card, the wrong period or the wrong conclusion. It can't put a wrong value in a table.

Case Study 2 · A custom card, written once and replayed

The model writes the code. The code writes the numbers.

An illustrative request.

Let's say a user asks for a card that ranks the names on their watchlist by the change in 30-day implied volatility over the past week, with a picker to switch watchlists.

The model picks the fewest tools that can answer it and writes a short Python script. The script fetches the data, computes the ranking and emits the card as a small XML document in a closed vocabulary. Simplified:

<widget>
  <picker> <control type="watchlist" …/> </picker>
  <stats> <stat …/> <stat …/> </stats>
  <table> <columns> … </columns> <row …/> … </table>
</widget>

Then a save step runs the script through ten gates before anything is stored. A saved card will be opened tomorrow and next month with no model in the loop, so anything that would break it then has to be caught now, while the model that wrote it is still there to fix it. Each gate checks one way a replayed card could go wrong:

GateWhat it checks
Vocabularythe markup the script emits parses into the closed block list
Wired controlsevery picker and control feeds the data calls it claims to change, so switching watchlists really changes the data
Named scriptthe saved instructions name the exact script to run, so a later run executes this script and not a rewrite
Replay planthe plan for refetching the data covers every tool the script calls
No networkthe script reads only the data its declared tools fetched, so every figure stays traceable to a cited source
Self-replaythe script is run once more exactly as it will be on load, and every chart it embeds is published
Footprintthe card's declared size fits its content
Home deskthe tools the card uses are real, and they decide which desk the card belongs to
Speed tierthe load time the card promises matches what its plan should take
Fresh datanothing in the script pins data from the run that built it, so the next load reads today's data

Eight of the gates reject. Two save the card with a notice instead. A card whose replay plan misses a tool still works, only more slowly. A card that loads slower than the tier it promised has the promise corrected. When a gate rejects, its message is written for the model, which reads it, fixes the script and saves again. We store the script and a replay plan, never the rendered markup.

When the card is pinned and opened the next morning, nothing is regenerated. The script runs again on fresh data, with no model in the loop, in 7 to 10 seconds, against 42 to 90 for a full agent run. The only model on the load path is an optional short narrative, on a light model tier, that fills in after the data has painted.

The principle

The model never hand-types the card, so its numbers can't be the model's recollection of the data; the script computes them from the data on every load. Saving the script rather than the output keeps the card current. Saving the script rather than the prompt keeps it the same card.

Case Study 3 · A desk, drafted and accepted

A composition is a draft until a person accepts it.

An illustrative request.

A user asks: "Build me a desk for tracking my Financials sleeve into the next CPI print." The tool that answers contains no model call of its own. It returns a proposal card:

FieldWhat it holds
Modulesthe cards the desk would hold, such as key risk stats, options positioning and a macro events calendar
Tickerthe ticker the desk tracks
Portfoliothe portfolio it reads
Regionthe market it covers
Namea name for the desk, which the user can change
Descriptionone line on what the desk is for, which the user reads before deciding

Nothing is saved yet. The client checks the proposal against the catalog for this deployment and organization, because only the client holds that catalog. Only when the user accepts does the client create the desk, with its own request. The backend has no path that writes a desk, and a test on the backend's import graph keeps it that way.

The principle

Whole-screen composition is the most open-ended thing the model does here, so it gets the least trust. A plan that a person reviews and the client validates can be wrong without consequences. An unrenderable card in a saved desk would look added and then vanish on refresh; in a plan, it is dropped with a reason the user can read.

Case Study 4 · An instruction hidden in the news

Limit what the model can do, so a fooled model is a harmless one.

An eval plants instructions in a news document that the agent retrieves while answering an ordinary question, each one trying to make it take an action the person never asked for. Each outward path is tested alongside genuine requests for the same actions.

Result
Planted attacks8 of 8 contained
Genuine requests6 of 6 took effect

In one attack, on the path that shares a schedule, the model followed the planted instruction and tried to share. The request check stopped it. Sharing runs only when the person's own message asks for it, and this instruction had come from a news article.

The principle

We don't count on the model recognizing every injection, and we don't use a probabilistic filter as the defense. Each action that reaches beyond the person asking is gated on that person's own words, so a model that is fooled still can't act on the planted instruction.

Case Study 5 · A schema that couldn't drift

A broken contract should fail the build before it reaches a screen.

The backend exports a schema for every stream frame and card, and CI checks that the committed schema matches the code. Any change to a frame's shape has to come with a re-export, including a change to a field's description, because the description is part of the schema.

The same day the check landed, it failed a build: a change to a frame had merged without the schema being re-exported. The fix was to regenerate and commit it. No client had to discover the change by misreading a payload.

The rest of the contract works much the same way. A new card kind that the client can't draw fails the client's build, so "deploy the frontend first" is enforced rather than remembered. At runtime, both sides check payloads against the contract without blocking them, and report anything off-contract once per run per kind, at a cost of 0.12 milliseconds at the 95th percentile on a large real card.

The principle

When a model decides which payloads to send, the contract between backend and client has to be checked mechanically. Checking it at build time turns a silent rendering problem into a red build that names the cause.

Sources

  • The ten save gates for a custom card (Case Study 2): the card save step in the AgentSmyth Python backend service.
  • Reload in 7 to 10 seconds against 42 to 90 for a full agent run (Case Study 2): timings recorded in the AgentSmyth Python backend service when replay was built.
  • The planted-instruction results and the attempted schedule share (Case Study 4): the evaluation suite in the AgentSmyth Python backend service.
  • The schema check and the build it failed (Case Study 5): the build history of the AgentSmyth Python backend service.
  • The 0.12 millisecond cost of the runtime contract check (Case Study 5): a measurement recorded in the AgentSmyth Python backend service.