AWS Builder Center
Give AI Agents a Workflow, Not a Blank Check

Give AI Agents a Workflow, Not a Blank Check

Learn how AWS Step Functions and Amazon Bedrock AgentCore let AI agents trigger controlled workflows with predictable execution and stronger guardrails.

Series: aws-digest (2 articles)

  1. 2
    Give AI Agents a Workflow, Not a Blank Check This article
Automation Builder

Give AI Agents a Workflow, Not a Blank Check

AI agents are becoming more capable. They can understand requests, make decisions, use tools, and complete tasks that previously required several manual steps.
But giving an AI agent more capabilities does not automatically make an application more reliable.
Imagine building an AI-powered customer support assistant. A customer asks for a refund, and the agent has access to order information, payment services, and customer records. It might be able to investigate the request, determine whether the order is eligible, process the refund, and notify the customer.
The question is: should the agent decide and execute every step on its own?
For a simple task, that might be fine. But when a process involves business rules, financial transactions, approvals, or other important operations, leaving the entire execution path to an AI model introduces unnecessary risk.
A better approach is to let the agent decide when a workflow should run, while a predefined workflow controls how that process is executed.
On AWS, Amazon Bedrock AgentCore Gateway and AWS Step Functions make this architecture possible.

The problem with giving agents too much freedom

AI agents are useful because they can handle situations where the next step is not always obvious. They can interpret natural language, gather information, and choose appropriate tools based on the context.
However, not every business process needs that level of flexibility.
Consider a refund process. A company might have rules such as:
  • Verify that the order exists.
  • Check whether the order is eligible for a refund.
  • Calculate the refundable amount.
  • Require manager approval for refunds above a certain amount.
  • Process the refund only after the required checks are complete.
  • Notify the customer when the process finishes.
These steps should happen in a defined order.
If an AI agent handles the entire process independently, the application depends on the model to consistently follow every instruction. Even with a carefully written prompt, the agent is still making decisions during execution.
It could misunderstand a condition, choose an incorrect tool, or fail to follow the intended sequence.
This does not mean AI agents should not perform important tasks. It means that important processes need boundaries.
For predictable operations, a predefined workflow is often a better place to enforce the rules.

Give each component a clear responsibility

Instead of asking one AI agent to handle everything, separate the responsibilities.
The AI agent handles interpretation and decision-making.
It understands what the user wants, gathers the necessary context, determines which approved process is appropriate, and provides the required input.
The workflow handles execution.
It follows the defined sequence, evaluates conditions, invokes services, handles retries and errors, and waits for approval when necessary.
The gateway connects the two.
It exposes approved workflows as tools that the agent can discover and invoke.
This creates a useful division of responsibility:
  • Agent: What should happen next?
  • Workflow: How should this process be executed?
  • Gateway: Which workflow operations can the agent access?
The agent still has flexibility, but that flexibility operates within a controlled environment.

How AWS Step Functions and AgentCore Gateway work together

AWS Step Functions is a workflow orchestration service. It lets developers coordinate AWS services, application code, and HTTP APIs through a sequence of states called a state machine.
A workflow can include tasks, conditions, parallel branches, retries, and error handling. Standard workflows also provide an execution history that records the steps taken during a run.
Amazon Bedrock AgentCore Gateway provides a managed way to expose tools to AI agents through the Model Context Protocol (MCP).
In October 2026, AWS introduced a built-in Step Functions connector for AgentCore Gateway. This allows existing Standard and Express state machines to be exposed as tools for AI agents.
The important part is that developers do not need to build a separate Lambda function or custom MCP server just to connect an agent to a Step Functions workflow. The gateway creates the tool schemas and handles the connection to Step Functions through its service role.
Once configured, an agent can discover the available tools and invoke them when needed.
The agent decides when to start a workflow and what input to provide. Step Functions executes the workflow according to its definition. The agent cannot skip or reorder the steps inside that state machine.
It can also use supported operations to check execution status, inspect execution history, and stop an execution when appropriate.
This is a meaningful architectural improvement: instead of giving an agent a collection of low-level operations and expecting it to coordinate everything correctly, developers can expose a complete, predefined process as a tool.

A practical example: an AI-powered refund assistant

Let's return to the customer support example.
A customer sends this message:
"I want a refund for order 12345."
The AI agent interprets the request and determines that it needs to initiate the company's refund process.
Rather than independently calling several services, it invokes the approved refund workflow through AgentCore Gateway.
The workflow might look like this:
1. Receive the request
The agent provides the order ID and other required information as workflow input.
2. Validate the order
The workflow checks whether the order exists and belongs to the customer making the request.
3. Check refund eligibility
The workflow evaluates the company's refund policy, including applicable time limits and order conditions.
4. Determine whether approval is required
If the refund exceeds a defined threshold, the workflow pauses for manager approval. Otherwise, it continues through the normal process.
5. Process the refund
After the required checks and approvals, the workflow invokes the payment service to process the refund.
6. Notify the customer
The workflow sends a confirmation or an appropriate explanation if the request cannot proceed.
7. Return the result
The agent checks the workflow's result and communicates the outcome to the customer.
The important distinction is that the agent does not invent the refund process every time someone asks for a refund.
It initiates the approved workflow, while Step Functions controls the execution.
That makes the process more consistent and easier to maintain.

Why this architecture is useful

