#!/usr/bin/env bash # AgentCore setup (steps 3-4-7). Terraform's AgentCore coverage lags, so this # stage uses the AgentCore CLI / SDK. Commands below reflect the current CLI # shape -- CHECK against `agentcore --help`, the surface moves fast. set -euo pipefail : "${REGION:?set REGION}" : "${RAG_LAMBDA_ARN:?set RAG_LAMBDA_ARN (from: terraform output -raw rag_lambda_arn)}" : "${BEDROCK_MODEL_ID:=anthropic.claude-3-5-sonnet-20241022-v2:0}" echo "==> 1. Install the AgentCore CLI (recommended tooling)" echo " npm install -g @aws/agentcore # or: pip install bedrock-agentcore-starter-toolkit" echo "==> 2. Create a Gateway that exposes the RAG Lambda as an MCP tool" echo " AgentCore Gateway turns a Lambda into an MCP tool with no code changes." cat < export AGENTCORE_GATEWAY_URL=... EOF echo "==> 3. Deploy the agent to AgentCore Runtime" cat < BEDROCK_MODEL_ID=${BEDROCK_MODEL_ID} \\ agentcore launch # Note the printed Runtime ARN -> Fusion will invoke this. EOF echo "==> 4. (recommended) Lock the Runtime to accept calls only from the Gateway" echo " Use a resource policy (SigV4) or allowedWorkloadConfiguration (JWT)." echo " See AgentCore 'Runtime targets' docs." echo "Done printing steps. Fill AGENTCORE_GATEWAY_URL + Runtime ARN into fusion/POLICY_SETUP.md."