Amazon Bedrock is AWS’s fully managed service for building and scaling generative AI applications using foundation models from providers like Anthropic, AI21 Labs, Cohere, Meta, and Amazon itself. Instead of managing infrastructure or training models from scratch, Bedrock gives you API access to powerful models so you can generate text, summarize content, classify data, and more.
When combined with AWS Step Functions, Bedrock becomes part of a larger orchestration layer. This allows you to embed AI directly into automated workflows, making decisions, transforming data, or generating outputs as part of a structured state machine.
This article explains what Bedrock is, how it fits into Step Functions, and how to implement it in real workflows.
What is Amazon Bedrock
Amazon Bedrock is a serverless AI service that lets you:
- Access foundation models through a unified API
- Avoid managing GPUs or ML infrastructure
- Choose between multiple model providers
- Fine tune or customize models with your own data
- Build applications like chatbots, summarizers, and classifiers
Common use cases include:
- Content generation
- Document summarization
- Sentiment analysis
- Knowledge base retrieval with RAG
- Code generation
Unlike traditional ML pipelines, Bedrock removes the complexity of training and hosting models. You focus only on inputs and outputs.
Why Use Bedrock in Step Functions
Step Functions is AWS’s orchestration engine for coordinating services like Lambda, DynamoDB, S3, and APIs. By adding Bedrock into a state machine, you can bring AI into your workflows in a structured and repeatable way.
This is useful when:
- AI is just one step in a larger process
- You need retries, branching, or error handling around AI calls
- You want to combine AI outputs with other services
- You need auditability and visibility into execution
Instead of calling Bedrock directly from an app, Step Functions lets you embed it into workflows like:
- Customer support automation
- Data enrichment pipelines
- Document processing systems
- Fraud detection workflows
- Content moderation pipelines
How Bedrock Fits into a State Machine
In Step Functions, Bedrock is typically used inside a Task state. This can be done in two main ways:
Option 1: Lambda Wrapper
You create a Lambda function that calls Bedrock, then invoke that Lambda from Step Functions.
Flow:
- Step Function Task → Lambda
- Lambda → Bedrock API
- Return result to Step Function
This is the most flexible approach because you can:
- Customize prompts dynamically
- Add preprocessing and postprocessing
- Handle authentication and retries
- Integrate with other services
Option 2: Direct Service Integration (when supported)
AWS is gradually expanding native integrations. When available, you can call Bedrock directly from Step Functions without Lambda.
Start free. No AWS account needed.
ZERO AWS costs.
Download Thrubit and run your first state machine locally in under five minutes. No cloud setup, no IAM policies, no waiting.
This reduces latency and cost, but is less flexible than a Lambda wrapper.
Example Workflow Using Bedrock
Imagine a document processing pipeline:
- Upload document to S3
- Extract text with a Lambda
- Send text to Bedrock for summarization
- Evaluate summary quality
- Store results in DynamoDB
- Notify users
Here is a simplified Step Functions Task state calling a Lambda that uses Bedrock:
{
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "bedrockSummarizer",
"Payload": {
"text.$": "$.documentText"
}
},
"ResultPath": "$.summary",
"Next": "StoreSummary"
}JSONInside the Lambda, you might call Bedrock like this (Node.js):
import { BedrockRuntimeClient, InvokeModelCommand } from "@aws-sdk/client-bedrock-runtime";
const client = new BedrockRuntimeClient({ region: "us-east-1" });
export const handler = async (event) => {
const command = new InvokeModelCommand({
modelId: "anthropic.claude-v2",
body: JSON.stringify({
prompt: `Summarize this:\n\n${event.text}`,
max_tokens_to_sample: 300
}),
contentType: "application/json",
accept: "application/json"
});
const response = await client.send(command);
const result = JSON.parse(new TextDecoder().decode(response.body));
return result;
};JavaScriptHandling Common Bedrock Requirements
When using certain models like Anthropic Claude, you may encounter this requirement:
“Model use case details have not been submitted for this account.”
To resolve this:
- Go to the AWS Bedrock console
- Select the model provider (for example, Anthropic)
- Fill out the use case details form
- Wait for approval (can take several minutes or longer)
Without this step, your Step Functions workflow will fail when invoking the model.
Error Handling and Retries
AI calls can fail due to:
- Rate limits
- Invalid prompts
- Model access issues
- Timeout errors
Step Functions allows you to handle this cleanly:
"Retry": [
{
"ErrorEquals": ["States.ALL"],
"IntervalSeconds": 2,
"MaxAttempts": 3,
"BackoffRate": 2.0
}
]JSONYou can also branch based on results using a Choice state:
- If summary length < threshold → retry or escalate
- If sentiment is negative → trigger alert
- If classification fails → route to manual review
Cost Considerations
Bedrock pricing is based on:
- Input tokens
- Output tokens
- Model provider pricing
Step Functions adds cost per state transition, and Lambda adds execution cost.
This can add up quickly during development, especially when testing prompts and workflows repeatedly.
Testing Bedrock Workflows Locally
One of the biggest challenges with Step Functions and Bedrock is iteration speed and cost.
Every change typically requires:
- Deploying Lambda
- Updating Step Functions
- Running executions in AWS
- Paying for each run
With a local-first workflow using tools like Thrubit, you can:
- Run Step Functions locally
- Execute real Lambda functions without deploying
- Simulate Bedrock calls or hit the real API
- Debug visually with execution graphs
- Iterate instantly without cloud costs
This is especially valuable when tuning prompts or chaining multiple AI steps together.
Real World Use Cases
AI-Powered Customer Support
- Input: customer message
- Bedrock: classify intent and generate response
- Step Functions: route to automation or human agent
Document Intelligence
- Input: PDF or text
- Bedrock: summarize or extract entities
- Step Functions: store and index results
Fraud Detection
- Input: transaction data
- Bedrock: anomaly explanation
- Step Functions: trigger alerts or block actions
Content Moderation
- Input: user-generated content
- Bedrock: classify harmful content
- Step Functions: approve, reject, or escalate
Best Practices
- Use Lambda wrappers for flexibility and control
- Keep prompts structured and consistent
- Store prompts externally for easy updates
- Add retries and fallback paths
- Log inputs and outputs for debugging
- Use local testing to reduce costs and speed iteration
Amazon Bedrock brings powerful AI capabilities into your AWS environment, and Step Functions gives you the orchestration layer to turn those capabilities into real workflows.
Together, they allow you to build intelligent, automated systems that go beyond traditional rule-based logic.
The key is not just calling AI, but integrating it into structured, observable, and reliable workflows. When you combine that with local development tools, you can move faster, reduce costs, and build more advanced systems with confidence.