A support agent gets a message: "I lost access to my old email. Please change the email on account 4471 to sam@new-mail.io."
The agent has a change_email tool, so it calls it with accountId: "4471", and the email changes. The trouble is that the person who wrote the message doesn't own account 4471. One password reset later, they do.
Nothing was hacked here. The model did what it was asked, and the tool did what it was told. The account id came from the model, the model got it from the message, and nobody compared it with the person who was asking.
I've spent the last few months building a small library that closes this gap for one agent framework. Then AWS shipped Greenlight for Agents, which attacks agent safety from a very different direction. I read its docs closely, borrowed one idea from it, and came away thinking the two approaches need each other. This post explains why.
What AWS Greenlight for Agents does
Greenlight is in preview, so the details may change. Here is what its user guide describes today.
You start with your business rules, written in plain English, or with the calls your agent has already made. Greenlight turns them into policies in Dogwood, an open source policy language that extends Cedar. So far that sounds like any policy tool. The interesting part comes next: it checks those policies with automated reasoning. A solver searches every possible sequence of tool calls in a session, looking for one that breaks a rule. If it finds none, the rule is verified.
It also replays the calls your agent made last week against the new policies, so you can see which ones they would have stopped before you turn anything on. Enforcement then happens in an Amazon Bedrock AgentCore gateway or in a Strands Box. Greenlight itself only writes and checks.
The example in its own guide is a close cousin of my opening story. A policy denies reset_password unless verify_identity came back verified for the same user in the last 24 hours, and Greenlight proves that no sequence of calls gets around it.
I think this is a real step forward. Tests cover the cases you thought of. A solver covers the ones you didn't.
What it tells you it doesn't know
The limitations page is unusually honest, and it's worth reading in full. The part that matters for my story is what the analyzer can see. It sees the policies, the tool schema, and how the platform records calls. It doesn't read your user directory, so it doesn't know who your users are. It treats every input as any value of its type. And it can't see a check that lives inside the tool.
Put that next to the opening story. Greenlight can prove that a change never happens before an identity check. It can't prove that the account being changed belongs to the person who passed that check, because that fact isn't in the policy, the schema, or the call history. It's in your database.
That isn't a flaw in Greenlight. It's the edge of what a policy can know. A proof about a policy is only as good as the facts the policy can see.
So there's a second question, and it has to be answered somewhere else: next to your data, by code that knows who is asking. That's the part I work on. To explain it, I first need to introduce the framework it's built for.
A short introduction to Flue
Flue is an open agent framework from the creators of Astro. You write an agent in TypeScript as a function, a lot like a React component: it uses hooks to pick a model, mount tools, and keep state, and it returns the agent's instructions. Flue takes care of running it. It keeps sessions durable, gives the agent a sandbox for files and commands, and deploys to Node.js, Cloudflare, or a CI job.
A tool in Flue is a function you write and describe to the model. You define it with a name, a description, an input schema, and a run function. The model decides when to call it and writes the arguments.
Flue's own tools guide then says something every agent developer should read twice:
A tool's arguments are model-selected inputs, not an authorization boundary.
In other words, Flue validates the shape of the arguments, but deciding which customer or account a tool may touch is your application's job. Flue gives you good building blocks for that. It doesn't make the decision for you, and it shouldn't.
What flue-guard adds to Flue
flue-guard is the piece that makes that decision hard to forget. It wraps a Flue tool and runs your checks in your own process, before the handler.
Here is the tool from the opening story, with the check it was missing:
import * as v from "valibot"; import { govern } from "flue-guard"; declare const accounts: { ownedBy(accountId: string, actorId: string): Promise<boolean>; changeEmail(accountId: string, newEmail: string): Promise<void>; }; const gov = govern({ audit: "audit.jsonl" }); export const changeEmail = gov.tool({ name: "change_email", description: "Change the email address on an account.", parameters: v.object({ accountId: v.string(), newEmail: v.string() }), sideEffect: true, // Only the owner of the account may change it. authorize: (a, ctx) => accounts.ownedBy(a.accountId, ctx.actor.id), // A retry of the same change returns the first result. idempotency: { key: (a) => `email:${a.accountId}:${a.newEmail}` }, execute: async (a) => { await accounts.changeEmail(a.accountId, a.newEmail); return "Changed."; }, }); The result is still a normal Flue tool, and you mount it with useTool like any other. What changes is what happens on each call.
First, the caller is known. ctx.actor comes from your server, after it authenticated the person, and the model has no way to set it. Second, authorize asks your own data whether that caller may touch that record. If the answer is no, your handler never runs. In the opening story, the call ends there with authorization_denied.
The other features follow from the same idea. Agents retry and change their plans, so an idempotency key makes a repeated call return the first result, and nobody is refunded twice. Some calls are too risky to decide in code, so a tool can send them to a person first, and nothing runs while it waits. Flue has no built-in approval step, so this fills a real hole. And every decision, yes or no, goes into a log where each entry holds the hash of the one before. Change a past line, and verification points at it.
There's one more rule, and it's my favorite. A tool that changes data and has no check at all won't load. You can't ship the opening story by forgetting a line, because the mistake shows up on your machine when the app starts.
What I took from Greenlight
Reading the Greenlight guide, one feature made me a little jealous: replaying recorded calls against a changed rule. Then I realized flue-guard already kept a verified log of every call, which is the hard part. The feature shipped in version 0.6.0.
Here's how it works in practice. Say any support agent could issue refunds last week, and you want to limit refunds to support leads. Before you ship that change, you run it against the log:
npx flue-guard replay audit.jsonl --tools ./tools.mjs The full output looks like this:
5 calls: 3 unchanged, 2 newly denied, 0 newly allowed, 0 not replayed, 0 without a spec newly denied seq 3 issue_refund tom allowed -> access_denied [roles] newly denied seq 5 issue_refund tom allowed -> access_denied [roles] That's real output from a five-call log. Two of Tom's refunds would now be refused, and you know it before Tom does. The command exits with 1, so a CI job can stop on it.
A replay runs the same checks the live pipeline runs, so its answer can't drift from production. It runs no handler and writes to no log. It's also honest about what it can't see: the log stores masked arguments, so a call it can't fully rebuild is reported as "not replayed" instead of guessed.
Side by side
| AWS Greenlight for Agents | flue-guard | |
|---|---|---|
| Where the check runs | AgentCore gateway or Strands Box | In your process, around the tool |
| How you write rules | Plain English, turned into Dogwood policies | TypeScript functions |
| What a rule can see | The call and the session's earlier calls | The verified caller and your live data |
| Rules about call order | Yes, a core feature | Not yet |
| Proof over all call sequences | Yes, with a solver | No |
| Replay of recorded calls | Yes | Yes, since 0.6.0 |
| Safe retries | Not covered in the guide | Idempotency keys |
| Audit trail | Gateway logs and a dashboard | Hash-chained log you can verify |
| Status | Preview | 0.6.0, MIT |
What flue-guard doesn't do
I asked for honesty from AWS, so here's mine.
flue-guard has no solver. Your authorize function is ordinary code, and nothing proves it's right, so you test it like any other code. It has no rules about call order yet, so "no refund before an approval call" is still on my list. It's built for Flue: the core doesn't import Flue, but Flue is the only adapter today. And it can't limit what your handler does once it runs. That's the job of Flue's sandbox and your infrastructure.
Use both
These tools answer different questions. Greenlight asks whether your policy is logically right, and proves it at the gateway. flue-guard asks whether this caller may touch this record, and only code next to your data can answer that.
If you run agents behind an AgentCore gateway, use Greenlight for the rules a policy can express, and keep an ownership check next to the data for the ones it can't. If you build on Flue, flue-guard is that check.
- Docs and a five-minute tutorial: https://kirylka.github.io/flue-guard/
- Code: https://github.com/Kirylka/flue-guard
- Install:
npm i flue-guard
I'd like to hear where it falls short for you. Open an issue, or tell me in the comments.



