Lesson 4 of 4 Agentic AI on AWS

Keeping Agents Safe with Least Privilege, Human Approval and Observability

This lesson explains how responsible agent design limits what an agent can do, keeps people in the loop for important actions, and records what it did. Agents act by calling tools and APIs, so a mistaken or manipulated agent can delete data, send messages or spend money.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify the risks specific to agents, such as excessive agency.
  • Describe the controls that limit agent risk, such as least privilege and human confirmation.

Risks specific to agents

AI agents act autonomously and therefore introduce particular risks. The following list describes these risks.

  • Excessive agency: the agent has more permissions or tools than it needs.
  • Prompt injection through tools: a web page or email the agent reads contains instructions that redirect it.
  • Runaway loops: the agent repeats steps, consuming tokens and API calls.
  • Unclear accountability: no record of why an action was taken.
Match the pairs

Agent risks

Exam skills 5.1.4 · 2.1.6

Match each incident with the agent risk it shows.

Log in to try this activity Interactive activities are free with an account.

Controls

Agents take actions on behalf of users, so a mistake or a manipulated prompt can have real consequences, and several controls limit the risk. Least privilege for tools gives each tool, such as a Lambda function behind an action, a narrowly scoped IAM role, so an agent can do only what that tool is meant for. Acting on behalf of the user passes the user's identity to tools, through AgentCore Identity, so each tool enforces that user's own permissions rather than broader ones.

Human approval asks the user to confirm before consequential actions, such as payments, deletions or sending email. Content filters, through Bedrock Guardrails, check inputs, outputs and the results that tools return. Limits cap the number of steps, tokens and spending per session, so an agent cannot run away. Observability traces each step and tool call, through AgentCore Observability, CloudWatch and model invocation logging, so behaviour can be reviewed. The following table summarises the controls.

ControlImplementation on AWS
Least privilege for toolsEach action's Lambda function or API has a narrowly scoped IAM role
Act on behalf of the userPass the user's identity so tools enforce that user's permissions (AgentCore Identity)
Human approvalRequire user confirmation before consequential actions (payments, deletions, sending email)
Content filtersBedrock Guardrails on inputs, outputs and tool results
LimitsCap iterations, tokens and spending per session
ObservabilityTrace each step and tool call (AgentCore Observability, CloudWatch, model invocation logging)
Troubleshooting scenario

Making an agent safe

Exam skills 5.1.1 · 5.1.4

Choose the control that prevents each incident from happening again.

Log in to try this activity Interactive activities are free with an account.
Worked example

A company builds an agent that can look up orders and issue refunds. It must not be possible for the agent to issue a large refund because of a misleading message. What should the design include?

Require human confirmation for refunds (at least above a threshold), restrict the refund tool's permissions and amount limits in the tool itself rather than in the prompt, apply guardrails, and log every action for audit.

Check yourself

Why should an agent need human approval for some actions?

Show answer

Actions with high impact, such as payments or deleting data, should not depend only on a model's judgement. Approval keeps a person accountable and limits the damage from mistakes or prompt injection.

Exam Tips

Remember for the exam

  • Give agents and their tools the least privilege needed.
  • Require human approval for consequential actions.
  • Enforce limits in tools and IAM, not only in prompts.
  • Treat content the agent reads as untrusted input.
  • Trace and log every step for accountability.