feat(tools): AGENTCORE_GATEWAY_ID env override for local/CI testing (#419)#456
Merged
Conversation
…ion (#419) Local/CI escape hatch for GatewayTargetService. Resolution order is now: explicit gateway_id (constructor) → AGENTCORE_GATEWAY_ID env → SSM /{PROJECT_PREFIX}/gateway/id. The SSM path remains the cloud default, but the env override lets local dev test the create flow without the SSM parameter (which may be absent, or behind a different PROJECT_PREFIX — e.g. local .env sets AGENTCORE_PROJECT_PREFIX, which the prefix readers don't consume, so the prefix falls back to "agentcore"). The ParameterNotFound RuntimeError message now points at both likely causes (construct not deployed / wrong PROJECT_PREFIX) and the override. Note: the override only supplies the id — the create call still hits real AWS, so local testing also needs creds for a real gateway with the GatewayTarget permissions. +1 test (19 total green). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #419. Adds a local/CI escape hatch so
GatewayTargetServicecan resolve the gateway id without the SSM parameter.Why
Testing the gateway create flow locally hits
ParameterNotFoundfor/agentcore/gateway/id, because:fine_tuning,auth_providers) readPROJECT_PREFIX(injected in cloud fromconfig.projectPrefix). The local.envsetsAGENTCORE_PROJECT_PREFIX, which nothing reads → the prefix falls back to"agentcore", so the lookup path is wrong locally./{prefix}/gateway/idparameter only exists once feat(infra): gateway id SSM param + app-api Gateway target IAM grants (#419, PR3/5) #452's infra is deployed.The create-AWS-first lifecycle then correctly 502s (it won't save the catalog row without a gateway id) — working as designed, just unusable locally.
What
_resolve_gateway_idresolution order: explicitgateway_id→AGENTCORE_GATEWAY_IDenv → SSM/{PROJECT_PREFIX}/gateway/id.ParameterNotFounderror message now names both likely causes + the override.Set
AGENTCORE_GATEWAY_IDto the deployed stack'sGatewayIdoutput (or fromaws bedrock-agentcore-control list-gateways) to test locally. Caveat: the override only supplies the id —CreateGatewayTargetstill calls real AWS, so local testing also needs creds for a real gateway with the GatewayTarget IAM permissions.Testing
+1 test (env override skips SSM);
test_gateway_target_service.py19/19 green.🤖 Generated with Claude Code