The Power of Generative Models in Workflows
In the world of digital marketing, product review generation is a critical task that consumes time and resources. With Amazon Bedrock Flows, it's now possible to automate this process using large language models (LLMs) like Claude 3.5 Sonnet, alongside knowledge bases and Lambda functions to enrich the content.
In this article, I'll show you how to build a workflow that:
- Retrieves customer comments from a knowledge base.
- Uses a generative model to create product reviews based on those comments.
- Stores the generated reviews in an S3 bucket for later use.
What is Amazon Bedrock Flows?
Amazon Bedrock Flows is a feature of Amazon Bedrock that lets you create automated and customized workflows using large language models (LLMs) and other AWS services. With Bedrock Flows, you can design flows that integrate multiple steps, such as retrieving data from a knowledge base, generating content with language models, and storing results in services like S3.
Workflows in Bedrock Flows are built using nodes, which represent specific tasks. For example:
- Flow Input Node: Receives the initial data from the user.
- Knowledge Base Node: Queries a knowledge base to retrieve relevant information.
- Prompt Node: Uses a language model to generate content based on the provided data.
- S3 Storage Node: Stores the results in an S3 bucket.
- Flow Output Node: Returns the results to the user.
These nodes connect to each other to form a complete workflow, enabling efficient and scalable automation of complex tasks.
🔍 ProTip: When designing workflows in Bedrock, always start with a simple flow and then add complexity gradually. This will let you identify and fix errors in early stages.
Available Node Types in Bedrock Flows
Amazon Bedrock Flows offers a variety of nodes that we can classify into four main categories:
Logic Nodes
- Collector: Collects and aggregates results from iterative operations.
- Condition: Implements conditional logic to branch the flow based on specific criteria.
- Iterator: Facilitates iterative processing of data collections.
Orchestration Nodes
- Agents: Integrates AI agents for complex and conversational tasks.
- Prompts: Manages interactions with language models through structured prompts.
Code and Data Nodes
- Lambda Function: Executes Lambda functions for custom processing.
- Knowledge Base: Queries knowledge bases to retrieve contextual information.
- S3 Storage/Retrieval: Handles storage and retrieval operations in S3.
AI Service Nodes
- Lex: Integrates natural language processing capabilities through Amazon Lex.

Figure 1: Complete catalog of nodes available in Bedrock Flows.
💡 ProTip: Choosing the right nodes and combining them is key to creating efficient flows. Start with the most basic nodes and add complexity as needed.
Step by Step: Creating a Workflow with Amazon Bedrock Flows
Step 1: Environment Setup
Before starting, make sure you have the following:
- Access to the AWS console with Amazon Bedrock permissions.
- A knowledge base in Amazon Bedrock Knowledge Bases containing customer comments about products.
- An S3 bucket to store the generated reviews.
- A generative model (for example, Claude 3.5 Sonnet) enabled in your Bedrock account.
🔍 ProTip: Make sure your knowledge base is well-structured and contains relevant data. The quality of input data will directly affect the quality of generated reviews.
Step 2: Creating the Flow in Amazon Bedrock
- Access the Amazon Bedrock console and select Flows in the navigation menu.
- Click Create Flow and assign a name and description to your flow (for example, "Product_Review_Generation").
- Select a service role with the necessary permissions to access Bedrock, S3, and Lambda.

Figure 2: Initial flow configuration in Amazon Bedrock
🔍 ProTip: When creating the flow, use a descriptive name that reflects its purpose. This will make managing and maintaining the flow easier in the future.
Step 3: Designing the Flow
Our flow will consist of the following nodes:
- Flow Input Node: Receives the initial parameters, such as the product ID.
- Knowledge Base Node: Retrieves customer comments related to the product.
- Prompt Node: Uses a generative model to create a review based on the comments.
- S3 Storage Node: Stores the generated review in an S3 bucket.
- Flow Output Node: Returns the generated review.
Visually, we have the following:

Figure 3: Review processing flow architecture.
Node Configuration
- Input Node: Configure the input node to receive a JSON object with the product ID.
{
"productId": "B01EXAMPLE1"
}
-
Knowledge Base Node:
Configure the node to query the knowledge base and retrieve comments related to the product. Use an expression like
$.data.productIdto extract the product ID.
For reference, our knowledge base consists of entries similar to this.
{
"productId": "B01EXAMPLE1",
"reviewText": "Excellent product, very durable...",
"rating": 5,
"reviewDate": "2024-01-15",
"verifiedPurchase": true
}
💡 Note: Expressions follow JsonPath syntax. For example,
$.data.productIdextracts theproductIdvalue from the input object.
It's important to mention that the node's output will depend on the mode we select:
- With "Return retrieved results": returns an array of found results
- With "Generate responses": returns a response generated by the selected model
For our exercise, we only want it to return the found data.

Figure 4: Knowledge Base Node Configuration
- Prompt Node: Configure the node to use a generative model (for example, Claude 3.5 Sonnet) and generate a review based on the retrieved comments. In my example I used this prompt:
As a product analysis expert, analyze the following reviews and generate a
detailed evaluation.
REVIEWS:
{{retrievalResults}}
REQUIRED STRUCTURE:
1. General opinion summary (2-3 sentences)
2. Frequently mentioned positive aspects (3-4 points)
3. Improvement points noted by users (2-3 points)
4. Conclusion and final recommendation based on ratings and comments
TONE: Professional, objective, and focused on concrete data from the reviews.
IMPORTANT: Base your analysis solely on the information provided in the reviews.
As you can see in the image, it's important to indicate that the input data is of type array.

Figure 5: Prompt structure for review analysis
-
S3 Storage Node:
Configure the node to store the generated review in an S3 bucket. Use an expression like
$.data.productIdto extract the product identifier and use it as our objectKey, with the content being our model's response.

Figure 6: S3 storage configuration
- Output Node: Configure the output node to return the S3 file URI.
Step 4: Testing and Validation
Once the flow is configured, it's time to test it:
- Click Test Flow in the Amazon Bedrock console.
- Enter the following JSON as input:
{
"productId": "B01EXAMPLE1"
}
- Run the flow and verify that the review is generated correctly and stored in S3.
If we look at the traces, we find a detail of each step followed in the flow.

Figure 7: Flow traceability and monitoring
When validating the prompt node output, for example, we can see the content generated by Sonnet given the instructions provided and reviews found.

Figure 8: Prompt Output
🔍 ProTip: During testing, use different product IDs to make sure the flow handles different scenarios correctly.
Step 5: Production Deployment
When you're satisfied with the flow, you can deploy it to production:
- Create a version of the flow.
- Associate an alias to the version.
- Configure your application to invoke the flow using the alias.
Conclusion: Automation with Generative Models and Knowledge Bases
Amazon Bedrock Flows is a powerful tool for automating complex business processes, especially when combined with generative models and knowledge bases. In this article, we've seen how to create a workflow that automatically generates product reviews from customer comments, using Claude 3.5 Sonnet and a knowledge base.
This approach not only saves time but also improves the quality of generated content, since generative models can produce more attractive and personalized reviews.
🚀 Final ProTip: Before deploying a workflow to production, perform thorough testing with different types of queries. This will let you identify and fix potential failures before they affect end users.
Have you used Amazon Bedrock Flows in your projects? Share your experiences in the comments and don't hesitate to ask if you have any questions about the implementation!

Top comments (0)