AWS Bedrock Agents First Impressions

A typical AWS Bedrock Agent architecture.
Introduction
In my previous Bedrock article Generative AI with AWS Bedrock - First Impressions I told my first experiences about working with AWS Bedrock service when creating a Retrieval Augmented Generation (RAG) chatbot.
This year, I had a chance to work with a new AWS Bedrock related project. We are building infrastructure and applications that use AWS Bedrock Agents to automate certain customer service processes.
What Are AWS Bedrock Agents?
AWS Bedrock Agents are agents in the AWS context, that can accomplish complex tasks using Large Language Models, and then call various AWS services, like Lambdas. Agents can utilize Bedrock Knowledge Bases and they can remember conversation history and handle follow-up questions.
Instead of just providing information, Bedrock Agents can actually process various things like get the intent from a customer service request, query previous related resolutions and then request changes to company’s enterprise systems related to the customer request.
You don’t have to use Bedrock Agents for everything. You can process the customer intent using just Lambda and a Language Model, and let this Lambda orchestrate the agents. A bit like in the diagram above.
Bedrock Agents Components
A typical Bedrock Agent consists of these components:
- Foundation Model: The underlying Large Language model that agent uses for reasoning.
- Instructions: Guidelines that define the agent’s role and behavior in the processing context.
- Action Groups: These are APIs and functions the agent can call to perform tasks (like the “Agentic Lambdas in the diagram).
- Knowledge Bases: Documents and data sources the agent can query for information.
- Guardrails: These are safety controls to ensure appropriate responses.
Terraform Code Example
Terraform is my favorite Infrastructure as Code (IaC) tool since I can use it with multiple mainstream public clouds.
This is a simple code example to create an AWS Bedrock Agent resource:
resource "awscc_bedrock_agent" "customer_service_agent" {
agent_name = "${local.res_prefix}-${local.module_name}-customer-service-agent"
agent_resource_role_arn = aws_iam_role.customer_service_agent.arn
idle_session_ttl_in_seconds = var.customer_service_agent_idle_session_ttl
foundation_model = var.foundation_model
description = var.customer_service_agent_description
instruction = file("${path.module}/customer_service_agent/${var.customer_service_agent_config_directory}/customer_service_agent_instruction.txt")
orchestration_type = "CUSTOM_ORCHESTRATION"
custom_orchestration = {
executor = {
lambda = data.terraform_remote_state.agentic_lambda.outputs.customer_service_agent_lambda_function_arn
}
}
# See: https://github.com/hashicorp/terraform-provider-awscc/issues/2004
auto_prepare = true
tags = merge(local.default_tags, {
name = "${local.res_prefix}-${local.module_name}-customer-service-agent"
})
}
I am using here AWS Cloud Control Provider (awscc) since at the time of implementing the agent infrastructure the standard AWS provider did not support all the agent features we needed.
This is just one simple example of creating AWS Bedrock Agent resource using Terraform. Bedrock Agents support various configurations, like multi-agent collaboration - check the latest AWS documentation how you can utilize Bedrock Agents in your projects.
Conclusions
Generative AI is here. We are going to see a new information revolution in which various manual processes like handling customer service requests will be automated using Generative AI Agents.
The writer is working at a major international IT corporation building cloud infrastructures and implementing applications on top of those infrastructures.
Kari Marttila
Kari Marttila’s Home Page in LinkedIn: https://www.linkedin.com/in/karimarttila/
