feat(sandbox): allow VPC network configuration for agentcore runtimes - #1082
Open
beiton wants to merge 3 commits into
Open
feat(sandbox): allow VPC network configuration for agentcore runtimes#1082beiton wants to merge 3 commits into
beiton wants to merge 3 commits into
Conversation
Runtimes were registered with a hardcoded {"networkMode": "PUBLIC"},
placing every sandbox microVM on the public internet with no way to opt
out. Adds BENCHFLOW_AGENTCORE_NETWORK_MODE / _SUBNETS / _SECURITY_GROUPS
following the existing _lifecycle_configuration() env-override pattern.
PUBLIC stays the default. Setting the lists without the mode is an error
rather than a silent fallback, since a runtime that stays public is
invisible once it reaches READY.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
VpcConfig carries service-managed members that cannot be sent on create, so whole-document equality would refuse to adopt a healthy VPC runtime -- the path every rollout after the first takes. Compare networkMode plus the two id lists, matching how the lifecycle check already tolerates extra keys, and canonicalize those lists so a reordered env var does not register a second runtime for the same infrastructure. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
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.
Runtimes were registered with a hardcoded
networkConfigurationof{"networkMode": "PUBLIC"}, putting every agent microVM on the public internet with no way to opt out.PUBLICstays the default, so existing deployments are unchanged. These follow the existing_lifecycle_configuration()env-override pattern — say the word if you'd rather they live onSandboxConfigas per-task settings.Setting the id lists without the mode is an error rather than a silent fallback to
PUBLIC: a half-configured runtime still reachesREADYand looks healthy, so the operator gets no signal that the isolation never took effect. Ids are validated client-side against the documented shapes and the 16-per-list cap.Adoption
networkConfigurationstopped being a one-key constant the service echoes verbatim and became a nestedVpcConfig, which needed two fixes:_verify_adopted_runtimecompared the whole returned document.VpcConfigcarriesrequireServiceS3Endpoint, which BenchFlow never sends and cannot set on create — so that comparison would refuse to adopt a healthy VPC runtime, failing a matrix on everything after its first create. It now comparesnetworkModeplus the two id lists, as the lifecycle check above it already does._runtime_contract_digest, andjson.dumps(sort_keys=True)does not sort list elements, so"a,b"and"b,a"would register two runtimes for identical infrastructure.Verification
Wire shape checked against the
bedrock-agentcore-controlbotocore model (2023-06-05) — note the runtime nestsVpcConfigundernetworkModeConfig, while Browser and CodeInterpreter usevpcConfig.pytest -k agentcore176 passed ·ty check src/clean ·ruff check .cleanNot live-validated — no VPC-attached AWS account here, so unlike #937 there is no live-run table. Whether
GetAgentRuntimeechoesrequireServiceS3Endpointback is inferred from the service model rather than observed; the adoption fix is defensive either way.Left out
Real but not correctness issues, happy to fold in: an explicit
NETWORK_MODE=PUBLICis indistinguishable from unset (so a deliberate public run with the lists exported gets a misleading error), and validation happens after_images.publish(), so a typo'd id costs an image build first.enforces_no_networkis unchanged — BenchFlow cannot verify a route table from the runtime config, so no-network tasks are still refused on this backend.