Files
floci/docs/services/bedrock-agentcore.md
T
Ovidiu (Ovi) 3003f05953 feat(bedrock-agentcore): implement AgentCore Memory events (#3556)
* feat(bedrock-agentcore): implement AgentCore Memory events

The Memory control plane was emulated but the event data plane was not:
CreateEvent, ListEvents, GetEvent and DeleteEvent were all absent, so an
application that reads a conversation's history had nothing to call.

Rather than answer ListEvents with a fixed empty list, the events are
stored, so a read returns what was written. An empty session is then empty
because nothing wrote to it, not because the answer is hardcoded.

Behaviour captured against real AgentCore in us-west-2:

  - events are returned newest first, and the event id is a zero-padded
    epoch-millisecond prefix plus a random suffix, so ids sort
    chronologically as plain strings
  - includePayloads=false omits the payload key rather than emptying it
  - maxResults accepts 1 to 100; 101 is a ValidationException quoting the
    constraint
  - a malformed memory id is a ValidationException ("Invalid memoryId: not
    a valid memory ID or ARN") while a well-formed but unknown one is a
    ResourceNotFoundException ("Memory not found: <id>"). A memory id is a
    name followed by exactly ten alphanumerics: a nine or eleven character
    suffix is rejected as malformed before any lookup
  - an unknown actor or session is an empty list, not an error
  - sessionId is optional on create, and AgentCore assigns a UUID when it
    is omitted
  - an empty payload is accepted, and a new event lands on the main branch
  - DeleteEvent echoes the deleted id rather than returning an empty body

The endpoints live on the memory controller rather than the data-plane one
because a JAX-RS request is matched against a single root resource class:
the class rooted at "/memories" owns that subtree, and a class rooted at
"/" never gets a look in. The behaviour stays in the data-plane service.

Verified with the same AWS SDK an application would use, pointed at a local
floci: create, list, get and delete round-trip, eventTimestamp parses back
to the exact Date, and each error above arrives as its typed exception.

Memory records (extraction and retrieval) remain unimplemented; they need
an extraction engine rather than stored events.

* fix(bedrock-agentcore): satisfy the docs and native-image CI gates

Three CI failures on this branch, all mine.

The action tables under docs/services are generated, not hand written. I
edited bedrock-agentcore.md directly and put the new event rows in the
wrong position, so `make docs-check` reported the table stale. Regenerated
with `make docs-sync`, which orders actions by registration and therefore
keeps ListMemories ahead of the event family.

BedrockAgentCoreEventService holds a static SecureRandom for event ids.
GraalVM captures such an instance in the image heap unless the class is
initialized at run time, so NativeImageRuntimeInitializationTest failed and
took both native image builds with it. Registered the class under
--initialize-at-run-time alongside the other services that hold one.

* fix(bedrock-agentcore): correct the event wire contract

Three gaps against the modelled contract, all confirmed in the bundled
botocore service model rather than taken on trust.

CreateEvent answers 201, not 200. The operation's HTTP trait says so, and
the test was pinning the wrong status.

payload is a required member of CreateEvent whose valid values include the
empty list. Turning a null into an empty list made an omitted member
indistinguishable from a valid empty array, so presence now travels
separately from the value and an omitted payload is a ValidationException.
The model also caps the list at 100 items, which is now enforced.

ListEvents is paginated. The default page size is 20 rather than the 100
this used, and the request and response carry a nextToken. The token is the
last event id of the previous page rather than an offset: ids sort with
time and the order is stable, so resuming cannot be shifted by a concurrent
write. No token is emitted on the final page, which is what ends a caller's
loop.

Verified with the real SDK against a local floci: five events traverse in
three pages of two, two and one with the token absent on the last, and an
omitted payload comes back as ValidationException.

* fix(bedrock-agentcore): match AWS wording for the maxResults range error

AWS quotes the submitted value and cites only the bound that was breached.
The message always cited the upper bound and dropped the value, so
maxResults=0 reported "less than or equal to 100". Add a test for the
lower bound, which had none.
2026-09-14 00:01:40 -04:00

8.9 KiB

Bedrock AgentCore

Protocol: REST-JSON Endpoint: http://localhost:4566/runtimes/...

Emulates the Amazon Bedrock AgentCore control plane (bedrock-agentcore-control) as a stateful local registry across runtimes, endpoints, gateways, memories, browser/code-interpreter resources, credential providers, gateway rules, and resource policies. No real agent execution: runtimes reach READY immediately and hold metadata only. See the design note for scope and protocol details.

Supported Actions

Action Description
CreateAgentRuntime Register an agent runtime; returns an id, versioned ARN, and workload identity
ListAgentRuntimes List runtimes (paginated)
GetAgentRuntime Get a runtime, optionally a specific version
UpdateAgentRuntime Update a runtime; appends a new immutable version
ListAgentRuntimeVersions List a runtime's versions (paginated)
DeleteAgentRuntime Delete a runtime
CreateAgentRuntimeEndpoint Creates a named runtime endpoint targeting an agent runtime version
GetAgentRuntimeEndpoint Returns a runtime endpoint
UpdateAgentRuntimeEndpoint Updates the target version or description of a runtime endpoint
DeleteAgentRuntimeEndpoint Deletes a runtime endpoint
ListAgentRuntimeEndpoints Lists runtime endpoints for an agent runtime
CreateWorkloadIdentity Creates a workload identity
GetWorkloadIdentity Returns a workload identity
UpdateWorkloadIdentity Updates a workload identity
DeleteWorkloadIdentity Deletes a workload identity
ListWorkloadIdentities Lists workload identities
CreateApiKeyCredentialProvider Creates an API key credential provider
GetApiKeyCredentialProvider Returns an API key credential provider
ListApiKeyCredentialProviders Lists API key credential providers
UpdateApiKeyCredentialProvider Updates an API key credential provider
DeleteApiKeyCredentialProvider Deletes an API key credential provider
CreateOauth2CredentialProvider Creates an OAuth2 credential provider
GetOauth2CredentialProvider Returns an OAuth2 credential provider
ListOauth2CredentialProviders Lists OAuth2 credential providers
UpdateOauth2CredentialProvider Updates an OAuth2 credential provider
DeleteOauth2CredentialProvider Deletes an OAuth2 credential provider
CreateGateway Creates a gateway
GetGateway Returns a gateway
UpdateGateway Updates a gateway
DeleteGateway Deletes a gateway
ListGateways Lists gateways
CreateGatewayTarget Creates a target on a gateway
GetGatewayTarget Returns a gateway target
UpdateGatewayTarget Updates a gateway target
DeleteGatewayTarget Deletes a gateway target
ListGatewayTargets Lists targets on a gateway
CreateMemory Creates a memory resource
GetMemory Returns a memory resource
UpdateMemory Updates a memory resource
DeleteMemory Deletes a memory resource
ListMemories Lists memory resources
CreateEvent Appends an event to a memory. sessionId is optional and generated when omitted
ListEvents Lists a session's events, newest first. POST to the session path, not GET
GetEvent Returns one event
DeleteEvent Deletes one event and echoes its id
CreateBrowser Creates a custom browser
GetCodeInterpreter Returns a custom or system code interpreter
DeleteCodeInterpreter Deletes a custom code interpreter
ListCodeInterpreters Lists custom and system code interpreters
CreateCodeInterpreter Creates a custom code interpreter
CreateBrowserProfile Creates a browser profile
ListBrowserProfiles Lists browser profiles
DeleteBrowserProfile Deletes a browser profile
GetBrowserProfile Returns a browser profile
GetBrowser Returns a custom or system browser
DeleteBrowser Deletes a custom browser
ListBrowsers Lists custom and system browsers
CreateGatewayRule Creates a gateway rule
GetGatewayRule Returns a gateway rule
ListGatewayRules Lists rules on a gateway
UpdateGatewayRule Updates a gateway rule
DeleteGatewayRule Deletes a gateway rule
GetResourcePolicy Returns the policy attached to an AgentCore resource
PutResourcePolicy Creates or replaces a policy on an AgentCore resource
DeleteResourcePolicy Deletes the policy attached to an AgentCore resource

A DEFAULT endpoint is created automatically with each runtime, and each runtime is associated with an auto-created, resolvable workload identity.

Memory events

The event data plane is backed by real storage, so what a read returns is what was written rather than a fixed answer. Behaviour measured against real AgentCore:

  • events come back newest first, and the event id embeds a zero-padded timestamp so ids sort chronologically as plain strings
  • includePayloads: false omits the payload key entirely rather than emptying it
  • maxResults accepts 1 to 100
  • a malformed memory id is a ValidationException, while a well-formed but unknown one is a ResourceNotFoundException. A memory id is a name followed by exactly ten alphanumerics
  • an unknown actor or session is an empty list, not an error
  • a new event lands on the main branch, and an empty payload is accepted, though payload is a required member: omitting it is a ValidationException while [] is valid
  • CreateEvent answers 201, not 200
  • ListEvents pages with nextToken and defaults to 20 events when a caller names no maxResults

Memory records (extraction and retrieval) are not emulated: they depend on an extraction engine rather than on stored events.

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-control and bedrock-agentcore, but the YAML property paths use hyphenated words: floci.services.bedrock-agent-core-control.enabled and floci.services.bedrock-agent-core.enabled (and …bedrock-agent-core.invoke-response, …bedrock-agent-core.validate-runtime-exists). The FLOCI_* environment variables above map to these paths directly and are the recommended way to configure the service.

Behavior notes

  • agentRuntimeId is <name>-<10 alphanumerics>; the ARN embeds a UUID and the version: arn:aws:bedrock-agentcore:<region>:<account>:agent/<uuid>:<version>.
  • agentRuntimeName must match [a-zA-Z][a-zA-Z0-9_]{0,47} (no hyphens); invalid names return ValidationException.
  • Each UpdateAgentRuntime increments the version and preserves prior versions for GetAgentRuntime?version= and ListAgentRuntimeVersions.
  • Timestamps (createdAt, lastUpdatedAt) are ISO-8601 strings.
  • Config blobs (agentRuntimeArtifact, networkConfiguration, …) are stored opaquely and echoed back; they are not deeply validated.
  • CreateMemory persists tags, encryptionKeyArn, and memoryExecutionRoleArn; UpdateMemory applies description, eventExpiryDuration, and memoryExecutionRoleArn. As in AWS, memory tags are returned only by ListTagsForResource, never embedded in the memory response 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