
the Agent Harness Pattern on AWS:
As AI agents become more autonomous, the question is no longer "What can the model do?" but "What controls exist around the model?" The Agent Harness Pattern introduces a structured workflow of Plan → Act → Verify → Approve → Commit, enabling bounded, observable, and auditable agent execution on AWS. If you're designing production AI agents and thinking about governance, safety, approvals, and operational control, this article may be useful.
The Agent Harness Pattern on AWS: Plan, Act, Verify, Approve
How to put an AI model inside a workflow you can control, observe, and stop — using AWS Step Functions, Lambda, EventBridge, and Amazon Bedrock.
AI agents are easy to demonstrate. Running them safely in production is a different engineering challenge.
A typical agent follows a simple loop: model → tool → result → repeat.
But what happens when an agent modifies infrastructure, deploys code, or accesses sensitive systems?
Who approves the change? What happens if execution fails halfway through? How do you prevent an agent from running indefinitely?
This is where the Agent Harness becomes important.
What Is an Agent Harness?
An Agent Harness is the execution and control layer surrounding an AI model.
It manages tool access, workflow state, execution limits, verification, human approvals, and observability.
The model reasons and proposes actions. The harness controls what can actually execute.
A useful principle: The model proposes. The harness enforces.
This distinction becomes critical when agents interact with infrastructure, production environments, or systems with a significant blast radius.
Architecture: Building the Harness on AWS
The architecture follows five stages:
Plan → Act → Verify → Approve → Commit
AWS provides the infrastructure to implement this pattern without maintaining a dedicated orchestration server.
The core services are:
- AWS Step Functions: Durable workflow orchestration, retries, timeouts, and execution history.
- AWS Lambda: Isolated tool execution with least-privilege IAM permissions.
- Amazon Bedrock: Model inference, reasoning, and structured planning.
- Amazon EventBridge: Workflow triggers and failure notifications.
- Amazon S3: Evidence, logs, generated artifacts, and staged outputs.
- Amazon DynamoDB: Idempotency records and execution metadata.
The workflow starts when an event arrives through EventBridge, S3, or an API.
Step Functions coordinates the agent's decisions and tool calls while enforcing predefined execution boundaries.
The Four Core Operations
1. Plan — Let the Model Reason
The agent receives a task and generates a structured execution plan.
For example, an infrastructure agent might propose modifying an AWS security group.
The plan must pass schema validation and tool authorization checks before execution.
The model cannot grant itself additional permissions.
2. Act — Stage Before Committing
The agent invokes an authorized Lambda function to prepare a change.
For infrastructure deployments, this could mean creating an AWS CloudFormation change set rather than immediately applying it.
Each tool should have its own least-privilege IAM role.
Tool calls must also be idempotent, since retries can cause the same operation to execute more than once.
3. Verify — Trust Evidence, Not Model Claims
Verification should inspect actual system state.
For example, after creating a CloudFormation change set, the harness checks whether it introduces:
- Resource deletions or replacements.
- IAM or KMS modifications.
- Security group changes.
- Unexpected configuration differences.
These checks should be deterministic.
An LLM's explanation is not proof that an operation is safe.
4. Approve — Keep Humans in Control
For sensitive operations, AWS Step Functions can pause execution using the ".waitForTaskToken" callback pattern.
An authenticated reviewer receives the proposed change, verification findings, and supporting evidence.
The reviewer can approve or reject the operation.
Only an approved request proceeds to Commit. Rejected requests can return to planning or terminate safely.
For infrastructure changes, I recommend mandatory human approval before any production remediation, even when automated verification succeeds.
Real-World Example: An Infrastructure Agent
Imagine an agent investigating an incorrectly configured AWS security group.
Plan: The model identifies the suspected configuration issue and proposes a correction.
Act: Lambda creates a CloudFormation change set containing the proposed modification.
Verify: The harness inspects the change set and checks the affected resources and policy constraints.
Approve: An engineer reviews the actual configuration diff and supporting evidence.
Commit: After explicit approval, the authorized workflow executes the change set.
If verification fails or approval is denied, the change is not deployed.
The agent can investigate autonomously without receiving unrestricted authority to modify production.
Popular Agent Harnesses and Frameworks
Several modern frameworks demonstrate different aspects of this approach.
LangGraph:
Supports stateful agent workflows, checkpointing, and human-in-the-loop interactions. Useful for agents that need to pause, resume, and coordinate multiple execution steps.
OpenAI Agents SDK:
Provides agent execution loops, tool integration, handoffs, guardrails, and tracing. Useful for building observable, tool-using agents.
AWS Strands Agents :
An AWS-oriented, model-driven agent SDK supporting tool use and integration with AWS services. Useful for developing agents around Amazon Bedrock and other model providers.
Claude Code :
A practical example of a coding-agent environment where the model operates through tools, permission boundaries, and execution controls.
These systems are not identical, and none automatically guarantees production safety.
A custom AWS harness can complement them by enforcing organization-specific IAM policies, approval requirements, execution budgets, and audit controls.
Why AWS Step Functions?
AWS Step Functions Standard workflows offer several useful properties for agent execution:
Durability: Execution state persists across individual Lambda invocations.
Controlled retries: Retry and Catch policies define failure handling explicitly.
Human approval: Callback tasks allow workflows to pause while waiting for an external decision.
Observability: Execution history records workflow transitions and outcomes.
However, three constraints matter:
- Standard workflow execution history is limited to 25,000 events.
- State payloads are limited to 256 KiB.
- Long-running human approval callbacks require Standard workflows rather than Express workflows.
Large artifacts should remain in S3, with object references passed through workflow state.
Execution budgets should limit iterations, tool calls, time, and cost.
Production Safety Checklist
Before deploying an agent harness, verify that it includes:
- Hard execution and cost limits.
- Least-privilege IAM permissions for every tool.
- Idempotent operations and controlled retries.
- Deterministic verification against real system state.
- Explicit human approval for sensitive changes.
- Authenticated, expiring approval requests.
- EventBridge alerts for failed or timed-out executions.
- Audit records with sensitive information appropriately protected.
An important distinction: Step Functions provides execution history, but a production audit design may also require CloudTrail, protected evidence storage, retention policies, and access controls.
Final Thoughts
AI agents are moving beyond answering questions toward interacting with real infrastructure, applications, and business processes.
That transition requires more than capable models.
It requires controlled execution, verifiable outcomes, clear authority boundaries, and the ability to stop an agent before a mistake becomes a production incident.
The future of reliable agents is not just better reasoning. It is better control over what reasoning is allowed to execute.
AWS Step Functions, Lambda, EventBridge, and Bedrock provide a practical foundation for building that control layer.
Views are my own and do not represent an official AWS publication.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article