Menu

1 / 2

My AI Agent Followed the Rule Because I Asked. Now It Has No Choice.

DEV Community: aws·Lalit Bagga·about 3 hours ago
#EmMKPE35
#devtoaws#devto#dev#rule#tool
Reading 0:00
15s threshold

My agent had one rule, only answer about production. That rule was a sentence in its prompt, and a sentence is only a request. So I added a real check at the door of the tool, and the same call for staging was refused.

An AgentCore Gateway is the front door to an agent's tools. A policy is a rule at that door that checks every call before the tool runs. The agent cannot talk its way past it, because the check happens outside the agent's code.

What was holding it back before

In my last post I ran my CloudOps agent as my own code. I asked it about staging, and it said it could only help with production.

That answer came from its prompt. The model chose to refuse. Nothing stopped the tool call itself.

## What I did

I added one rule to the Gateway. It says: the deployment status tool is allowed, but only when the call asks about production. That is the whole rule.

It took three steps. I wrote the rule in a small file, added it to a policy engine with the AgentCore command line tool, and deployed.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.