There are several advantages to separating agent reasoning from workflow execution.

1. More predictable execution

A predefined workflow follows the sequence configured by the developer.
If a process requires validation before payment, that requirement is part of the state machine rather than something that depends entirely on the agent remembering an instruction.

2. Better control over permissions

Not every agent should have unrestricted access to every AWS resource.
AgentCore Gateway uses a service role to access Step Functions. Developers can scope its IAM permissions to the state machines and executions the agent should be allowed to access.
The connector also supports pinning certain operations to a specific state machine. For example, when the  StartExecution  operation is pinned, the agent cannot replace the configured state machine ARN with another one.
This is an important security boundary. Pinning and IAM permissions work together, and developers should avoid granting broad permissions simply to make an integration easier.

3. Built-in error handling and retries

Workflows can define how the application responds when a step fails.
For example, a temporary service failure might trigger a retry. A permanent failure could follow a separate error-handling path.
This is more reliable than depending on an agent to figure out how to recover from every possible failure during a conversation.
Retries should still be designed carefully, especially for operations such as payments. A retry must not accidentally create duplicate transactions.

4. Human approval when it matters

Some actions should not happen without a person reviewing them.
A workflow can pause while waiting for an approval or another required response, then continue once the appropriate signal is received.
This is particularly useful for refunds above a certain amount, account changes, sensitive administrative operations, and other high-impact actions.
The agent can help coordinate the process without becoming the final authority for every decision.

5. Better visibility into what happened

When something goes wrong, developers need more than an agent's explanation of what it thinks happened.
Step Functions provides execution information, and Standard workflows maintain a history of their execution steps. AgentCore Gateway also exposes supported operations for checking execution status and retrieving that history.
This gives developers a clearer way to investigate failed operations and understand where a process stopped.

A few things to consider before implementing it

This architecture is useful, but it does not mean every AI application needs Step Functions or AgentCore Gateway.
There are a few things worth considering:
  • Choose the right workflow type. Standard and Express workflows support different operations. For example, synchronous execution is supported by Express, while listing executions and inspecting execution history are Standard-only operations.
  • Keep IAM permissions narrow. Give the gateway only the permissions required for its intended workflows. Avoid broad permissions such as unrestricted  states:*  access.
  • Validate workflow inputs. An agent can misunderstand a request or provide incomplete information. Validate important values before performing consequential operations.
  • Use human approval for sensitive actions. Do not assume that an AI agent's confidence is a substitute for authorization.
  • Design for duplicate requests and failures. Especially when a workflow performs financial or irreversible actions, consider idempotency and safe recovery behavior.
  • Expose business actions, not unnecessary infrastructure access. An agent that needs to process refunds should have access to the refund process, not automatically to every payment-related operation in the AWS account.
It is also worth remembering that AgentCore Gateway is the connection layer, not a replacement for application security. The workflow, IAM policies, input validation, and approval rules still need to be designed correctly.

When should you use this approach?

A useful way to decide is to look at how predictable the task is.
Use an AI agent when a task requires interpreting a request, gathering context, or deciding which approved action is appropriate.
Use Step Functions when a task has a known sequence of steps, conditions, approvals, and recovery paths.
Use both when an application needs flexible decision-making but must execute important operations consistently.
For example:
Scenario
Suitable approach
Summarizing a customer's message
AI agent
Deciding which support process applies
AI agent
Processing a refund with policy checks
Step Functions
Waiting for manager approval
Step Functions
Choosing and starting the appropriate workflow
AI agent + AgentCore Gateway
Investigating a failed workflow execution
AI agent + AgentCore Gateway
The goal is not to make every operation agentic. The goal is to use AI where its flexibility provides real value.

Getting started on AWS

If you already have a Step Functions state machine, you do not necessarily need to rebuild it.
AWS provides a tutorial for exposing an existing workflow through Amazon Bedrock AgentCore Gateway.
At a high level, the process is:
  1. Create or select an existing Step Functions state machine.
  1. Create an IAM service role that allows AgentCore Gateway to access the required workflow operations.
  1. Create an AgentCore Gateway.
  1. Add the built-in Step Functions connector as a gateway target.
  1. Configure the operations you want to expose and pin the appropriate state machine.
  1. Connect an MCP-compatible AI agent to the gateway.
  1. Test workflow execution, status checks, permissions, and failure handling.
Start with a simple workflow that performs a low-risk task. Once the integration works, gradually introduce more complex processes, validation, and approval requirements.
AWS provides an official walkthrough that demonstrates creating a state machine, configuring the gateway, and invoking the workflow through MCP.

Final thoughts

AI agents are powerful because they can handle ambiguity and make decisions based on context. But that does not mean they should control every detail of an application's execution.
Some processes need to be predictable. They need to follow the same rules, respect permissions, handle failures properly, and leave a clear record of what happened.
That is where workflow orchestration remains valuable.
By combining Amazon Bedrock AgentCore Gateway with AWS Step Functions, developers can give AI agents access to predefined processes without handing over unrestricted control of the entire application.
The agent decides when a workflow is needed. The workflow makes sure the process is carried out as designed.
A good AI agent does not need a blank check. It needs the right tools, the right permissions, and a reliable process to follow.

Further reading

The views and opinions expressed in this article are my own.

Series: aws-digest (2 articles)

  1. 2
    Give AI Agents a Workflow, Not a Blank Check This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article