Companies are racing to deploy AI agents in everything from customer service to software engineering, but there’s no reliable way to stop them misbehaving. Amazon Web Services (AWS) is now unveiling a tool that turns developers’ plain-English rules into mathematically verifiable policies that agents can’t break.
Unlike traditional software whose behavior is determined by hand-written, deterministic code, agents are powered by large language models (LLMs), which are probabilistic. Their output can vary from run to run, making it tricky to guarantee they will behave predictably. And while developers have built deterministic scaffolding around the models to keep agents on the straight and narrow, it remains far from fool-proof.
To mitigate this, companies typically severely constrain agents’ actions or require a human to approve critical steps. This adds friction that can limit their usefulness and introduce “allow fatigue” in human overseers, says Cami Novelli-Killeen, director of product management for neurosymbolic AI at AWS.
“Formal methods” offer a promising alternative. These techniques define mathematically what software should do and prove it complies. The challenge is that writing these rules has traditionally required expert mathematicians, says Novelli-Killeen. AWS’s new tool, called Greenlight, sidesteps this by using LLMs to automatically convert rules stated in natural language into formally verified policies that constrain an agent’s behavior at runtime. It can even suggest policies based on an agent’s role, and recommend updates as deployed agents encounter new situations.
“This experience is all about helping a person who is the subject matter expert in this particular job, and translating their tribal knowledge, translating their common sense, translating what they know to be right and wrong about that job into very precise policies that an agent can follow deterministically,” says Novelli-Killeen.
Agents’ creativity makes listing every bad behavior they should avoid effectively impossible. So Greenlight runs agents in Strands Box, a software sandbox AWS released in October, which intercepts every action that affects the outside world—such as calling an API or writing a file—and approves or denies it.
Those decisions are determined by a set of policies written in Dogwood, a new language AWS launched in August to write rules for agents. It relies on a branch of formal methods called first-order temporal logic that is particularly useful for governing agents as it can handle concepts of how things change over time. “If you say, ‘I want this personal agent to have my credit card details, but I don’t want it to spend more than $1,000 a month,’ that was something that was very difficult to express in previous policy languages,” says Marc Brooker, VP and distinguished engineer at AWS. “It has to remember how much it’s spent so far and...it has to know what a month is.”
The sandbox is set to deny-by-default, says Novelli-Killeen, and the user then “pokes holes in the box” by writing policies governing what actions it can take. What’s new with Greenlight is that this process is now automated. The tool is a plugin for AI coding assistants such as Claude Code, Codex, and Kiro, and when building an agent, users simply prompt the assistant to propose policies to govern it.
The tool reads the agent’s documentation and logs to infer its job, proposes policies in natural language, and writes formal versions in Dogwood in the background. Users can also add their own rules in natural language and inspect the Dogwood versions if desired. The goal, says Novelli-Killeen, is an experience that “feels like you have a mathematician sitting next to you helping you figure out the specifications for your agent.”
The tool then converts the rules from Dogwood into Lean, a programming language for writing machine-checkable mathematical proofs. Proprietary “automated reasoning engines” then check how the rules interact with each other and the agent’s tools to spot unintended loopholes. Once approved, the policies are compiled to SQL and every action the agent attempts is checked against them, which typically adds just tens of milliseconds to a tool call, says Brooker. Crucially, because the rules have a formal mathematical foundation, each decision can come with an auditable proof of why it was made.
What made the tool possible is LLMs’ growing ability to translate natural language into formal languages, an outstanding problem in computer science for decades. “This is one of those problems that’s gone over the last five years from almost intractable to very, very tractable,” says Brooker.
However, there will always be a danger of translation errors, says André Platzer, a professor at Karlsruhe Institute of Technology who applies formal methods to autonomous systems. Paraphrasing renowned computer scientist Alan Perlis, he notes there is “no formal way to go from the informal to the formal.”
“You’re never really sure whether the informal natural English language was rendered correctly in logic,” Platzer says.
Nor does the tool solve a longstanding problem in formal methods: They can only prove that an action doesn’t violate the user’s specification, not that the specification captures the desired behavior. “There’s a difference between ‘did I build the right thing’ [and] ‘did I build the thing right,’ ” says Platzer. “Ultimately, you need to answer both.”
Nonetheless, he thinks Greenlight could be of real practical benefit because few people understand formal logic. Making formal methods accessible to non-experts could be “super impactful” even if the results aren’t airtight.
Novelli-Killeen concedes the tool is not a “one and done” solution and must be part of a process of continuous improvement. To that end, a replay feature lets users run previous agent sessions against new policies to see how they perform. “What we’re trying to do is add moments of determinism while maintaining that creativity and flexibility of the agent,” she adds.
It could be a promising alternative to existing agent governance approaches, says Jason Andersen, VP and principal analyst for apps, agents, and automation at Moor Insights & Strategy, who was briefed on Greenlight ahead of launch. The most popular approach to governance today uses multiple LLMs to vet an agent’s output, but this is expensive and still boils down to one probabilistic model assessing another. “[Greenlight] is a different approach to correctness that is arguably better,” he says. “It’s two different methodologies of evaluation versus two of the same.”
He thinks it’s likely to prove particularly valuable for agents running critical business processes with low tolerance for errors, especially in domains such as finance and medicine.