Skip to content

Five Boundaries That Keep Agents From Wrecking Production

#agentic-ai #mcp #shacl #generative-ui #qos #tool-use

The demo passes. The deploy doesn't. ​

A customer asks for a refund. The agent picks the right tool, passes a plausible payload, and the money moves. Ship it. A week later the same agent refunds order 8812, which was never delivered, for more than the customer paid.

The model didn't malfunction. It reasoned cleanly about the facts it had. Nothing in the system told it that order 8812 is still sitting in a warehouse, and nothing between the decision and the write could refuse the call.

That gap shows up at every layer of an agentic stack, and the fix at every layer looks the same: replace advice with something mechanical. A prompt asks the model to behave. A classifier demotes traffic that lies. A schema refuses an action that contradicts your domain. A scheduler gives the device's own CPU the arithmetic back.

Here are the five boundaries, what they cost, and where each one still leaks.

Routers have no class for agent traffic ​

Traffic prioritization runs on a 6-bit DSCP field. Sixty-four code points, and none of them means "this flow is a software agent." Static DiffServ, the standard way to mark priority, also has no way to check the claim. Any process that sets the right bit gets the fast queue, whether that's your refund agent or a scraper that read a blog post about DSCP.

The Verifiable Agentic Traffic Class paper proposes three pieces: a reserved DSCP value that declares agent traffic, a router-side classifier that demotes flows whose observed shape contradicts the declaration, and a rate-limited priority queue for the ones that pass. Demoted flows are served after best-effort traffic, so lying is worse than saying nothing.

MechanismWhat it trustsBurst behaviorSpoofed flood behavior
Static DiffServThe DSCP markingReference baselineSpoofer inherits priority
Trusted dedicated classThe marking, uncheckedSame as DiffServSame as DiffServ
fq_codel (tight config)Per-flow fairnessFair, no priorityFair, degrades everyone
VATC (verified)Classifier verdict plus rate limit98% lower agent delay at +12% human delayHuman latency 11x below DiffServ

Under steady load, VATC matched static DiffServ. The interesting result is the burst: mean agent queuing delay fell 98% relative to DiffServ, assuming an immediate classifier verdict, and most of that gain came from having a separate class at all rather than from the policing. You pay about 12% more delay on human flows for it.

The adversarial results are the useful part, because they show where the idea breaks. Under a spoofed flood on a real Linux kernel, the rate limit held human latency 11 times below DiffServ's. A live four-feature classifier demoted all 20 bulk-shaped spoofers and got legitimate agents down to 0.30 ms. It missed six spoofers that copied the agent traffic pattern. Add emulated network delay and the timing feature that separated the two populations stopped separating them.

Then there's the number that should reframe how you think about model latency budgets. In real agent harnesses on a congested link, router queueing consumed 13% to 63% of total task time, depending on the harness and the assumed model speed. If a third of your agent's wall clock is spent in a queue, your carefully tuned time-to-first-token number describes a system nobody is running.

One caveat worth stating plainly: the traffic in this study was synthetic or sandbox-scale. Treat the mechanism as a design worth prototyping, not a knob you can turn on Monday.

MCP is 150 lines, and that's the easy part ​

The Model Context Protocol is a protocol in the boring, good sense. A client discovers capabilities, reads their input schemas, and invokes them. Every application stops inventing its own integration format.

A working server with four tools is roughly 150 lines of repetitive code. The shape is always the same.

javascript
server.registerTool('file_complaint', {
  title: 'File a Formal Complaint',
  description: 'Lodge an official complaint about code quality problems.',
  inputSchema: z.object({
    developer: z.string().trim().min(1).max(100),
    reason: z.string().trim().min(5).max(500),
    severity: z.enum(['minor', 'moderate', 'severe', 'legendary']),
  }),
}, async ({ developer, reason, severity }) => {
  const complaint = db.fileComplaint(developer, reason, severity);
  return { content: [{ type: 'text', text: `Complaint #${complaint.id} filed` }] };
});

Register a tool, describe it, define the schema, provide a handler. The client side adds a hundred lines or so. That's the entire cost of making your service callable by any MCP-capable client, and the reason people are standing up servers for things that a REST endpoint would have handled perfectly well.

Quick Take: MCP collapsed the cost of exposing a capability to any AI client to a few hours of work, and did nothing at all to reduce the cost of securing it.

Where MCP earns its keep is fan-out. If one capability needs to serve Claude, Gemini, and three internal agents, you write the integration once. If you have a single internal agent with four hardcoded tools, a direct function call is the honest answer.

What the protocol hands off, and what it drops ​

I watched a code review agent file a formal HR complaint about a developer over a file whose header read, in plain text, DEMO ONLY, intentionally awful code to give Steve something to review. The agent read that line. It quoted it. Then it called file_complaint with severity severe and wrote to the database.

