AI · Automation · Engineering

Prove AI Agent Control Before Production

By Lazar MilicevicNovember 22, 202610 min read
Developer workstation used to verify AI agent control before production

A tool call is where an AI agent stops being a text generator and starts changing a system. I can inspect a good-looking answer before anyone uses it. I cannot inspect away a tool call that has already published content, changed a record or triggered an external workflow.

That is why I do not treat “the agent passed its tests” as a production security decision. I want evidence that its permissions are bounded, its actions are visible and its operators can stop it through a control that actually blocks the next action.

Start with the action, not the model

The security boundary for an AI agent is the action it can take on a specific resource. A model may propose a tool call, but the authorization decision belongs in the application and cloud infrastructure around that call. A prompt telling the agent to behave is not a substitute for permission checks.

I start by writing down the actions the workflow needs. “Manage content” is too broad. “Create a draft for an approved site” and “publish an approved draft to that site” are different capabilities, with different consequences. The distinction matters even if both actions are exposed through the same integration.

For each action, I want to know:

  • Which identity makes the call?
  • Which resource can it reach?
  • What inputs are allowed?
  • Where is the decision enforced?
  • What record will show that the action happened?
  • What stops the action if the agent or operator gets it wrong?

That exercise often exposes a gap before any security tool does. The model may be using a narrow tool name while the tool’s service credential has broad access. Or the application may check the requested site, but the downstream publishing API accepts an arbitrary site identifier from the agent’s arguments. In either case, the meaningful boundary sits deeper than the prompt.

AWS recommends granting Amazon Bedrock resources only the permissions needed to perform a task. For Bedrock Agents, the service role permissions can cover distinct dependencies, including models, action-group schemas and knowledge bases. An agent using a Lambda action group also needs a resource-based policy on the Lambda function. I review both sides of that relationship: what the agent role may use, and who may invoke the function.

I also check runtime isolation, not just IAM policy documents. AWS warns against running agents with different permissions in the same AgentCore Runtime Instance session, because code on the instance can read the agents’ execution-role credentials. If two workflows have different authority, a shared session can undermine the separation I thought I had created.

My acceptance test is deliberately adversarial: I ask the agent to attempt an action outside its assigned scope and verify that the infrastructure rejects it. A refusal in the model’s answer is useful behavior. A denied tool call is evidence of a boundary.

Check exactly where tool policy applies

A policy only protects the calls it evaluates. Before relying on an agent gateway or tool broker, I trace the complete path from model output to the underlying API and identify every route that can perform the same action.

This is particularly important with MCP integrations. AgentCore Gateway policies authorize MCP tool calls, but do not apply to MCP prompts or resources. That is a concrete scope distinction, not an implementation detail to leave for later. If an agent can retrieve sensitive material through a resource path, a tool-call policy does not, by itself, govern that retrieval. If an application can call the underlying service without going through the gateway, the gateway policy does not cover that path either.

I map the flow as plainly as possible:

agent request → tool selection → policy decision → integration credential → external action

Then I test where untrusted input enters it. A retrieved document can suggest a tool call. A tool response can contain instructions. An agent can supply a valid tool name with an unauthorized resource identifier. The policy has to evaluate the requested action and its relevant context, not merely recognize that the caller is an agent I deployed.

The distinction between observing a policy and enforcing it is equally sharp. AgentCore Gateway policy engines support LOG_ONLY, which evaluates decisions without enforcing them, and ENFORCE, which allows or denies operations. AWS also distinguishes engine-level from individual-policy LOG_ONLY: engine-level LOG_ONLY prevents enforcement of every policy in that engine.

I would use observation mode to learn what a policy would affect before turning it on. I would not call that protection. After enabling enforcement, I would replay known allowed and denied calls and inspect the actual outcomes. I would also restrict who can change that setting: AWS warns that a principal with bedrock-agentcore:UpdateGateway can switch an engine from ENFORCE to LOG_ONLY or remove it. A control that an unrelated deployment credential can silently disable is not a boundary I would sign off on.

Make decisions observable without pretending logs are control

For production agents, I need to reconstruct why an action was attempted, whether policy allowed it and what the downstream system did. A successful application response does not answer those questions. Nor does a trace of the model’s reasoning prove that the external action completed.

I link the records around a stable request or job identifier. At the application layer, I record the workflow identity, requested tool, target resource, policy result and downstream outcome. I keep sensitive inputs out of general-purpose logs where possible. If an investigation needs payloads, access to them should be deliberate rather than an accidental consequence of logging everything the model saw.

Cloud records need configuration checks, too. For Amazon Bedrock InvokeAgent calls, AWS instructs users to configure advanced CloudTrail event selectors for AWS::Bedrock::AgentAlias data events. I would verify that an actual test invocation appears, rather than assuming that enabling CloudTrail somewhere in the account captures the event I need. For AgentCore Gateway policy decisions, policy evaluation spans are available after tracing is enabled on the gateway. That condition belongs in the deployment checklist.

The practical test is a reconstruction exercise. Trigger an allowed call, a denied call and a downstream failure. Then ask someone who did not run the tests to explain each outcome using the records available to an operator. If they cannot tell a policy denial from a tool failure, I do not yet have useful observability.

I built a serverless AWS and Zendesk integration that delivered first-ever SLA compliance. The lesson I carry from that kind of event-driven work is that a trigger firing is not the same as the business action completing. Agent workflows add model decisions to the chain, but the operational question stays the same: can I account for what happened at every consequential handoff?

Test the stop path as a separate system

An agent kill switch must block a defined route to action, and its scope must be documented. “We can disable the agent” is too vague until I know whether that stops new invocations, queued jobs, active work, tool calls or credentials used by another route.

