Add AgentCore Gateway + Runtime setup steps (CLI-driven)
This commit is contained in:
41
scripts/agentcore_setup.sh
Normal file
41
scripts/agentcore_setup.sh
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#!/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 <<EOF
|
||||||
|
agentcore gateway create \\
|
||||||
|
--name hncb-rag-gateway \\
|
||||||
|
--region ${REGION} \\
|
||||||
|
--target-type lambda \\
|
||||||
|
--target-arn ${RAG_LAMBDA_ARN} \\
|
||||||
|
--tool-name get_customer_activity_summary \\
|
||||||
|
--tool-description "Return a de-identified activity summary for a customer TOKEN" \\
|
||||||
|
--tool-schema file://../agent/tool_schema.json
|
||||||
|
# Note the printed Gateway MCP URL -> export AGENTCORE_GATEWAY_URL=...
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "==> 3. Deploy the agent to AgentCore Runtime"
|
||||||
|
cat <<EOF
|
||||||
|
cd ../agent
|
||||||
|
agentcore configure --entrypoint agent.py --name hncb-advisor-agent --region ${REGION}
|
||||||
|
AGENTCORE_GATEWAY_URL=<from step 2> 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."
|
||||||
Reference in New Issue
Block a user