Files
floci/docs/services/bedrock-agentcore.md
T
lex00 4e6e6df06d feat(bedrockagentcore): emulate the AgentCore control plane and InvokeAgentRuntime stub (#2316)
* docs(bedrockagentcore): add AgentCore emulation design + upgrade path

* feat(bedrockagentcore): add agent runtime CRUD control plane

Implements the bedrock-agentcore-control runtime registry (Phase 1):
Create/Get/List/Update/Delete AgentRuntime plus ListAgentRuntimeVersions,
with immutable version snapshots, cursor pagination, and ISO-8601 timestamps.

- REST-JSON controller + service + reflection-safe models
- ServiceRegistry descriptor + EmulatorConfig toggle
- Unit + RestAssured integration tests
- AWS SDK v2 compatibility test (sdk-test-java)
- Service docs page

Refs lex00/floci#2

* feat(bedrockagentcore): add agent runtime endpoints

Phase 2: Create/Get/Update/Delete/List AgentRuntimeEndpoint under
/runtimes/{id}/runtime-endpoints/, with a DEFAULT endpoint auto-created per
runtime and agentEndpoint/<uuid> ARNs. RestAssured + SDK v2 compat tests.

Refs lex00/floci#3

* feat(bedrockagentcore): add InvokeAgentRuntime data-plane stub

Phase 3: POST /runtimes/{agentRuntimeArn}/invocations returns a fixed,
configurable canned response ({"output":"yes"}) and echoes the runtime
session id. Opaque payload is never parsed; streaming is not emulated.
Separate stateless bedrock-agentcore service. RestAssured + SDK v2 compat tests.

Refs lex00/floci#4

* feat(bedrockagentcore): add tagging and workload identity

Phase 4:
- TagResource/UntagResource/ListTagsForResource for runtime ARNs via a
  TagHandler on the shared /tags/{arn} route
- Workload identity RPC CRUD (POST /identities/<Op>); each runtime auto-creates
  a resolvable workload identity
- Workload-identity timestamps are epoch-seconds (unixTimestamp), distinct from
  the runtime ISO-8601 timestamps

RestAssured + SDK v2 compat tests.

Refs lex00/floci#5

* feat(bedrockagentcore): add gateway and memory primitives

Phase 5 (optional): metadata-only CRUD registries.
- Gateways (POST /gateways/) + gateway targets, standard REST
- Memory (POST /memories/create, GET /memories/{id}/details, ...), action-suffix
- Gateway timestamps are ISO-8601; memory timestamps are epoch seconds
RestAssured + SDK v2 compat tests.

Refs lex00/floci#6

* fix(bedrockagentcore): correctness fixes from adversarial audit

- Fix ListAgentRuntimeVersions pagination cycling for >=10 versions: sort by
  the pagination cursor and zero-pad the version cursor (closes #7)
- Capture authorizerConfiguration/protocolConfiguration in version snapshots so
  GetAgentRuntime?version returns the requested version's config (closes #8)
- Support tagging AgentCore gateways (AWS-taggable): add tags to Gateway,
  dispatch the TagHandler by ARN resource type, store tags on CreateGateway;
  non-taggable AgentCore ARNs now 400 (closes #9)
- Validate maxResults range (1..N) across all list operations (closes #12)

Adds regression tests: version-pagination multi-page, version-config snapshot,
gateway tag round-trip (REST + SDK), unsupported-ARN 400, maxResults + malformed
nextToken validation, and an HTTP-level multi-page pagination test.

Refs lex00/floci#14

* feat(bedrockagentcore): clientToken idempotency, invoke existence flag, config docs

- clientToken idempotency for Runtime/Endpoint/Memory create+delete (lenient:
  same token returns the existing resource; completed-delete tokens tracked
  in-memory so a replayed delete returns 202 not 404) (closes #10)
- InvokeAgentRuntime existence check behind floci.services.bedrock-agent-core
  .validate-runtime-exists (default false, preserving permissive behavior);
  when on, unknown runtime ARNs return ResourceNotFoundException (closes #11)
- Document that YAML config keys are hyphenated (bedrock-agent-core-control),
  distinct from the reported service name (closes #13)

Adds unit tests (create/delete idempotency), a TestProfile integration test for
the existence flag, and an SDK v2 idempotency compat test.

Refs lex00/floci#10 lex00/floci#11 lex00/floci#13

* ci: trigger fork pipeline dry-run

* test(bedrockagentcore): add persistence, region-isolation, concurrency and boundary coverage

Closes the structural test gaps from the audit (issue #14):
- Persistence-across-restart: full AgentRuntime (JsonNode config, Instants,
  version snapshots, endpoints, tags, env vars) round-trips through
  PersistentStorage to disk and reloads intact
- Region isolation: a runtime is invisible/ungettable from another region
- Concurrency: concurrent creates all persist (no dropped inserts)
- Endpoint version retargeting, gateway + target update, duplicate-name 409,
  and memory eventExpiryDuration boundaries (2/3/365/366)

Refs lex00/floci#14

* fix(bedrockagentcore): validate endpoint versions and the identity in a tagging ARN

createEndpoint and updateEndpoint stored agentRuntimeVersion without resolving
it against the runtime, so a version that was never published produced a READY
endpoint whose generated runtime ARN resolves to nothing. Both now reject one
the runtime has not published.

Tag operations resolved a resource from the ARN's id suffix alone, so an ARN
naming another account or region but a local id reached the local runtime or
gateway and could read or change its tags. The shared tag dispatch now checks
both fields against the request, which covers runtimes and gateways in one
place, and reports not found rather than a validation error so the response
does not confirm what sits behind the foreign identity.
2026-08-15 16:24:46 -04:00

94 lines
5.0 KiB
Markdown

# 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](../design/bedrock-agentcore.md) 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 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-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.
## Examples
```bash
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
```