8 min Devops

AWS puts automated reasoning at the center: more trust in code and AI agents

Project C2 and AWS Greenlight

AWS puts automated reasoning at the center: more trust in code and AI agents

During re:Invent, AWS is making several announcements aimed at increasing confidence in the code, AI, and AI agents used by organizations. Project Code Confidence (C2) makes it possible to detect bugs in code, and with AWS Greenlight, AWS aims to give organizations the confidence to let AI agents operate autonomously. The common thread between Project C2 and AWS Greenlight is that both utilize automated reasoning.

Automated reasoning is not new to AWS. The company has been using it for about ten years to provide irrefutable proof that certain code, infrastructure, and systems are designed to meet the specified requirements. These requirements can relate to security, but also to compliance, availability, governance, and so on.

Automated reasoning is based on formal, mathematical logic. It takes all the rules and conditions into account and evaluates them accordingly. The result is not a guess as to whether a particular action is permitted, but a mathematically provable answer. Of course, this is only possible if there is sufficient information to provide a definitive answer.

An important characteristic of automated reasoning is that it only works if it is clear in advance what the “correct” way is for something to be set up and function. That is the foundation from which automated reasoning operates. It tests everything it finds against this correct way of functioning.

Project C2

Project C2 provides an example of how automated reasoning can help find bugs in code. Bugs occur in all code, and many of them are relatively easy to find, especially now that LLMs can assist in this process. According to AWS, however, LLMs still miss quite a few bugs, particularly when they are deeply hidden. That’s where automated reasoning can demonstrate its capabilities.

Project C2 combines LLMs and automated reasoning to find many more bugs in code before it goes into production. According to AWS, the company has found more than 800 bugs in 22 popular open-source projects. AWS does not provide a list of projects, but it cites a component popular in the Rust community as a library in which it found nine local bugs. It also cites an unnamed in-memory database and an open-source key-value store.

In all of the above cases, the bugs are very subtle. These are not the kinds of bugs that attackers typically exploit. Still, they can be very troublesome if, for example, they cause organizations to lose data. They are also difficult to find, but there are a great many of them. And there will only be more of them now that coding agents are going to add a lot more to the mix.

How does Project C2 work?

The standard approach to reviewing and analyzing code relies on known patterns, static analysis, or security scanners, as well as the evaluation of AI models that autonomously review code. According to AWS, this approach causes organizations to miss the subtle bugs we discussed above.

Project C2 starts by reading the code and its accompanying documentation to understand how a system is actually supposed to work. Based on that, it attempts to prove that the code is sound, that is, that the code ensures the system works as it should. If that’s not the case, it could still be due to Project C2’s methodology. It’s always possible that it didn’t correctly assess how a system is supposed to work. To rule that out, it first checks whether it can improve its approach. The alternative is that a real bug has been found.

Project C2 not only finds bugs but also provides proof of the bug by testing it in practice. It then sets to work developing and testing a solution for the bug. In doing so, it also provides proof that the fix is correct.

Project C2 is currently available only to a select number of AWS customers (a so-called gated preview). AWS states that it plans to add even more automated reasoning techniques to Project C2 in the near future.

AWS Greenlight

While Project C2 focuses primarily on using automated reasoning to increase confidence in the code that organizations deploy into production, AWS Greenlight focuses on confidence in AI agents. This confidence is absolutely necessary to deploy them within an organization and allow them to operate autonomously. The so-called human-in-the-loop approach sounds like a good idea, but it has significant limitations once AI agents begin to scale, not only in terms of speed but also in terms of complexity.

With AWS Greenlight, available in preview starting today, AWS aims to provide AI agents with rules and boundaries that can be mathematically proven and enforced using automated reasoning.

Organizations can specify in plain language what AI agents must adhere to. This description of the “correct” way for the agents to operate serves as the starting point for automated reasoning within AWS Greenlight. It then sets to work configuring everything so that AI agents always adhere to these deterministic rules.

Automated reasoning is therefore more than just a test of what people think might happen. It involves ruling out all possible ways in which AI agents could circumvent their guardrails. There are often a great many such ways, which are extremely difficult to test if you have to think of them all in advance.

With automated reasoning, this isn’t necessary, because it has been mathematically proven that the AI agents cannot break the rules. In other words, it’s a mathematical proof that doesn’t require testing every possible scenario. It’s a bit like how we don’t need to calculate every possible triangle to prove the Pythagorean theorem mathematically.

Impossible to manipulate

In and of itself, it’s quite a bold claim that automated reasoning guarantees that AI agents will always adhere to their limits and rules. We’ve seen time and again that AI can be manipulated quite easily. According to AWS, this isn’t possible with AWS Greenlight. This is because the rules are not part of the agents’ so-called reasoning loop. If they were, the agent could independently seek ways to circumvent them.

However, the rules of AWS Greenlight are housed in an enforcement engine that is not part of the AI agent’s harness. In other words, the agent cannot see or modify them. AWS Greenlight places the rules for the AI agents in an open-source agent sandbox and ensures that every action taken by an agent complies with those rules. Let’s hope the agents won’t find a way to get into that sandbox, something which has been know to happen.

AWS Greenlight isn’t fully optimized right from the start, according to AWS. It’s constantly learning. It monitors the behavior of AI agents and proposes better rules. According to AWS, this should be a temporary phase. As it receives more input from the AI agents, AWS Greenlight will escalate issues to people within organizations less and less frequently.

How do you communicate the rules?

It’s good to know that AWS Greenlight improves over time. However, it’s also helpful if people provide reasonably good input from the start regarding rules and boundaries for AI agents. If that input is poor, AWS Greenlight won’t be very useful at first.

AWS states that Greenlight doesn’t leave the task of defining the rules solely to people within the organization. It works with business data, procedures, security standards, and runbooks to draft the rules preliminarily. In addition, it draws input from AWS Context graphs and analyzes how AI agents have behaved up to that point. AWS Greenlight then translates this into a mathematical representation.

AWS Greenlight can be used via Kiro and as a plugin for Cloud Code and Codex.

Greater confidence through automated reasoning

Both Project C2 and AWS Greenlight aim to foster greater confidence, greater confidence in the quality of the code that organizations deploy to production and greater confidence that AI agents will stay within the lines. In both cases, automated reasoning plays a key role.

AWS has been using this for about ten years to conclusively demonstrate that its own environment is well-structured. It ensures that AWS can tell customers exactly who has access to which resources in their AWS accounts and how it can verify the millions of different configurations that might indicate an S3 bucket is open to the entire internet.

With Project C2 and AWS Greenlight, AWS is bringing automated reasoning closer to customers’ environments. The ambition is also to expand this beyond AWS environments and make it more widely applicable.

Project C2 demonstrates that bugs are still widespread in the the code that organizations use. Automated reasoning, combined with LLMs, eliminates many of these bugs. This can be quite overwhelming for organizations. Even though Project C2 can immediately build, test, and deploy a solution, it will still place (temporary) additional pressure on an organization to resolve all of these issues.

Customers who actively deploy AWS Greenlight to allow AI agents to operate autonomously must, in turn, naturally also rely on the effectiveness of automated reasoning. While a mathematical proof may be irrefutable in theory, we can imagine that it’s still quite a big step to blindly trust it if that means effectively letting AI agents off the leash and allowing them to operate completely autonomously. That will require a shift in mindset.