Skill 2.3.4
Secure AI agent interactions (for example, by using tool-use authorization, session isolation, human-in-the-loop approval flows for sensitive actions).
Key Concepts
Tool-use authorisation treats every tool call as a request that needs its own permission check. Each tool runs with least privilege, so a tool that reads orders cannot refund them. AgentCore Gateway turns Lambda functions and APIs into Model Context Protocol (MCP) tools behind one authenticated endpoint, and AgentCore Identity handles inbound authentication (who may call the agent, with IAM or a JWT from an identity provider) and outbound authentication (OAuth tokens or API keys held in a token vault, used to call a tool on the user's behalf after the user consents). AgentCore Policy evaluates deterministic, Cedar-compatible rules on every tool call that passes through Gateway, for example allowing refunds only below a limit, so the decision does not depend on the model's judgement.
Session isolation keeps one user's context away from another's. AgentCore Runtime gives each session its own microVM with separate CPU, memory and file system, terminates it when the session ends and sanitises its memory. The application must send a unique runtimeSessionId of at least 33 characters for each user or conversation and keep the mapping between users and sessions itself, because AgentCore does not enforce it. Session context keys in the execution role policy can scope each session to its own S3 prefix.
Human-in-the-loop approval pauses the agent before sensitive actions such as payments, deletions or emails to customers. Agents for Amazon Bedrock can require user confirmation before an action group function runs, or return control to the application so that it performs the action itself. In a workflow, an AWS Step Functions task with a .waitForTaskToken integration waits until an approver's decision is sent back with SendTaskSuccess or SendTaskFailure.
Further controls limit the damage of a compromised conversation: input and output guardrails, a maximum number of steps and a timeout for each run, separate tools for read and write operations, and a full record of tool calls in AgentCore Observability so that every action can be traced to a session and user.