Tutorials
How to Enforce AI Agent Tool-Call Policies with AWS Greenlight
AWS Greenlight uses automated reasoning to verify policies governing AI agent actions. Learn how to restrict sensitive tool calls, validate session history, and enforce policies outside the model.
A customer support agent receives a request to reset someone’s password. It has access to two tools: one verifies the customer’s identity, and the other resets the password.
The system prompt instructs the agent to verify the customer first.
Under ordinary circumstances, the model may follow that instruction. But the password-reset tool remains accessible even if the verification step is skipped.
Nothing outside the model prevents the call from reaching its destination.
On December 1, 2026, Amazon introduced AWS Greenlight for Agents, a service that uses automated reasoning to create and formally verify policies governing AI agent actions.
Instead of relying exclusively on instructions given to the model, developers can establish restrictions that are enforced by an external authorization mechanism.
The service is currently available in Preview.
How AWS Greenlight works
There are three separate responsibilities involved:
- AWS Greenlight generates and analyzes policies.
- Dogwood provides the language in which those policies are expressed.
- Amazon Bedrock AgentCore Gateway or Strands Box enforces the approved policies.
This separation is significant because Greenlight itself does not need to be available every time the agent calls a tool.
Once deployed, the policies are enforced by the target platform.
flowchart TD
A["AI Agent"] --> B["Requested tool call"]
B --> C["Policy engine"]
D["Approved Dogwood policies"] --> C
E["Session event history"] --> C
C --> F{"Authorization decision"}
F -->|Allowed| G["Execute tool"]
F -->|Denied| H["Block execution"]
The model can still decide which tool it wants to call. Whether that operation is permitted is a separate decision.
1. Define the tools and their requirements
Consider a small support application with two operations.
A simplified TypeScript interface might look like this:
interface SupportTools {
verifyIdentity(
userId: string
): Promise<{ verified: boolean }>;
resetPassword(
userId: string
): Promise<void>;
}
This interface illustrates the application design. It is not an AWS Greenlight SDK integration.
For Greenlight to inspect these operations, they must be exposed through a supported enforcement platform, with schemas describing their inputs and observable results.
The verification result contains a boolean value.
Why does that matter?
Calling verifyIdentity() does not necessarily mean that the customer’s identity was successfully verified. The operation could return false, or it could fail entirely.
A policy that checks only whether the verification tool was called would therefore be insufficient.
Create a file named support-policy.md in your Greenlight project directory:
# Password Reset Requirements
The agent may reset a user's password only if:
- The user's identity was successfully verified.
- Verification belongs to the same user.
- Verification occurred during the current session.
- No more than 24 hours have passed since verification.
An unsuccessful verification or a failed verification
request must not establish permission to reset a password.
The 24-hour limit is a demonstration requirement, not a recommended validity period for real password-reset systems.
These requirements describe observable conditions rather than asking the model to make its own judgment about whether verification was sufficient.
2. Install AWS Greenlight and Dogwood
At launch, Greenlight’s setup tooling supports macOS and Linux. Native Windows installation is not supported.
You will need an AWS account, a configured AWS CLI profile, Rust, a C compiler, and one of the supported coding agents: Kiro, Claude Code, or Codex.
Download the official installer:
curl -fsSL \
https://downloads.aws.com/aws-greenlight/plugins/LTS/latest/install.sh \
-o greenlight-install.sh
Inspect the downloaded script before executing it:
bash greenlight-install.sh
The installer presents its proposed changes before continuing.
Dogwood must be installed separately. The initial Greenlight documentation specifies Dogwood CLI 1.1.0 and Rust 1.97.1.
rustup toolchain install 1.97.1
cargo +1.97.1 install \
--locked \
--root ~/policy-builder-deps \
[email protected]
Verify the installation:
~/policy-builder-deps/bin/dogwood --version
Check your AWS credentials as well:
aws sts get-caller-identity --profile your-profile
Greenlight provides separate IAM policies for analysis and enforcement. Follow the AWS installation guide to configure those permissions rather than granting unrestricted administrative access.
For this tutorial, assume an existing AgentCore Gateway with an attached policy engine.
If you do not have one, AWS provides a help desk sample in its Greenlight toolkit. Deploy that sample in a separate test account before proceeding.
3. Generate a policy
Open your supported coding agent in the directory containing support-policy.md.
Start Greenlight by entering:
govern my agent
Greenlight will ask which AWS account, Region, enforcement target, and information sources it should use.
Select your AgentCore Gateway and include the policy document created earlier.
The process involves several stages: identifying the agent, examining its tools and information sources, resolving ambiguous requirements, reviewing proposed decisions, approving the policies, and eventually enforcing them.
A requirement such as “verify the customer shortly before resetting the password” leaves room for interpretation.
Does shortly mean five minutes? An hour? The duration of a support ticket?
Greenlight can identify ambiguities like this and request clarification.
Our example specifies a time limit and requires verification of the same user. That gives the policy generator more precise conditions to work with.
4. Understand the generated Dogwood policy
Dogwood extends Cedar authorization policies with temporal conditions.
A conventional authorization rule might inspect the current request. Dogwood can also consider earlier events within a session.
The official AWS Greenlight documentation includes the following password-reset policy:
forbid (
principal,
action == AgentCore::Action::"helpdesk___reset_password",
resource is AgentCore::Gateway
)
unless temporal {
formerly within 24h
AgentCore::Action::"helpdesk___verify_identity"::response{
input.user_name: context.input.user_name,
output.verified: true,
eventResource: resource
}
};
This example uses the action names and schema fields from AWS’s help desk demonstration.
The generated policy for your own application may use different names.
Several details deserve attention.
The policy uses a forbid statement, meaning a password-reset request is prohibited unless the temporal condition is satisfied.
It examines a previous response event rather than merely a request.
The response must contain:
output.verified: true
An attempted verification is therefore not enough.
The policy also compares the username from the earlier verification with the username in the current request:
input.user_name: context.input.user_name
Without that comparison, verifying one account could potentially satisfy the requirement for resetting another account’s password.
Finally, the policy checks that the verification relates to the same gateway resource and falls within the specified time window.
Satisfying the condition removes this particular prohibition. It does not override other applicable authorization restrictions.
5. Keep session boundaries consistent
A temporal policy needs to know which earlier events belong to the current task.
AgentCore Gateway uses the following HTTP header for policy sessions:
x-amzn-bedrock-agentcore-policy-session-id
An application written in TypeScript could generate a new identifier for each support ticket:
import { randomUUID } from "node:crypto";
const sessionId = randomUUID();
const headers = {
"x-amzn-bedrock-agentcore-policy-session-id":
sessionId,
};
The same identifier must accompany the tool calls associated with that ticket.
This snippet only demonstrates session-header construction. The headers must be passed through your actual authenticated gateway transport.
A new support task should receive a new session identifier.
Session identifiers should also be managed by trusted application code, rather than allowing the model to select arbitrary identifiers belonging to other tasks.
Otherwise, the reliability of the session history becomes questionable.
6. Verify the policy before enabling it
Writing a policy and proving that it behaves as intended are different tasks.
Consider these possible sequences:
| Tool-call sequence | Expected result |
|---|---|
| Verify Alice successfully → Reset Alice | Not prohibited by this rule |
| Reset Alice without verification | Denied |
| Verify Alice successfully → Reset Bob | Denied |
| Verify Alice unsuccessfully → Reset Alice | Denied |
| Verification throws an error → Reset Alice | Denied |
| Verify Alice in another session → Reset Alice | Denied |
| Verify Alice → Wait 25 hours → Reset Alice | Denied |
These are expected decisions for the example policy, assuming there is no other qualifying verification event in the current session.
They are not results from an independently deployed Greenlight environment.
You can ask Greenlight to investigate particular properties:
Can the agent ever reset a password without
successfully verifying the same user first?
Or describe a specific sequence for evaluation:
What happens if the agent successfully verifies
Alice and then attempts to reset Bob's password?
The first question is particularly useful.
A conventional test checks the examples you thought to write. Greenlight’s automated reasoning analyzes whether any sequence permitted by the modeled policies could violate the specified requirement.
If it discovers a counterexample, the policy may need to be revised.
The result is still conditional on the accuracy of the schemas, modeled events, and assumptions used during analysis.
A mathematical proof about an incorrect model does not make the underlying application secure.
7. Approve and enforce the policies
Once you have reviewed the proposed policies and their verification results, enter:
approve
Confirm the approval when requested.
Approving a policy saves a version of it. It does not immediately activate enforcement.
For AgentCore Gateway, AWS recommends initially observing what the policies would block:
enforce it in log only
After collecting representative activity, ask:
what would it have denied?
This helps identify legitimate operations that the new restrictions might unexpectedly affect.
Be careful when selecting the logging mode. Changing the entire policy engine to log-only mode can also disable existing enforcement.
Use an isolated test gateway or review the per-policy configuration when existing restrictions must remain active.
Once the proposed behavior has been reviewed, enter:
promote
Confirm the enforcement change.
The gateway can then reject tool requests that violate the active policies.
If your agent uses Strands Box instead, the deployment process differs. Greenlight writes the approved policies into policy.dw, and the sandbox applies them when it next loads that file.
Strands Box does not provide the same log-only deployment mode.
What AWS Greenlight cannot guarantee
The policy checks are only as meaningful as the information available to the enforcement system.
Suppose the identity-verification tool returns:
{
"verified": true
}
But the implementation never actually checks the customer’s identity.
From the policy engine’s perspective, the required response exists. The defect is now inside the verification tool rather than the authorization rule.
Another concern is whether every sensitive operation passes through the enforcement layer.
If an agent can access a database, invoke a backend directly, or perform the same operation through another unrestricted interface, a gateway policy alone may not prevent it.
The application’s IAM permissions, network access, and tool implementations still matter.
There is also a data-handling consideration.
Greenlight and the coding agent can inspect recorded tool calls. Depending on the information sources selected, those records may contain sensitive customer information that is sent to AWS or the coding agent’s model provider.
Use synthetic data when evaluating the Preview, and review AWS’s data-handling documentation before connecting production logs.
The underlying Dogwood repository also contains a reference interpreter. Its maintainers explicitly state that it is not intended to serve directly as a production authorization engine.
Why this approach is useful
A system prompt can tell an agent that password resets require identity verification.
A temporal authorization policy can express which observable verification event must exist, which account it must concern, and how recently it must have occurred.
Those conditions can then be checked outside the model.
AWS Greenlight brings policy generation, analysis, review, and deployment into a single workflow, using Dogwood to represent restrictions that depend on previous actions.
Its usefulness will depend heavily on how applications expose their tools.
A tool with structured inputs and independently established results gives an authorization engine something concrete to evaluate. An unrestricted tool accepting arbitrary instructions gives it considerably less.
That distinction is worth considering before writing the policies themselves.
An agent should not be responsible for deciding whether it has permission to ignore its own restrictions.