For a Bedrock Agent, the deployment documentation describes a working DRAFT version and test alias, with deployment through an alias. It also documents pausing an alias with aliasInvocationState set to REJECT_INVOCATIONS, and resuming it with ACCEPT_INVOCATIONS. I would test that pause against new calls to that alias. I would not treat it as proof that credentials have been revoked or that another path to the underlying tools has stopped.

My stop plan has layers:

  • Invocation: Reject new requests at the entry point or agent alias.
  • Scheduling: Stop workers from picking up new agent jobs.
  • Action: Deny consequential calls at the tool or API boundary.
  • Credentials: Revoke or rotate access when the credential itself may be exposed.
  • Recovery: Identify work already accepted, determine what completed and decide what needs correction.

Each layer answers a different failure. If a publishing agent begins proposing unauthorized sites, an action-level denial should protect those sites even before an operator intervenes. If the problem is a bad deployment, pausing new invocations and routing back to a known version may contain it. If a credential is compromised, neither a prompt change nor an alias pause is sufficient.

I rehearse the stop path with a harmless test action. The operator should be able to identify the relevant control, activate it, confirm that a new action is blocked and see what happened to work already in progress. I set expectations for response time based on the workflow’s actual risk and dependencies, then measure the rehearsal. I would not borrow a universal threshold from an unrelated system.

Roll out evidence, not confidence

A staged rollout is useful when each stage tests a specific failure mode and has a defined rollback action. Gradually sending more work to an agent does little for safety if nobody has verified permissions, telemetry or the stop path first.

I prefer a promotion sequence built around observable gates:

Gate Test I run Evidence I keep
Scope Attempt permitted and forbidden resource access Tool outcomes and permission decisions
Policy Replay allowed and denied calls in enforcement mode Policy result and downstream result
Visibility Trace a completed, denied and failed action Records linked to the same job
Stop Block a new invocation and a new tool action Rejected requests at both boundaries
Recovery Route away from a bad deployment Version change and follow-up action checks

Early stages can use representative requests against non-consequential actions. Later stages need the real identities, integration paths and policy settings that production will use. Otherwise, I have tested a simulation of the deployment rather than the deployment boundary.

Bedrock allows an agent alias to point back to a previous version when a change needs to be reverted. That is a useful rollback mechanism for agent behavior. I still ask what else changed: tool schemas, application routing, integration credentials and data access may have changed independently of the agent version. A rollback plan that covers only the prompt leaves those changes in place.

The VentureBeat analysis on proving AI cloud control makes a useful distinction between protected processing and authorized agent actions. It identifies Nebius as a paid media partner, which readers should know when weighing the piece. My operational test remains narrower: show me the request that should have been denied, the control that denied it and the record an operator would use to verify that result.

What I’d do before approving an agent

I would approve a production agent only after seeing failed unauthorized actions, successful authorized actions and a rehearsed way to stop new harm. Documentation and architecture diagrams are necessary, but I want results from the deployed path.

I would sit with the engineer who owns the workflow and walk one consequential action end to end. We would name the calling identity, inspect its permissions, test a resource outside its scope and locate the resulting logs. Then we would change or pause the agent and confirm what actually stops. Anything we cannot explain becomes a deployment task, not a risk accepted by default.

This is relevant to my own work on BizFlowAI ContentStudio, which researches, writes, optimizes and publishes content across sites. Those verbs do not carry equal risk. Research can inform a draft; publishing changes what readers see. I would assess those capabilities separately, particularly where an autonomous loop turns measured performance into its next action.

The useful question is not whether an AI agent seems reliable in a demo. It is whether the team can prove what the agent is allowed to do, detect what it did and intervene when reality differs from the plan. If you are working through those questions for an agent you intend to deploy, get in touch.

Frequently asked questions

How do I know an AI agent is safe to put in production?

I do not treat passing tests or producing good answers as a production security decision. I identify each action the agent can take, the resource it can affect, the identity it uses and where authorization is enforced. Before release, I test an out-of-scope action and verify that infrastructure rejects the tool call.

Why isn't a prompt enough to control an AI agent's tool calls?

I treat the action on a specific resource as the security boundary. A prompt can tell the model to behave, but it cannot replace permission checks in the application and infrastructure. I verify that the integration credential and downstream API cannot perform actions outside the agent's assigned scope.

What should I check when using Amazon Bedrock Agents with a Lambda action group?

I review the agent's service-role permissions for the dependencies it needs, such as models, action-group schemas and knowledge bases. I also review the Lambda function's resource-based policy to confirm who can invoke it. If workflows have different authority, I avoid putting them in the same AgentCore Runtime Instance session, where code can read their execution-role credentials.

Do AgentCore Gateway policies cover every MCP interaction?

No. I account for the fact that AgentCore Gateway policies authorize MCP tool calls, not MCP prompts or resources. I also trace any route that can reach the underlying service without passing through the gateway. A gateway policy cannot protect an action or retrieval path it never evaluates.

Does AgentCore Gateway LOG_ONLY mode block unauthorized tool calls?

No. I use LOG_ONLY to observe policy decisions before enforcement, not as protection; engine-level LOG_ONLY prevents enforcement of every policy in that engine. After switching to ENFORCE, I replay allowed and denied calls and check their actual outcomes. I also restrict who can update the gateway, because that permission can be used to disable enforcement.

Lazar Milicevic

Lazar Milićević

Senior Technical Engineer. I build AI automation, GenAI/LLM systems and cloud architecture — autonomous systems that run while you sleep. Founder of BizFlowAI.

Building something hard with AI or automation? I am open to talk.

Get in touch

← All posts