Nothing in the stack stopped it. That's not a model failure, it's an architecture with a missing gate. MCP lets a client list a tool and call it. It does not decide whether this caller may call it, whether this payload makes sense, or whether a human should see the proposal first.

Connection is not permission. A local stdio server inherits the permissions of whoever launched the process. A remotely exposed HTTP server needs authentication (the spec defines an OAuth-based framework for this) and, separately, authorization. Even a fully authenticated agent shouldn't have the same refund rights as a human reviewer. The tool still needs server-side permission checks, input validation, sensible limits, and an audit trail, especially when it changes something in the real world.

The missing human step is easy to skip in a demo and expensive to skip in production. A high-severity complaint against a named employee is not a side effect you want an autonomous loop performing because it pattern-matched a diff.

A prompt asks. A schema refuses. ​

Frank Coyle's argument at AIE Code Summit is the cleanest statement of the third boundary. A system prompt that says "never refund more than the order total" is advice. It competes with forty other rules once the prompt hits 4,000 tokens, and the model follows it most of the time. Most of the time is a terrible SLA for a function that moves money.

An ontology is a different kind of object. It states what can exist in your domain and how entities relate: a Refund points to exactly one Order, an Order must be Delivered before it can be refunded, a Manager has at least one direct report. SHACL, the W3C constraint language, is one way to write those rules down. The refund constraint is a handful of lines.

turtle
ex:RefundShape a sh:NodeShape ;
  sh:targetClass ex:Refund ;
  sh:property [
    sh:path ex:forOrder ;
    sh:class ex:DeliveredOrder ;
    sh:minCount 1 ; sh:maxCount 1 ;
    sh:message "A refund must reference exactly one delivered order." ] ;
  sh:property [
    sh:path ex:amount ;
    sh:datatype xsd:decimal ;
    sh:minExclusive 0 ] .

The loop is: agent proposes JSON-LD, a validator like pySHACL checks it against the shapes with no model call and no tokens, and the action either executes or comes back as a structured report naming the shape, the field, and the human-written message. That last part matters more than it looks. "Action rejected" teaches the agent nothing. "A refund must reference exactly one delivered order; order 8812 has status Shipped" gives it something to reason about, and in practice it either corrects the call or escalates.

One artifact does three jobs that teams usually staff separately. The same shapes generate tool descriptions and entity definitions for the model, so the domain arrives as a few hundred tokens instead of a few thousand of prompt prose. Validation rules live in git, so a rule change is a reviewed diff. Every rejection is a labeled failure with a shape and a field, which turns your eval suite into a count of which domain rules the agent keeps misunderstanding rather than an LLM-judge score of 6 out of 10.

Shape drift is the operational risk here that teams tend to under-invest in. After three migrations the shapes describe a world the database has already left, and the validator starts rejecting correct actions. Version the shapes in the same commit as the schema change and fail the build when a stored example stops validating. Boring, effective.

The genuine cost is modeling. Someone has to sit down and write the shapes, and that work is slow. Start narrow: pick the single action that would hurt most if it went wrong, write three shapes for it, put the validator in front of that one tool call, and log rejections for a week. The log tells you how often your agent was about to do something your domain forbids, and how many of those cases your prompt had silently been catching.

Give the arithmetic back to the device ​

Generative UI has its own version of the same problem. An agent renders a shopping card, the user drags a servings slider from 2 to 6, and the naive implementation serializes state, ships it over SSE, and burns a few hundred tokens asking a model to compute 3.50 * 3. Seconds later the screen repaints, sometimes with a floating-point artifact.

Client-side functions fix the round trip: the agent designs the interface and binds expressions, and execution runs in local Dart registered in the client's catalog. bloc_signals_genui goes one step further by compiling each bound call into a reactive computed() signal, so the recalculation happens in the same frame as the slider tick with zero microtasks and a surgical leaf rebuild at 120 FPS.

The boundary that matters, and the one teams get wrong, is grain size. If your catalog exposes multiply and add, you've built a fragile Lisp interpreter in JSON and the model will eventually apply a regional tax before the rebate instead of after. If your catalog exposes calculateEntireCheckoutState, the agent has no layout freedom left and you've written a hardcoded wizard with an AI on top. The useful unit is a complete, inviolable domain rule: calculateCartItemCost, validatePostalCode, applyDiscountCode. Small enough to compose, big enough that the agent can't get the order wrong.

ResponsibilityHandled byLatency profile
Layout and semantic reasoningRemote LLM (Gemini, Claude, GPT)Async stream over SSE or WebSocket
Deterministic business mathLocal Dart FunctionImplementationSynchronous, 0 ms, on-device
Reactivity and state syncSignals graph (a2ui_core)Same-frame update, no microtasks
Hardware and native APIsBidirectional RPCLocal platform channels

