Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion infra-cdk/lib/backend-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class BackendStack extends cdk.NestedStack {
// Parameters
this.agentName = new cdk.CfnParameter(this, "AgentName", {
type: "String",
default: "StrandsAgent",
default: "FASTAgent",
description: "Name for the agent runtime",
})

Expand Down
2 changes: 1 addition & 1 deletion infra-terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Terraform uses flat variables with a `backend_` prefix to mirror the CDK's neste
| `backend.vpc.subnet_ids` | `backend_vpc_subnet_ids` |
| `backend.vpc.security_group_ids` | `backend_vpc_security_group_ids` |

Values that are hardcoded in CDK (not in `config.yaml`) are defined as module-internal locals in Terraform: agent name (`StrandsAgent`), memory event expiry (30 days), callback URLs, and password minimum length.
Values that are hardcoded in CDK (not in `config.yaml`) are defined as module-internal locals in Terraform: agent name (`FASTAgent`), memory event expiry (30 days), callback URLs, and password minimum length.

## Module Structure

Expand Down
7 changes: 5 additions & 2 deletions infra-terraform/modules/backend/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ locals {
# Stack name for resource naming (underscores for some AWS resources)
stack_name_underscore = replace(var.stack_name_base, "-", "_")

# Agent name (matches CDK CfnParameter default in backend-stack.ts)
agent_name = "StrandsAgent"
# Agent name used in runtime naming
agent_name = "FASTAgent"

# Runtime name (underscores required by AgentCore)
runtime_name = "${local.stack_name_underscore}_${local.agent_name}"
Expand All @@ -42,6 +42,9 @@ locals {
is_docker = var.backend_deployment_type == "docker"
is_zip = var.backend_deployment_type == "zip"

# Pattern flags
is_claude_agent_sdk = contains(["claude-agent-sdk-single-agent", "claude-agent-sdk-multi-agent"], var.backend_pattern)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


# Project paths (for zip packaging)
project_root = "${path.module}/../../.."
pattern_dir = "${local.project_root}/patterns/${var.backend_pattern}"
Expand Down
24 changes: 16 additions & 8 deletions infra-terraform/modules/backend/runtime.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ resource "terraform_data" "docker_image_hash" {
input = local.is_docker && var.container_uri == null ? sha256(join("", concat(
[filesha256("${local.pattern_dir}/Dockerfile")],
[filesha256("${local.pattern_dir}/requirements.txt")],
[for f in fileset(local.pattern_dir, "*.py") : filesha256("${local.pattern_dir}/${f}")],
[for f in fileset(local.pattern_dir, "**/*.py") : filesha256("${local.pattern_dir}/${f}")],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

[for f in fileset("${local.project_root}/patterns/utils", "**/*.py") : filesha256("${local.project_root}/patterns/utils/${f}")],
[for f in fileset("${local.project_root}/gateway", "**/*.py") : filesha256("${local.project_root}/gateway/${f}")],
[for f in fileset("${local.project_root}/tools", "**/*.py") : filesha256("${local.project_root}/tools/${f}")],
Expand Down Expand Up @@ -471,16 +471,24 @@ resource "aws_bedrockagentcore_agent_runtime" "main" {
}

# Environment variables for the runtime
environment_variables = {
AWS_REGION = local.region
AWS_DEFAULT_REGION = local.region
MEMORY_ID = aws_bedrockagentcore_memory.main.id
STACK_NAME = var.stack_name_base
GATEWAY_CREDENTIAL_PROVIDER_NAME = "${var.stack_name_base}-runtime-gateway-auth"
}
environment_variables = merge(
{
AWS_REGION = local.region
AWS_DEFAULT_REGION = local.region
MEMORY_ID = aws_bedrockagentcore_memory.main.id
STACK_NAME = var.stack_name_base
GATEWAY_CREDENTIAL_PROVIDER_NAME = "${var.stack_name_base}-runtime-gateway-auth"
},
# claude-agent-sdk patterns require CLAUDE_CODE_USE_BEDROCK=1
local.is_claude_agent_sdk ? { CLAUDE_CODE_USE_BEDROCK = "1" } : {}
)

# Force runtime replacement when agent code changes (zip or docker)
lifecycle {
precondition {
condition = !local.is_claude_agent_sdk || local.is_docker
error_message = "claude-agent-sdk patterns require Docker deployment (backend_deployment_type = \"docker\") because they need Node.js and the claude-code CLI installed at build time."
}
precondition {
condition = var.backend_network_mode != "VPC" || (var.backend_vpc_id != null && var.backend_vpc_id != "")
error_message = "backend_vpc_id is required when backend_network_mode is 'VPC'."
Expand Down
2 changes: 1 addition & 1 deletion infra-terraform/modules/backend/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ variable "backend_pattern" {
}

variable "backend_deployment_type" {
description = "Deployment type: 'docker' (container via ECR) or 'zip' (Python package via S3)."
description = "Deployment type: 'docker' (container via ECR) or 'zip' (Python package via S3). Note: claude-agent-sdk patterns require 'docker'."
type = string
default = "docker"
}
Expand Down
2 changes: 1 addition & 1 deletion infra-terraform/terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ admin_user_email = null # Example: "admin@example.com"
# -----------------------------------------------------------------------------

# Agent pattern to deploy
# Available patterns: strands-single-agent, langgraph-single-agent
# Available patterns: strands-single-agent, langgraph-single-agent, claude-agent-sdk-single-agent, claude-agent-sdk-multi-agent
backend_pattern = "strands-single-agent"

# Deployment type for AgentCore Runtime
Expand Down
6 changes: 3 additions & 3 deletions infra-terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ variable "admin_user_email" {
# =============================================================================

variable "backend_pattern" {
description = "Agent pattern to deploy. Available patterns: strands-single-agent, langgraph-single-agent"
description = "Agent pattern to deploy. Available patterns: strands-single-agent, langgraph-single-agent, claude-agent-sdk-single-agent, claude-agent-sdk-multi-agent"
type = string
default = "strands-single-agent"

validation {
condition = contains(["strands-single-agent", "langgraph-single-agent"], var.backend_pattern)
error_message = "Backend pattern must be one of: strands-single-agent, langgraph-single-agent."
condition = contains(["strands-single-agent", "langgraph-single-agent", "claude-agent-sdk-single-agent", "claude-agent-sdk-multi-agent"], var.backend_pattern)
error_message = "Backend pattern must be one of: strands-single-agent, langgraph-single-agent, claude-agent-sdk-single-agent, claude-agent-sdk-multi-agent."
}
}

Expand Down
Loading