* fix(bedrock-agentcore): tag memory resources and honor dropped CreateMemory/UpdateMemory fields Three divergences from AWS in the Memory control plane (#2316): - Memory ARNs were not taggable: the shared /tags/{arn} handler dispatched only agent/ and gateway/ segments, returning ValidationException for memory/ ARNs even though AWS supports TagResource on memories. - CreateMemory silently dropped tags, encryptionKeyArn, and memoryExecutionRoleArn: accepted with 202, never stored. - UpdateMemory ignored eventExpiryDuration (and memoryExecutionRoleArn), applying only description. Memory now persists all three fields, the tag handler dispatches three ways (with the foreign-account 404 guard covering memories), and UpdateMemory applies description, eventExpiryDuration (validated 3-365), and memoryExecutionRoleArn. Matching AWS, the Memory response shape never embeds tags; they surface only via ListTagsForResource. * fix(bedrock-agentcore): validate UpdateMemory input before mutating stored state A rejected update (out-of-range eventExpiryDuration) could leave the description already applied, because get() returns the live stored object and validation ran after the first setter. Validate all inputs up front, and pin the no-partial-mutation behavior with unit and integration tests. Also deduplicates the @Order(3) collision in BedrockAgentCoreMemoryIntegrationTest. Addresses review feedback from pgermosen.
5.4 KiB
Bedrock AgentCore
Protocol: REST-JSON
Endpoint: http://localhost:4566/runtimes/...
Emulates the Amazon Bedrock AgentCore control plane (bedrock-agentcore-control)
as a stateful runtime registry. No real agent execution — runtimes reach READY
immediately and hold metadata only. See
the design note for scope and the roadmap covering
endpoints, the InvokeAgentRuntime data-plane stub, tagging, workload identity, and
gateway/memory primitives.
Supported Actions
| Action | Description |
|---|---|
CreateAgentRuntime |
Register an agent runtime; returns an id, versioned ARN, and workload identity |
GetAgentRuntime |
Get a runtime, optionally a specific version |
ListAgentRuntimes |
List runtimes (paginated) |
UpdateAgentRuntime |
Update a runtime; appends a new immutable version |
ListAgentRuntimeVersions |
List a runtime's versions (paginated) |
DeleteAgentRuntime |
Delete a runtime |
CreateAgentRuntimeEndpoint |
Create a named endpoint (qualifier) targeting a version |
GetAgentRuntimeEndpoint |
Get an endpoint |
UpdateAgentRuntimeEndpoint |
Retarget an endpoint's version / update its description |
ListAgentRuntimeEndpoints |
List a runtime's endpoints (paginated) |
DeleteAgentRuntimeEndpoint |
Delete an endpoint |
InvokeAgentRuntime (data plane) |
Invoke a runtime; returns a fixed canned response |
TagResource / UntagResource / ListTagsForResource |
Tag runtimes, gateways, and memory resources via the shared /tags/{arn} route |
CreateWorkloadIdentity / GetWorkloadIdentity / UpdateWorkloadIdentity / DeleteWorkloadIdentity / ListWorkloadIdentities |
Manage workload identities (POST /identities/<Op>) |
CreateGateway / GetGateway / UpdateGateway / DeleteGateway / ListGateways |
Manage gateways (metadata only) |
CreateGatewayTarget / GetGatewayTarget / UpdateGatewayTarget / DeleteGatewayTarget / ListGatewayTargets |
Manage gateway targets |
CreateMemory / GetMemory / UpdateMemory / DeleteMemory / ListMemories |
Manage memory resources (metadata only) |
A DEFAULT endpoint is created automatically with each runtime, and each runtime
is associated with an auto-created, resolvable workload identity.
Data plane — InvokeAgentRuntime
POST /runtimes/{agentRuntimeArn}/invocations returns a fixed, configurable JSON
body (default {"output":"yes"}) and echoes the
X-Amzn-Bedrock-AgentCore-Runtime-Session-Id header. The request payload (opaque
binary, up to 100 MB) is never parsed. Streaming responses are not emulated — a
single non-streaming 200 is returned.
Configuration
| Variable | Default | Description |
|---|---|---|
FLOCI_SERVICES_BEDROCK_AGENT_CORE_CONTROL_ENABLED |
true |
Enable/disable the control plane |
FLOCI_SERVICES_BEDROCK_AGENT_CORE_ENABLED |
true |
Enable/disable the data plane (invoke) |
FLOCI_SERVICES_BEDROCK_AGENT_CORE_INVOKE_RESPONSE |
{"output":"yes"} |
Canned InvokeAgentRuntime response body |
FLOCI_SERVICES_BEDROCK_AGENT_CORE_VALIDATE_RUNTIME_EXISTS |
false |
When true, InvokeAgentRuntime returns ResourceNotFoundException for an unknown runtime ARN instead of the canned response |
Note on YAML config keys. The status endpoint reports these services as
bedrock-agentcore-controlandbedrock-agentcore, but the YAML property paths use hyphenated words:floci.services.bedrock-agent-core-control.enabledandfloci.services.bedrock-agent-core.enabled(and…bedrock-agent-core.invoke-response,…bedrock-agent-core.validate-runtime-exists). TheFLOCI_*environment variables above map to these paths directly and are the recommended way to configure the service.
Behavior notes
agentRuntimeIdis<name>-<10 alphanumerics>; the ARN embeds a UUID and the version:arn:aws:bedrock-agentcore:<region>:<account>:agent/<uuid>:<version>.agentRuntimeNamemust match[a-zA-Z][a-zA-Z0-9_]{0,47}(no hyphens); invalid names returnValidationException.- Each
UpdateAgentRuntimeincrements the version and preserves prior versions forGetAgentRuntime?version=andListAgentRuntimeVersions. - Timestamps (
createdAt,lastUpdatedAt) are ISO-8601 strings. - Config blobs (
agentRuntimeArtifact,networkConfiguration, …) are stored opaquely and echoed back; they are not deeply validated. CreateMemorypersiststags,encryptionKeyArn, andmemoryExecutionRoleArn;UpdateMemoryappliesdescription,eventExpiryDuration, andmemoryExecutionRoleArn. As in AWS, memory tags are returned only byListTagsForResource, never embedded in thememoryresponse shape.
Examples
export AWS_ENDPOINT_URL=http://localhost:4566
# Create an agent runtime
aws bedrock-agentcore-control create-agent-runtime \
--agent-runtime-name myAgent \
--agent-runtime-artifact '{"containerConfiguration":{"containerUri":"public.ecr.aws/x/agent:latest"}}' \
--network-configuration '{"networkMode":"PUBLIC"}' \
--role-arn "arn:aws:iam::000000000000:role/agent-runtime" \
--endpoint-url $AWS_ENDPOINT_URL
# Get / list
aws bedrock-agentcore-control get-agent-runtime --agent-runtime-id <id> --endpoint-url $AWS_ENDPOINT_URL
aws bedrock-agentcore-control list-agent-runtimes --endpoint-url $AWS_ENDPOINT_URL
# Delete
aws bedrock-agentcore-control delete-agent-runtime --agent-runtime-id <id> --endpoint-url $AWS_ENDPOINT_URL