@@ -20,11 +20,6 @@ if [ -z "${AIAGENT_USER_POOL_ID}" ] || [ -z "${AIAGENT_CLIENT_ID}" ] || [ -z "${
2020 exit 1
2121fi
2222
23- if [ -z " ${AGENTCORE_MEMORY_MEMORY_ID} " ]; then
24- echo " Error: Missing Memory variables. Run 02-memory.sh first."
25- exit 1
26- fi
27-
2823# Get account ID and region
2924ACCOUNT_ID=$( aws sts get-caller-identity --query Account --output text --no-cli-pager)
3025AWS_REGION=$( aws configure get region)
@@ -179,17 +174,6 @@ EXISTING_RUNTIME_ID=$(aws bedrock-agentcore-control list-agent-runtimes \
179174 --region ${AWS_REGION} --no-cli-pager \
180175 --query " agentRuntimes[?agentRuntimeName=='aiagent'].agentRuntimeId | [0]" --output text 2> /dev/null || echo " None" )
181176
182- # Build environment variables JSON
183- cat > /tmp/aiagent-env.json << EOF
184- {
185- "AGENTCORE_MEMORY_MEMORY_ID": "${AGENTCORE_MEMORY_MEMORY_ID} ",
186- "AGENTCORE_MEMORY_LONG_TERM_SEMANTIC_STRATEGY_ID": "${AGENTCORE_MEMORY_LONG_TERM_SEMANTIC_STRATEGY_ID} ",
187- "AGENTCORE_MEMORY_LONG_TERM_USER_PREFERENCE_STRATEGY_ID": "${AGENTCORE_MEMORY_LONG_TERM_USER_PREFERENCE_STRATEGY_ID} ",
188- "SPRING_AI_VECTORSTORE_BEDROCK_KNOWLEDGE_BASE_KNOWLEDGE_BASE_ID": "${SPRING_AI_VECTORSTORE_BEDROCK_KNOWLEDGE_BASE_KNOWLEDGE_BASE_ID} ",
189- "SPRING_AI_MCP_CLIENT_STREAMABLEHTTP_CONNECTIONS_GATEWAY_URL": "${GATEWAY_URL} "
190- }
191- EOF
192-
193177if [ " ${EXISTING_RUNTIME_ID} " != " None" ] && [ -n " ${EXISTING_RUNTIME_ID} " ]; then
194178 echo " AgentCore Runtime already exists: ${EXISTING_RUNTIME_ID} "
195179 echo " Updating runtime with latest configuration..."
@@ -201,8 +185,7 @@ if [ "${EXISTING_RUNTIME_ID}" != "None" ] && [ -n "${EXISTING_RUNTIME_ID}" ]; th
201185 --agent-runtime-artifact " {\" containerConfiguration\" :{\" containerUri\" :\" ${ECR_URI} :latest\" }}" \
202186 --network-configuration " {\" networkMode\" :\" VPC\" ,\" networkModeConfig\" :{\" subnets\" :[\" ${SUBNET_ID} \" ],\" securityGroups\" :[\" ${SG_ID} \" ]}}" \
203187 --authorizer-configuration " {\" customJWTAuthorizer\" :{\" discoveryUrl\" :\" ${AIAGENT_DISCOVERY_URL} \" ,\" allowedClients\" :[\" ${AIAGENT_CLIENT_ID} \" ]}}" \
204- --request-header-configuration ' {"requestHeaderAllowlist":["Authorization"]}' \
205- --environment-variables file:///tmp/aiagent-env.json \
188+ --request-header-configuration ' {"requestHeaderAllowlist":["Authorization","X-Amzn-Bedrock-AgentCore-Runtime-Session-Id"]}' \
206189 --region ${AWS_REGION} \
207190 --no-cli-pager
208191
221204 --agent-runtime-artifact " {\" containerConfiguration\" :{\" containerUri\" :\" ${ECR_URI} :latest\" }}" \
222205 --network-configuration " {\" networkMode\" :\" VPC\" ,\" networkModeConfig\" :{\" subnets\" :[\" ${SUBNET_ID} \" ],\" securityGroups\" :[\" ${SG_ID} \" ]}}" \
223206 --authorizer-configuration " {\" customJWTAuthorizer\" :{\" discoveryUrl\" :\" ${AIAGENT_DISCOVERY_URL} \" ,\" allowedClients\" :[\" ${AIAGENT_CLIENT_ID} \" ]}}" \
224- --request-header-configuration ' {"requestHeaderAllowlist":["Authorization"]}' \
225- --environment-variables file:///tmp/aiagent-env.json \
207+ --request-header-configuration ' {"requestHeaderAllowlist":["Authorization","X-Amzn-Bedrock-AgentCore-Runtime-Session-Id"]}' \
226208 --region ${AWS_REGION} \
227209 --no-cli-pager \
228210 --query ' agentRuntimeId' --output text)
235217 done && echo " READY"
236218fi
237219
238- rm -f /tmp/aiagent-env.json
239-
240220# Save runtime ID to environment
241221if ! grep -q " AIAGENT_RUNTIME_ID=${AIAGENT_RUNTIME_ID} " ~ /environment/.envrc 2> /dev/null; then
242222 sed -i.bak ' /AIAGENT_RUNTIME_ID=/d' ~ /environment/.envrc 2> /dev/null || true
0 commit comments