Agent execution and actions
An agent can use tools to change records, run code, initiate transactions, or control a device. For example, a service-desk agent might search tickets and propose closing one. The application must authorize the closure, validate the target ticket and parameters, and record the result. Operators also need a way to stop execution or recover from an incorrect or incomplete action.
The following controls cover agent execution and action-capable tools. They also apply to fixed workflows that can make the same changes. Use them with the applicable model inference
Security considerations
Injected instructions can cause an agent to misuse otherwise valid tool permissions.
Reused sessions or delegated credentials can expose another user's data and authority.
Repeated calls, retries, and resumed tasks can exceed spending or operational limits.
An agent that can approve its own request, alter approved parameters, or bypass the executor can perform changes outside the intended approval.
Infrastructure security
Isolate agent and tool execution
Amazon Bedrock AgentCore Runtime provides an execution environment with session isolation for hosted agents. The application team configures a dedicated execution role and the network access the workload needs. Bind each session to the authenticated user and reject attempts to resume another user's session, as described in Runtime security best practices. Service-level session isolation does not establish this ownership.
Set per-user request limits and task limits for duration, model tokens, tool calls, and spending. Measure representative successful tasks
Use Runtime session limits and, when using Amazon Bedrock AgentCore harness, its invocation limits. Use Amazon Bedrock AgentCore Gateway identity rate limits to constrain tool traffic, accounting for their documented fail-open behavior. Enforce cumulative task budgets outside the agent's control loop, in trusted application code across retries and resumed sessions. A new invocation must not reset the task's spending authority.
Amazon Bedrock AgentCore Code Interpreter and Amazon Bedrock AgentCore Browser provide options for managed code execution and browsing. Choose each service's network mode according to its supported configuration. Sandboxing limits process interaction, while credentials and network access determine the resources code can reach from inside the sandbox. Restrict access to data and destinations to limit the consequences of compromised agent code.
For agents and tools on Amazon Elastic Compute Cloud (Amazon EC2), Amazon Elastic Container Service (Amazon ECS), Amazon Elastic Kubernetes Service (Amazon EKS), or AWS Lambda, apply the relevant image, patching, isolation, and vulnerability-management controls from the inference baseline. Keep tool permissions separate where actions have different consequences. A single broadly privileged runtime increases the scope of what an injected instruction can influence.
Protect public application APIs with AWS WAF on supported front ends. For inspected Amazon Virtual Private Cloud (Amazon VPC) egress, route the intended paths through AWS Network Firewall and restrict destinations to reviewed dependencies. Apply the DNS filtering baseline to agent and tool VPCs. Enforce tool authorization independently of these network controls, and verify alternate network and invocation paths as part of the design.
Configure AgentCore harness
AgentCore harness runs a managed agent loop inside Runtime. Apply the Runtime isolation and execution-role controls, and review the following configuration:
Approve model providers, endpoints, and credential sources. Check guardrail and logging coverage for the selected endpoint and API, and approve data handling before using an external provider.
Validate caller-supplied configuration before invocation. Model parameters can change routing, credentials, and Regions. Restrict model and skill overrides, and review skill instructions and scripts from approved Amazon Simple Storage Service (Amazon S3) or Git sources.
Use inbound OAuth with bearer JSON Web Tokens (JWTs) when downstream tools need the user-scoped credentials from Amazon Bedrock AgentCore Identity. Signature Version 4 (SigV4) authentication does not propagate per-user identity through the harness.
Restrict direct commands and interactive shells to approved operators. For shell access, scope AWS Identity and Access Management (IAM) permissions for SigV4 callers and configure the inbound authorizer for bearer-token callers. Review the agent's built-in tool access separately.
Set iteration, token, and time limits for each invocation and idle and lifetime limits for sessions. Validate caller overrides. Record harness invocation, command, and shell data events under
AWS::BedrockAgentCore::Runtimein AWS CloudTrail. Shell audit events do not contain terminal input or output.
Design for containment and recovery
Containment requires coordination between the application owner and the security team. The application owner should be able to disable a tool or agent, and the security team should have an agreed procedure to revoke access and preserve evidence. The procedure must account for active sessions, cached credentials, queued work, and in-progress transactions because blocking new requests might not stop work already running.
For AWS Agent Registry records, reject a record to temporarily remove it from discovery during investigation; it can be approved again. Deprecation is permanent and cannot be undone. These catalog changes do not revoke access to the underlying tool or stop active sessions, so apply the service's containment controls as well.
Use Amazon Inspector for supported compute and container scanning, and AWS Systems Manager for approved maintenance and response on managed nodes. Restrict who can run automation and commands, scope their execution roles, and retain operation records. These services manage applicable customer compute; they do not give you access to the hosts underlying serverless AgentCore sessions.
Use the AWS Security Reference Architecture (AWS SRA) for cyber forensics to align evidence preservation with the organization's incident response architecture. Exercise the containment procedure in a controlled environment and define how to restore service safely.
Automate restoration only through a tested, preauthorized runbook with defined limits. Recheck the current state before acting; AWS Config automatic remediation can use an outdated compliance snapshot. Restoring an approved endpoint version or enforcement setting can still interrupt work. Require approval when a response introduces permissions or behavior outside the approved baseline, exceeds the runbook's limits, or has uncertain effects on data or transactions.
Identity and data security
Authorize downstream actions
In the ticket-closing example, the requesting user and the agent's execution identity are distinct. The downstream system must determine whether the requested closure is permitted, using the originating user and the permissions delegated for the task. Signing in to the agent alone does not authorize the closure.
Dedicated IAM roles define workload permissions. AgentCore Identity provides credential brokering where required. Preserve the originating identity across delegated calls and verify which identity and permissions the downstream service uses to authorize the action. Authenticate peer agents and authorize each delegated task at the receiving boundary. Treat messages as untrusted input and restrict outgoing content to the recipient's permissions. Use message signing when integrity or proof of the originating agent must survive intermediaries.
AgentCore Gateway centralizes tool access. Use Policy in Amazon Bedrock AgentCore to authorize production tool calls. Attach a policy engine to the gateway in ENFORCE mode and set each required policy's enforcement mode to ACTIVE. Test rules against permitted and denied requests before release. LOG_ONLY mode records decisions without enforcing them. Restrict bedrock-agentcore:UpdateGateway to the release role because it can change the gateway to LOG_ONLY or remove its policy engine. Define permissions for the caller, requested tool, and permitted action context, and reject requests that lack the identity needed for authorization.
Gateway policy evaluation applies to MCP tools. It does not restrict MCP prompts or resources; protect sensitive content exposed through those methods separately.
Use a Cedar tool authorization policy to scope a permit to a trusted caller claim, tool, and gateway. Review all policies for additional permissions, then test missing claims, a different caller, and a different tool. Keep target permissions scoped and prevent alternate invocation paths from bypassing the enforcement point. Apply equivalent authorization in self-hosted tools and the shared IAM review controls.
Limit permissions and protect stored context
Grant the agent's normal execution role only the permissions for the resources and actions that its task needs, and keep administrative privileges separate. Protect credentials with AWS Secrets Manager or the selected identity service, restrict secret readers, and make rotation part of tool lifecycle management.
Conversation memory and tool results can contain sensitive information. When the application uses Amazon Bedrock AgentCore Memory for persistent context, configure its authorization and retention controls. Validate content before it enters or is reused from memory, including tool results, agent messages, and consolidated records. Apply sensitive-data controls to these paths, retain source provenance, and check memory integrity before use. Quarantine corrupted records and invalidate dependent context before resuming affected tasks. Configure AWS Key Management Service (AWS KMS) key policies for resources that accept customer managed keys, and use Transport Layer Security (TLS) for network connections. Runtime, memory, gateway, and log resources have their own encryption options, so review each one individually.
For payment workflows using Amazon Bedrock AgentCore payments, establish the permitted spending scope, expiry, and approval requirements before enabling transactions. Validate the intended merchant and payment destination in trusted application code; do not assume that a spending limit enforces a destination allow list. The x402 payment protocol does not replace the organization's payment authorization policy. Apply the same principle to account changes, external messages, and other consequential operations: define the authority at the target boundary. Model instructions do not enforce that boundary. Payment-capable agents have higher commercial and regulatory impact. Follow the Amazon Bedrock AgentCore payments security best practices and the relevant human-in-the-loop workflow to help confirm that required security controls are in place. The AWS blog post Technical deep dive: AgentCore Payments and innovation in agentic commerce
AI application security
Validate actions outside the model
The model proposes an action; a separate component authorizes and executes it. Expose tools with defined operations, validated parameters, and explicit limits on what they can change. For actions that require human approval, use an independent approval workflow:
Record the authenticated requester, exact operation, target resource, parameters, and expiry.
Present that request to an authorized approver. Record the authenticated approver, decision, time, and exact request approved. Protect this record from the agent and its tools.
At execution, verify that approval covers the unchanged request, remains valid, and has not already been used. Recheck the caller's current authorization.
Record the result and reconcile partial failure before retrying.
Determine approval requirements in trusted policy code. Present independent policy and manipulation warnings with the exact request. For the highest-risk actions, require independent reviewers and keep disagreements or expired requests blocked. Monitor queue age, review time, and decision reversals; escalate overload and keep requests blocked until review is complete.
An AWS Step Functions Standard workflow with a callback task can wait for the approval service before invoking the executor. Use a supported callback integration, such as the Amazon Simple Queue Service (Amazon SQS) callback example; the optimized AgentCore integration cannot use .waitForTaskToken. Restrict access to the task token. Explicitly deny states:SendTaskSuccess to the agent role and exclude callback operations from roles and tools it can invoke. Callback actions require Resource: "*"; the AgentCore Step Functions connector cannot restrict them to its configured state machine. Grant completion to the independent approval service only. Test self-approval through every reachable path and completion of an unchanged, authorized request. The application implements the approval binding and replay checks above.
Apply Amazon Bedrock Guardrails to the relevant content paths, alongside tool schema validation and target authorization. Where responses must agree with explicit business rules, use Automated Reasoning checks and handle their findings in the application before proceeding. A content filter is not an action permission check. Evaluate sequences of actions as well as individual calls: several permitted operations can combine into an unintended outcome. If you use temporal policy in AgentCore, review its session and deployment requirements separately from point-in-time Cedar rules.
Govern configuration changes
Review changes to prompts, model choices, tools, skills, and orchestration as production changes. Require curator approval before making Registry records
Evaluate and approve changes proposed by Amazon Bedrock AgentCore optimization before adoption. Preserve the configuration version associated with an action so investigators can reconstruct its context.
Point a named production AgentCore Runtime endpoint to an approved immutable runtime version. The DEFAULT endpoint advances when a new version is created. Restrict endpoint updates to the release role and detect changes to an unapproved version. Existing microVM sessions retain their original code; assess active sessions separately when rolling back or containing an incident.
Review custom orchestration and action-executor code through the application code review workflow
Apply the shared configuration checks
Correlate actions and security findings
Use Amazon Bedrock AgentCore Observability and Amazon CloudWatch to correlate requests, tool calls, and outcomes. Custom code-based evaluators in Amazon Bedrock AgentCore Evaluations can check captured traces against application rules. Test authorization and recovery in the application as well; sampled traces and quality scores do not establish that access controls work. AWS Continuum for penetration testing can test application endpoints within an approved scope. Use separate test memory, tool endpoints, and permissions to contain test effects. Supplement automated tests with periodic human-led exercises covering memory poisoning, delegated prompt injection, and approval bypass. Use the results to update detections, response procedures, and regression tests. For a sample implementation of controls such as validating content before memory writes, scoping namespaces to the verified actor, and periodically reviewing and purging memory to help defend against memory poisoning, see the AWS Security Blog post Help defend against memory poisoning in Amazon Bedrock AgentCore with multi-layer write validation
Enable AWS CloudTrail data events for AgentCore Gateway when gateway invocation records are required; CloudTrail does not capture these events by default. Combine supported CloudTrail API events with application traces that record the initiating user, event, schedule, or agent, along with the session, tool and configuration versions, authorization decision, and downstream result. Enable trace propagation across agent and tool services. Preserve an application correlation ID across asynchronous boundaries where a new trace can start. Remove credentials and unneeded prompt or tool content before exporting telemetry. Protect log access and retention. Use Amazon Athena for approved queries over evidence stored in S3 buckets, and restrict access to the relevant datasets and query results.
Apply the shared detection controls
Use AWS DevOps Agent to investigate operational incidents across connected workload accounts and propose mitigation. Connect approved telemetry sources and scope investigation permissions to the workload. AWS DevOps Agent turns off directed actions by default. Enable them only for approved response procedures; every directed action requires operator approval. Handle security incidents through the organization's incident response process and retain evidence using the AWS Security Reference Architecture (AWS SRA) cyber forensics guidance.
Design considerations
Human approval adds a review step, but the action still needs authorization and validation. Include the approval workflow in the architecture review.
A task can span several agents, tools, and downstream services. Assess permissions and data exposure across the complete sequence.
Some operations cannot be retried or reversed. Define how to reconcile incomplete work, compensate for completed changes where possible, and escalate failures.
Role and policy templates, guardrail policies, and logging standards reduce repeated design work. New models, data sources, tool permissions, or Regions still need review against the approved baseline.
Agree on who can stop the agent, who investigates its actions, and what evidence is required before it resumes operation.