A. B. Khan

AI under the rulebook — an agent is not a new kind of workload; it is a new kind of caller

The Mesh Series · Article 50 · Part J

Egress controlAuthorizationPolicySPIFFEAmbient mesh

Cover: AI under the rulebook

The data team wants to put an agent into the portfolio service. A relationship manager types a question; the agent reads the customer's positions, calls a scoring model, pulls two documents and drafts a recommendation. It is a container with a service account. It passes admission. It gets a SPIFFE identity like everything else.

Then you sit down to write its AuthorizationPolicy, and you cannot. Every policy you have written starts from a sentence of the form A calls B. For this workload the honest sentence is A calls whatever the model's output says next — and part of the input to that model is a document a customer uploaded.

One idea: the mesh was built to judge callers, not to trust them

It is tempting to treat this as a new category that needs a new stack. It is not. An AI agent is three things this series has already built, wearing a new coat.

It is a non-human identity. It needs an owner, a lifecycle and, above all, an expiry (Article 49). Microsoft's own term for what happens otherwise is "agent sprawl", and Entra now has a dedicated identity class for agents, with sponsors, precisely because service principals were being used for it by default.

It is an On-Behalf-Of caller, at a scale nobody planned for. When the relationship manager is in the room, the agent acts for her, and the rule from Article 17 holds without amendment: forwarding her token is impersonation; exchanging it for a new one with the right audience is delegation. When nobody is in the room — an overnight batch, a scheduled review — there is no user to delegate from, and the agent must act as itself with its own credential. Those are two different token flows and two different audit records. Collapsing them is the confused-deputy problem with a language model attached.

It is a workload with a SPIFFE identity, mTLS and default-deny, whose model endpoint is an egress destination like any other (Article 22).

So what is actually new? One thing: non-determinism. Every allow rule you have written assumes an enumerable call graph. An agent's next call is chosen at run time by a model, steered by input you did not write and that may be hostile. You cannot list its edges in advance.

Which changes the mesh's job, not its tools. You stop trying to permit the known edges. You fence the actor: make most of the calls it could decide to make impossible, so that what the model chooses matters less than what it can reach. You can't predict what it asks for. You decide what it can reach. Secure the second thing.

Diagram: agent fence

Why it matters: the dates are law now, and the injected prompt is a correctly authorised caller

The AI Act — Regulation (EU) 2024/1689 — was amended this summer. The amendment did not soften the substance; it moved a date. Obligations for stand-alone high-risk systems apply from 2 December 2027, and the high-risk list is not abstract for this readership: it includes systems that evaluate creditworthiness and systems used for risk assessment and pricing in life and health insurance. If you run platforms for banks and insurers, the high-risk tier is your clients' core business.

Other parts are already in force — the prohibited practices, the general-purpose model rules, the transparency duties — and two further prohibitions take effect on 2 December 2026.

For a platform team, the load-bearing requirement in the high-risk tier is traceability: the system must allow events to be recorded automatically over its lifetime, and whoever deploys it must keep those logs. Read that as an engineer and it is a specific question: which agent, acting for whom, called which model and which tool, when, and was it allowed? That is the identity-labelled access log from Article 24, with one more hop.

Now the security reading, which is where the mesh earns its place. OWASP's list for LLM applications puts prompt injection first and gives excessive agency its own entry. The uncomfortable property of a prompt injection is that nothing is broken when it succeeds. The agent holds a valid identity. Its token is genuine. Its call to the transfer endpoint is, as far as any policy can tell, an authorised caller making a permitted request. Guardrails and filters reduce the probability that the model is talked into it. They do not bound the consequence. Only what the agent is able to reach does that.

The model was never the dangerous part. The standing permission was.

And the usual stack sits underneath: GDPR for the personal data in the prompt, India's DPDP Act for the same data in another jurisdiction, RBI and SAMA expectations on model risk and outsourcing, and residency rules that apply to an inference endpoint exactly as they apply to a database.

How it comes together: four fences, in the order they bite

Fence the egress. In an estate running REGISTRY_ONLY (Article 22), the agent's namespace can reach exactly the hosts a ServiceEntry names. Name one model endpoint. Scope the entry to the agent's namespace so no other workload inherits it. A model that has been persuaded to fetch a URL finds that the URL does not resolve to anything it is allowed to open.

