On 16 October I emailed TechFabric's ideas inbox asking for this post. Lots of enterprise customers, I wrote, are concerned about AI agents going rogue. The risks behind that worry are concrete. An agent can read a table it shouldn't, send something nobody approved, run up a bill, or repeat an action after a crash.
We run agents like that ourselves, so the worry isn't abstract to us. The marketing agents on techfabric.com research the companies that enquire, draft replies, propose ad campaigns and write posts. On 16 October 2026, the first version of the spend cap we'd put on them paused every one of them at once. The run that was meant to draft this post from that email sat unanswered from 03:20 UTC because of it.
An agent needs limits it can't talk its way around. That morning showed us the limits also have to fail in the right direction.
What our own agents may not do
Our follow-up agent reads a new enquiry, researches the company from its own website and drafts a reply. It never sends one. Every message it sends goes through a single mail function whose recipient is a constant, me, and which refuses any other address. A test fails if a send to the lead appears anywhere in its code.
The Paid Boost agent proposes campaigns, keywords and budgets. It holds no ad-account credentials and calls no ad platform. When I approve a proposal, it emails me the setup steps and an import file to launch by hand. The approve link is signed over that exact version of the proposal, so it can't approve a later or edited one.
Both rules live in code, not in a prompt. A model upgrade or a cleverer instruction can't change who receives the email or whether there's a key to the ad account. AutoFabric, our auto refinance platform, draws the same line. When its composer agent sends from the dedicated follow-up mailbox, which skips the platform's approval step, it may send only a fixed, reviewed template, and a free-form draft goes to a person instead.
A budget that fails closed, and the day ours failed too far
Every model call our writing and search agents make through our AI gateway carries a tag naming the agent, the site, the run, the tier and the unit of work. A spend governor reads those tags back. The follow-up agent runs its model on Workers AI outside that gateway, so its limit is a count instead, a fixed number of new leads a day. Each agent has a daily cap and a budget per unit of work, such as one draft. At 80% of its tightest cap an agent runs degraded, on its fallback model with optional stages skipped, and at 100% its work is deferred to the next window. When a unit runs far past that agent's usual cost, every further model call is refused and I get an email. Far past means three times the usual cost as a rule, held between a fixed floor and a fixed limit.
The first version, on 15 October, paused everything over a single fleet-wide daily cap. On 16 October that figure was mostly older spend nobody had tagged, the cap tripped, and a person's request waited behind it. So we split the work into tiers. Work a person asked for, an emailed idea, a revision or an approval, is never paused by a cap and stops only at a safety ceiling of 150% of the monthly budget or on a runaway. Checks are never paused either. Agent work degrades before it defers, and only tagged spend counts toward an agent's own cap.
We learned that a cap needs to know whose work it's stopping. Heddle, the marketing-agent product we build, carries the same governor.
What an agent may reach: Unity Catalog
Our own agents run on Cloudflare, so their limits are written in our code. On a client's Databricks estate we'd put them in the platform. Unity Catalog treats models, tools, MCP servers and agents as securable objects, with the same privileges and attribute-based policies already used for data, so there's no second permission system for the data team to learn.
An agent should get the narrowest grant that lets it do its job, and nothing by default. A follow-up agent that needs one function gets EXECUTE on that function and nothing else in the schema. AutoFabric does the equivalent in its own platform. An agent's credential belongs to one tenant, its scopes are a list such as lending.* or the single action lending.accept_offer, and a call outside them is refused however the agent was prompted.
The second decision is whose identity the agent runs under. We'd run it as the user who asked, so it can reach only what that person could reach anyway, and the audit trail names a person instead of a shared service account.
What an agent may spend: Unity Gateway
Unity Gateway routes every model and MCP request, applies rate limits and budgets, and records usage across providers. It can set per-user thresholds and hard caps on spend. It can also attribute model cost to users, teams or projects with service tags and request tags, which is the same job our tags and governor do on Cloudflare.
We'd carry our tiers over rather than a flat cap per user. Tag a person's request differently from an agent's scheduled work, cap the scheduled work hard, and alert well before anything a person is waiting on would stop. Service policies on the gateway can also allow or deny a request on its content. On an MCP service, an input policy can require a person's approval, and that's where we'd put the rule our follow-up agent keeps in code.
What a number means: metric views and Genie Ontology
Ask an agent for last quarter's revenue and it has to decide whether revenue means booked or recognized, before or after refunds, and in which currency. With nothing to go on, it invents a definition, and two agents asked the same question come back with two numbers, each sounding sure.
Metric views define a business metric once in Unity Catalog, and dashboards, notebooks, alerts and Genie all query the same view. Genie Ontology, in Public Preview, is the context layer on top, and it uses context only from assets the person asking has permission to see. We'd give the agent a Genie Agent that holds the metric views, so it queries a governed definition instead of writing its own SQL against raw tables. We'd keep metric definitions out of our agents' prompts entirely. We haven't run Genie Ontology under an agent of ours yet.
What happens when it dies halfway: Temporal
Governance answers who may do what. It says nothing about the process dying between two steps. An agent that sends an email, crashes and retries from the top has been governed perfectly and still did the wrong thing.
In AutoFabric every action that changes something, whoever asks for it, runs as a Temporal workflow that evaluates the action's policies and writes an audit row with the agent as the actor. A step that waits for a person is its own workflow, and it rechecks the approval every ten minutes until its deadline. A redeploy in the middle of a wait loses nothing, and when the deadline passes the workflow expires the request itself. It's the same property that let failed steps retry on their own for Athlinks and made every close at Location Services retry until it lands or alert operations.
The first test we'd run
Pick one agent with a real consequence attached, one that sends email or touches customer records. Give it one narrow grant, a tagged budget, and an approval step inside a Temporal workflow before anything irreversible. Then kill the worker between the approval and the action and confirm the retry doesn't ask the person twice or send the email a second time. Our Unity Catalog post on agent identity goes deeper on the reads, and our AI agents work and Databricks work pages cover how we build the rest.
Frequently asked questions
Can I see which user or team an agent's model spend belongs to?
Yes. Unity Gateway attributes foundation model cost to users, teams or projects through service tags and request tags, and the usage tables record who called what and when. Because we'd run the agent as the user who asked, the spend lines up with the same person the audit trail names.
What changes in our agents when finance redefines revenue?
Nothing in the agents, if the definition lives in the metric view and not in a prompt. A copy in a prompt would keep the old definition until someone found it.
Does running the agent as the user who asked limit what a Genie Agent can answer?
Yes, and that's intended. A Genie Agent evaluates access with each end user's own Unity Catalog permissions, so two people can ask the same question and see different results if their grants differ. Genie Ontology works the same way, using context only from assets the person asking has permission to see.