Side effects need quarantining. A pure function can live inside a computed() and recalculate fifty times a second with no consequence. The moment a function touches GPS, biometrics, or local persistence, it has to leave the reactive graph and run through an explicit user action or an RPC call from the agent. The rule of thumb that holds up: a synchronous in-memory read is safe in computed(); anything crossing disk, network, or IPC is not. A validatePostalCode backed by a preloaded Set or trie belongs in the signal graph. The same function hitting SQLite does not.

Bidirectional RPC is what makes this a boundary rather than a limitation. The agent can ask the client to compute a verified total using local business rules, and the client can call back into the agent's tools. Each side keeps the capabilities it's actually better at.

Git forged for agent-speed loops ​

Entire, founded by former GitHub CEO Thomas Dohmke, launched a Git forge aimed at the mismatch between human-paced review and agent-paced commits. Three pieces are worth naming.

Trails replaces the diff-and-comment pull request with a heads-up display and automated evals that agents score on every push. Distributed hosting is built on a Git-compatible server that Entire claims pushes up to 89x faster than GitHub and 6x faster than Cursor Origin, with multi-region replication for data residency. Continuous Memory syncs sessions and prompts into the repo: Graph maps how the codebase fits together, Brain turns past sessions into memories an agent can query. The open-source Sessions CLI saves agent sessions as checkpoints linked to commits, so the prompts and reasoning behind a change survive the session that produced them.

Vendor benchmarks at that magnitude deserve skepticism until someone reproduces them on a real repo with real history. The idea underneath doesn't need the numbers. When a session ends, everything the agent learned about your project evaporates, and the next prompt starts from zero. Capturing prompts and reasoning as versioned artifacts alongside the code is the durable part, and it's the same boundary logic as everything above: make the invisible state explicit and checkable.

Common Pitfalls ​

Trusting a DSCP marking without a verification path. Any flow can set the agent code point. If your only defense against spoofing is that nobody would bother, you have no defense. Either run the classifier or accept that priority classes are advisory.

Conflating a connected MCP client with an authorized one. A stdio server inherits the launching process's permissions; an HTTP server needs OAuth plus per-tool authorization. I've seen a demo server reach production because "it's on localhost." It wasn't, once the container networking was configured.

Validating with a bare rejection. Returning { "error": "invalid" } to the agent wastes the loop. Return the failed shape, the field, and the current value from your data store. Retry quality goes up sharply when the rejection names what's wrong with the world.

Letting shapes drift away from the schema. The validator ends up rejecting correct actions months after a migration nobody linked to the ontology. Put shape changes in the same commit as migrations and add a build check that validates stored examples.

Exposing fine-grained math functions to the model. multiply and add in a catalog force the agent to assemble an arithmetic AST in JSON. It will get the operation order wrong on taxes and discounts eventually. Expose whole domain rules instead.

What teams actually hit ​

When I sat down with this stack, the part I expected to be hard turned out to be trivial. Advertising a catalog of typed functions to the agent is just schema handoff; modern models are trained on tool calling and rarely hallucinate arguments once they see a JSON schema.

The friction was elsewhere. My first instinct was to wire every state change through stream controllers and debouncers, and that's exactly the async tax the synchronous signal graph removes. Watching a slider update recalculate a computed signal in the same frame converted the skeptics on my team faster than any benchmark.

Where I still spend real design time is deciding what belongs in the reactive graph at all. Pure math is easy. The moment a function reserves a cache slot or reads a device sensor, it has to come out of computed() and go through an explicit action. That separation is where the architecture holds or falls apart, and it doesn't show up in a demo.

The other thing I underestimated is report size. A validation report written for a compliance officer to read can be a wall of text for the model that has to act on it. One message per failed shape, with the field and current value, worked better for us than one message per individual constraint violation.

One Thing to Remember ​

Every boundary in this article does the same job. It takes a rule that currently lives as a sentence in a prompt, in a runbook, or in a senior engineer's head, and moves it into something that runs on every single call and returns a specific error when it fails. Prompts are how you explain intent. Constraints are how you keep it.

The Bottom Line ​

If you're shipping a tool-calling agent that touches money, records, or communications, build the SHACL (or equivalent) validator before you build the second tool. Pick the one action whose failure would be most expensive, write three shapes, and put the validator in front of that call this week. The rejection log alone will change how you evaluate the agent.

If your agent's responses feel slow on the UI side, stop tuning the model and audit the round trips. Arithmetic, formatting, and validation that don't need language understanding belong in a local function or a computed signal. You'll cut latency from seconds to a frame and your token bill from hundreds to zero per interaction.

If you're designing agent infrastructure rather than an agent, watch the traffic class work. The VATC result, where router queuing ate 13% to 63% of task time, says agent performance is now a network scheduling question as much as a model question. Expect the mechanism to be sandbox-only for a while, but budget for it: the harnesses that measure their own queueing delay will be the ones that can prove where their latency actually goes.