Design decisions

The decisions that shape ACP, with the reasoning a contributor needs. Add a section here when you make a decision that future changes must respect.

ACP controls agents; it never runs them

No agent runner, agent hosting, job queue for agent work, workflow interpreter or arbitrary code execution. The tool gateway executes individual authorised tool requests only, and ACP never calls a model (see below); queues and schedules exist only for ACP's own work (approval dispatch, telemetry, aggregation, permit expiry, invocation-log reconciliation, IAM reconciliation). POST /agent/v1/runs records a run; it starts nothing. Evaluations run in your pipeline and are submitted as evidence; deployment and rollback are done by your CI/CD. CDK assertions check that ACP stacks contain no ECS, Batch, Step Functions or CodeBuild resources and that no ACP role can create agent functions. The reference agent is a separate CDK application (examples/standalone-lambda-agent).

ACP never calls a model

Agents call Amazon Bedrock themselves, with their own workload role; no ACP function holds any model invocation permission, and ACP never sees prompts or outputs. Four controls replace calling the model on the agent's behalf:

  1. Model allowlist as IAM. The IAM compiler grants each agent stage bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream (which also authorise Converse and ConverseStream) only on the exact foundation-model ARNs, and inference-profile ARN with a bedrock:InferenceProfileArn condition, of models that are granted, enabled, approved in the catalogue and allowed by policy. Other models are simply absent. The permissions boundary has a bedrock-invoke ceiling instead of denying the bedrock prefix, and still denies asynchronous and batch inference, agents, flows, RetrieveAndGenerate, inference-profile creation and logging changes. Model or policy changes change the desired role, so they show as drift until applied.
  2. Permits. POST /agent/v1/runs/{id}/model-permits checks identity, release, suspension, the circuit breaker, grant, catalogue approval, policy and per-run limits, reserves the worst-case cost and returns a permit for one call with request metadata to pass to Bedrock. The agent reports usage to settle it; unreported permits expire after 15 minutes and are charged in full.
  3. Independent check. Bedrock model invocation logging, set account-wide per Region by an explicit operator command to deliver metadata only to an installation bucket, is reconciled against permits: unreported permits are settled from the log, extra usage and unpermitted calls are charged. Calls by roles not bound to an ACP agent are ignored.
  4. Circuit breaker. Any violation refuses new permits for the agent stage and, for ACP-owned roles, applies an explicit IAM deny on model invocation until an operator resets it.

managed model coverage needs both verified IAM and verified invocation logging; simulated evidence never counts.

Why. Calling the model put ACP on the critical path of every agent's inference: its availability and latency became the agent's, streaming, tool use and multimodal content had to be re-implemented in ACP and always lagged Bedrock, and one ACP function needed broad Bedrock invocation permission. With permits, ACP decides and accounts but never handles prompts or responses.

Trade-off. Calling the model on the agent's behalf gave a hard cap: no call happened without a reservation. Now a misbehaving agent can overspend for the few minutes it takes Bedrock to deliver logs and IAM to propagate; per-call output limits are trusted and then verified; the permit step is cooperative, so skipping it is caught afterwards, not prevented; and invocation logging is account-wide and can be turned off by account administrators, which doctor and maintenance detect but cannot prevent. Log delivery with all content delivery off, IAM enforcement and propagation timing have not yet been verified on AWS.

TypeScript monorepo with a pinned toolchain

