Defend and operate / Module 12

Constrain AI agents with identity, policy, and small tools

Design an agent runtime where untrusted instructions cannot silently become broad authority.

65 minutes Intermediate Practical lab
01

Decompose autonomy

An agent may interpret a goal, plan steps, choose tools, construct arguments, observe results, and continue. Do not place all of those responsibilities behind one unconstrained model call.

Use an orchestrator that enforces policy and budget, task-specific tools with narrow schemas, server-side authorization, and an execution layer that can reject or simulate proposed actions.

02

Give the agent its own identity

Avoid silently reusing a human's full session. Use workload or agent identities with scoped, short-lived credentials and explicit delegation. Bind permissions to the task, tenant, data class, tool, and time window.

Record both the requesting human and executing agent. Prevent an agent from creating stronger credentials or changing its own policy.

  • Read-only by default; write access is explicit and narrow.
  • High-impact actions require preview and human confirmation.
  • Destinations, amounts, recipients, and data classes use allow-lists or policy.
  • Rate, cost, step, and time budgets stop runaway loops.
  • Every external change has an idempotency key or rollback plan.
03

Treat memory as a governed data store

Agent memory can retain incorrect, sensitive, or attacker-influenced content. Separate user, task, and organizational memory; attach provenance and expiry; restrict writes; and make memory inspectable and deletable.

Do not let retrieved or remembered content modify authorization policy. Policy belongs in a trusted control plane.

The model may propose. The control plane must decide.

Practice

Design a safe ticket-closing agent

Safety boundary: Use a fictional service desk and local ticket fixture.

  1. 01

    Define the allowed action: close only low-risk tickets assigned to the test user.

  2. 02

    Create a read tool, a propose-close tool, and a separate execute-close function.

  3. 03

    Add server-side checks for owner, risk class, state, and approval.

  4. 04

    Simulate an injected ticket description that asks the agent to close another user's ticket.

  5. 05

    Confirm the authorization layer blocks the action and logs the reason.

Checkpoint

Ready to move on?

Go deeper

Primary sources for this module

All resources
Previous module11 · Make AI red teaming repeatable, scoped, and decision-relevant Next module13 · Secure the AI supply chain and cloud runtime
Share this module LinkedIn Email Permanent link