Fence the internal calls. Default-deny in every namespace the agent might address (Article 16), then one allow rule per tool the agent genuinely needs, naming its SPIFFE principal, the method and the path. In ambient this is L7 policy and it lives at the waypoint. The rule is written against the tool, not against the agent's intentions: POST /v1/score and nothing else.

Split the token flows. One code path exchanges the user's token for a downstream one when a user is present; another acquires the agent's own token when one is not. Different credentials, different audiences, and — the point — different log lines. The downstream service can then apply a blunt and useful rule: state-changing operations require a user principal on the token. An agent acting alone can read; it cannot move money.

Record every hop. Each call the agent chooses crosses the mesh and leaves the Article 24 line: the agent's SPIFFE identity, the user principal where there is one, the destination, the verdict. Nothing in that sentence was built for AI. That is rather the argument.

Where an AI gateway fits: Envoy AI Gateway, Solo's agentgateway, Kong's and others do things the mesh does not — token and cost metering, model failover, semantic caching, prompt and PII filtering, mediating tool protocols. They are worth having. They are not your trust domain, your mTLS evidence or your default-deny posture. Put the gateway behind the mesh, as the thing the waypoint routes to. The gateway is for the "prompt and bill" risk. The mesh is for the "blast radius and auditor" risk.

And the limit, stated plainly. The mesh makes an AI workload provable. It does not make it compliant. Whether the system is high-risk, the human-oversight procedure, the conformity assessment, the fundamental-rights assessment — all of that is the programme's, off-cluster, and no access log performs it.

Show the config: the fence and the two token flows

The fence: one model host out, one tool in.

Code: agent fence

The two token flows: delegation when a user is present, the agent's own identity when not.

Code: token broker

Security · Audit · Integration

Security: guardrails lower the probability that a model is talked into a harmful call; egress scoping and default-deny cap what a successful injection can reach — defence in depth for a caller that can be argued with.

Audit: every hop the agent chooses carries its SPIFFE identity and, on delegated calls, the user principal, so the access log answers "which agent, for whom, called what, when, and was it allowed" — the AI Act's traceability requirement produced by the platform rather than promised in a document.

Integration: Entra's agent identity says who the agent is, the mesh decides what and where it may call, the egress list is the boundary; an AI gateway sits behind the waypoint for metering and filtering. Composed, not merged.

Alternatives, and when you'd pick them

An AI gateway instead of mesh policy. Tempting because the gateway is the thing the AI team already bought. It governs calls that go through it. A compromised agent is under no obligation to go through it. Use both.

A separate cluster for AI workloads. A blunt fence and sometimes the right one — for a first deployment, or where the model needs hardware the main estate lacks. You still need every control above inside it, and you have added a cross-cluster trust decision (Article 39).

Trust the guardrails. Reasonable only for an agent with no tools: a summariser that reads and writes nothing. The moment it can call something, the question is reach, not persuasion.

Wait for the standards. The IETF's workload-identity group has agent-identity drafts in progress and they will matter. Build on the SPIFFE identity you have and keep the agent-identity layer swappable, rather than waiting or betting on one vendor's shape.

From simple to standard, and what's next

The simple version ships the agent as "just another service" with a broad allow rule, because nobody could list what it calls. The standard version treats it as a governed machine identity, fences its egress to one model host, allows one rule per tool at the waypoint, splits delegated calls from autonomous ones in code so that state changes need a user, and records every hop it chose. None of the primitives is new; the reasoning about them is. An AI agent is not a new kind of workload. It is a new kind of caller — and the mesh was built to judge callers, not to trust them.

There is a hole in this, and it is not small. Everything above governs the calls the agent makes across the network. If an injected prompt makes it spawn a shell or read a file inside its own pod, no call crosses the mesh at all. Next, Article 51: the detect layer you can't buy from your service mesh — eBPF runtime security with Cilium and Tetragon.

You can't predict what it asks for. You decide what it can reach.


Next in the series: Art. 51, eBPF runtime security. Earlier: Art. 49 (an agent is a non-human identity), Art. 48 (the 2027 wall), Art. 24 (the access log), Art. 22 (egress control), Art. 17 (On-Behalf-Of), Art. 16 (default-deny), Art. 10 (who and what, composed not merged).

Key skills & topics in this article

Egress controlAuthorizationPolicySPIFFEAmbient mesh

  • #AIAct
  • #AgenticAI
  • #ZeroTrust
  • #Istio
  • #EntraID
  • #Kubernetes
  • #ServiceMesh
  • #dotnet
  • #DORA
  • #RegTech