pnpm workspaces with exact versions and a committed lockfile. TypeScript 6.0.x (typescript-eslint and other tools do not yet support 7.x). Workspace packages are consumed as TypeScript source; Vitest, tsx and esbuild compile on the fly and Lambdas are bundled by esbuild. JSON Schema (2020-12) with Ajv; types are generated by pnpm generate and a test fails if they are stale. Workspace packages use the private @acp/* namespace and are not published yet; rename the SDK before publishing it.

Serverless, with separate DynamoDB tables

Eight on-demand tables (registry, config, runs, approvals, ledger, audit, aggregates, outbox) so that retention and IAM boundaries differ where they should: point-in-time recovery for registry, config and ledger; TTL for runs, closed approvals and the outbox; the audit table is append-only for writers. Generic pk/sk keys with optional sparse indexes that are never used for enforcement. A single-table design was rejected because it hides IAM and retention boundaries; RDS and ECS were rejected for idle cost and administration.

Storage port with optimistic concurrency

Domain services use a narrow TableStore port (get, put, delete, query, transact) with a closed condition language. Every mutable record carries a revision; updates are conditional on it, with bounded retries, and multi-item invariants use transactions. Budget admission reads counters consistently, checks limits in code and commits with revision conditions, so committed reservations never exceed a limit. An in-memory implementation with identical semantics backs tests and the local server; the DynamoDB implementation lives in @acp/aws-adapters.

Markdown configuration with immutable revisions

Every document has a stable id; uploads create immutable revisions (content in S3 by hash, metadata in the config table). Activation validates the whole candidate snapshot, including every registered Agent Card, then swaps a single manifest pointer conditioned on its expected revision (409 on conflict) and audits old and new hashes; rollback is a new activation of an older revision. Enforcement reads the pointer strongly consistently on every request and fails closed (503) on a missing or mismatched hash. Agent Cards use the same revision store but releases pin an exact revision, so draft edits never change production. The parser accepts YAML 1.2 core only: unique string keys, no anchors, aliases or custom tags, 256 KiB limit, unknown fields rejected.

Policy layering and fail-safe matching

Platform invariants run first and cannot be edited. The enterprise layer is the ceiling: an action must match an enterprise allow or require_approval rule or it is denied; lower layers may only add deny or require_approval. Precedence is deny, then require approval, then allow. Operators are equality, in, notIn and exists; no regular expressions or expressions. Missing or unknown values never match in or equality, and match notIn/exists: false only for restrictive rules, so a deny on unlisted jurisdictions also denies unknown ones. Exceptions are explicit, expiring enterprise rules and can never override a deny. require_approval applies to tool calls.

Workload identity from the IAM request context

Agent and deploy routes use API Gateway AWS_IAM authorisation; the handler reads only the IAM request context. The caller must be an assumed-role session; bindings are keyed by account and role name, and the role's unique ID must match the one recorded at binding, so a deleted-and-recreated role is denied. A role binds to exactly one agent and stage, and each agent stage has at most one active workload binding. The request-context fields must still be confirmed on AWS; if they prove unstable, a Lambda authorizer will do the same resolution.

Budget reservations

Money is integer micro-USD. When it issues a model permit ACP reserves a worst-case amount (the permit's maximum input and output tokens, each capped per model, at catalogue prices) against organisation and agent-stage monthly counters. Unknown prices deny the permit, and live models require administrator-confirmed budgets. The usage report settles the reservation idempotently; not_called releases it; an unreported permit is charged in full at expiry. Reconciliation with Bedrock's invocation logs settles unreported permits from the log and charges extra usage and unpermitted calls as adjustments, which may take spend past a limit and then trip the circuit breaker. This bounds permitted spend; it is not an AWS account spending cap.

Approvals bound to the exact payload, dispatched via an outbox

An approval stores the normalised payload and its hash; the approver submits the hash they reviewed. State changes are conditional, and only the delivery that wins approved → dispatching executes, so duplicate queue messages are harmless. Before dispatch the worker re-checks agent state, release, tool version, payload hash and current policy; a current deny cancels dispatch. A maintenance schedule republishes stuck approvals and marks dispatches stuck for more than 15 minutes as outcome_unknown rather than retrying. Suspension cancels pending approvals.

Daily rollups recomputed from events

Aggregation recomputes today's and yesterday's rollups from immutable source items every few minutes and overwrites them, which is idempotent by construction; reconcileDay checks totals against the ledger. Dashboards read rollups and small snapshots only. Aggregation failure never affects enforcement. Very large estates will need incremental rollups.

Synthetic providers are always labelled

synthetic-demo models are usable only in demo inference mode; there is no model behind them, permits for them are marked synthetic and cost zero, and every usage event is labelled synthetic. Simulated adapters (IAM controller, deployment verifier, directory, email, queues) report simulated: true, and simulated IAM evidence never yields managed coverage. The local server is labelled "local demo" and is never packaged into an AWS deployment.

Idempotency without storing model output

Idempotency records store the request hash and a result envelope, never prompts or model output (ACP never has them). Replaying a permit request returns the same permit, so a retried request never reserves twice or grants a second call; reporting usage again returns already_settled. The same key with a different payload returns 409. Transient failures before any side effect delete the record so the client can retry.

Release verification through the Lambda code hash

A release records the SHA-256 of its deployment package; ACP compares it with the hash reported by your pipeline and the hash it observes on the published Lambda version, and checks the execution role is the bound production role. The approved production manifest is hashed, so a changed manifest needs re-approval. Runtime requests cannot attest the running version, so ACP relies on the exclusive production binding and your deployment controls. Rollback re-approves an earlier digest and requires fresh deployment evidence.

Interactive demo is opt-in and workspace-scoped

packages/demo is a separate entry point deployed only by the demo stack; its routes are kept out of the product route table, so customer installations never expose anonymous or role-switching endpoints. The demo serves the unchanged product API on per-visitor workspaces isolated in the storage layer (every key prefixed, foreign cursors rejected, TTL capped), with HttpOnly session cookies, CSRF tokens, exact allowed origins, quotas and a kill switch. A seeded scenario driver produces synthetic activity through the real services on bounded ticks requested by the browser; it executes no code. See demo.

Console shows each fact once, and the demo carries a single marker

The console presents an agent through one Agent Card (name, owners, purpose, risk, coverage, models, tools and month-to-date performance) that is both the mini card in the Agents list and the header of the agent page; the Markdown source is reachable through "Edit card" and "Export" rather than shown beside the rendered card. Lists default to sortable cards with a list view whose columns sort. Per-agent figures come from the existing metrics drill-down (groupBy=agent), so cards add no API. In the interactive demo the header keeps one persistent "Demo" marker whose tooltip and accessible text carry the full notice; display names in config/demo carry no "(fictional)" suffix, while model IDs keep the fictional. prefix and simulated or synthetic adapters stay labelled in the data they produce.

Dashboard charts are drawn at their measured size

Charts are drawn in the pixel size of their container rather than scaled from a fixed drawing, so chart text is one size at every width (12px, stepping down once to 11px for category labels) and the plot fills its card. A chart changes form instead of clipping or shrinking: a few categories whose labels fit are columns with the value on each cap; long lists, long labels and narrow screens become ranked horizontal bars; one value is a figure; a time series with a single period is a set of figures, not isolated dots. A period still in progress is a dashed tail labelled "so far". Series colours are four fixed tokens per theme (cobalt, amber, teal, violet), checked for colour-vision deficiency and contrast against the card surface; a fifth series takes a neutral. Every chart has a hover and arrow-key readout and the same data as a table. The default CFO dashboard gains a daily spend trend, and the demo's synthetic history spreads policy blocks across four policy reasons (the totals are unchanged) so "by reason" has something to compare.

The console polls on a per-screen cadence

The installed console re-reads each screen on a timer matched to how soon someone must act on it: 15 seconds for approvals, releases and runs, 30 for an agent's page, 60 for lists and dashboards, and only on return to the tab for configuration screens. One schedule in the shell drives the existing quiet-refresh signal, so pages add no timers of their own. It runs only while the tab is visible, refreshes at once on return, backs off to at most every 5 minutes while refreshes fail (saying the page may be out of date) and stops when the API answers 401, so polling can never keep a session alive. Requests are numbered so an older response cannot replace a newer one. Polling was chosen over a push channel: the console has few concurrent users, dashboard figures change only every 5 minutes, and a WebSocket API would add connection state and infrastructure for no visible gain. ACP does not notify approvers outside the console today; a request that cannot wait 15 seconds is a case for that, not for a faster poll. The interactive demo keeps its own clock-driven refresh.

Docs version: 2abf6af98023 · Source: docs/decisions.md · Edit on GitHub