2.1.3 · Lesson 3 of 25
Safeguarded AI Workflows
Agentic systems need boundaries.
Overview
Agentic systems need boundaries.
Without controls:
Agent ↓ Tool ↓ Tool ↓ Tool ↓ Tool ↓ Unexpected behavior
A production system should have:
- stopping conditions
- timeouts
- permissions
- failure protection
- resource boundaries
Stopping Conditions
Define when the workflow must stop.
Examples:
Task completed OR Maximum attempts reached OR Confidence threshold reached OR Timeout OR Human rejection
Example:
Agent
↓
Attempt task
↓
Success?
├── Yes → STOP
└── No
↓
Attempts < 3?
├── Yes → Retry
└── No → STOP / EscalateLambda Timeout
A Lambda function should not run indefinitely.
Timeout provides a hard execution boundary.
Agent ↓ Lambda ↓ External API ↓ Timeout reached ↓ Stop execution
IAM Boundaries
IAM controls what AWS resources the workload can access.
Example:
Agent ↓ IAM Role ├── Read S3 ├── Invoke Lambda └── Invoke Bedrock
But it should not automatically receive:
Delete production database Create arbitrary IAM users Access all company data
Principle
Least privilege
Give the AI workflow only the permissions it actually needs.
Circuit Breaker
Circuit breaker protects a system from repeatedly calling a failing dependency.
Without circuit breaker:
Request ↓ Fail ↓ Retry ↓ Fail ↓ Retry ↓ Fail ↓ System overload
With circuit breaker:
Request ↓ Dependency failing ↓ Circuit opens ↓ Stop requests temporarily ↓ Dependency recovers ↓ Resume
High-yield
Timeout = limits how long an operation runs.
Circuit breaker = stops repeated calls to an unhealthy dependency.
IAM = controls permissions.
Stopping condition = controls when workflow ends.
Key points
- stopping conditions
- timeouts
- permissions
- failure protection
- resource boundaries
- Stopping Conditions
- Lambda Timeout
- IAM Boundaries
Exam focus
Least privilege Give the AI workflow only the permissions it actually needs.