Integrating agents

ACP never builds, deploys, schedules or runs agents. Your agent runs on your own compute and calls the ACP agent API, usually through the SDK, signed with its own IAM role as workload identity. What ACP can enforce depends on the enforcement profile and runtime; see coverage levels.

Agents call their models themselves; ACP never calls a model. Before each Amazon Bedrock call the agent asks ACP for a model permit, then calls Bedrock with its own workload role, which IAM limits to the models approved for that agent stage, and finally reports the usage. Bedrock's invocation logs let ACP check those reports independently (see how model calls are governed).

SDK

@acp/sdk-js (packages/sdk-js) is a thin SigV4-signed client for the agent API. It does not bypass policy or budget checks, and removing it does not restore any access IAM denies. It has no Bedrock dependency: your agent brings its own Bedrock client. The package name is not final, and the SDK has not yet been verified against a deployed AWS installation.

A model call has three steps: request a permit, call Bedrock yourself, report the usage. withModelPermit does the first and last for you: it requests the permit, runs your call, and reports succeeded with the usage you return, or failed if your call throws.

import { BedrockRuntimeClient, ConverseCommand } from '@aws-sdk/client-bedrock-runtime';
import { AgentControlPlaneClient } from '@acp/sdk-js';

const ac = new AgentControlPlaneClient({
  endpoint: process.env.AGENT_CONTROL_ENDPOINT!,
  region: process.env.AWS_REGION!,
  // Default AWS credential provider chain; no static keys.
});
const bedrock = new BedrockRuntimeClient({ region: process.env.AWS_REGION });

const run = await ac.startRun({ idempotencyKey: taskId });
try {
  const { result: reply } = await ac.withModelPermit(
    run.id,
    { model: 'primary-model', maxInputTokens: 4_000, maxOutputTokens: 512, idempotencyKey: `${taskId}:model:1` },
    async (permit) => {
      const out = await bedrock.send(new ConverseCommand({
        modelId: permit.invokeModelId,
        requestMetadata: permit.requestMetadata, // lets ACP match Bedrock's log record to this permit
        inferenceConfig: { maxTokens: permit.maxOutputTokens },
        messages,
      }));
      return {
        result: out.output?.message,
        usage: {
          inputTokens: out.usage?.inputTokens ?? 0,
          outputTokens: out.usage?.outputTokens ?? 0,
          latencyMs: out.metrics?.latencyMs,
          providerRequestId: out.$metadata.requestId,
        },
      };
    },
  );
  const action = await ac.invokeTool(run.id, 'draft-email', {
    input: validatedDraft(reply), idempotencyKey: `${taskId}:draft:1`,
  });
  // For waiting approval, persist run/action ID and resume after polling.
  if (action.status === 'waiting_approval') return;
  await ac.completeRun(run.id, { technicalStatus: 'succeeded' });
} catch (e) {
  await ac.completeRun(run.id, { technicalStatus: 'failed' });
  throw e;
}

Rules for a permit:

  • One permit is one call. Request a new permit for each call, including retries that reach Bedrock again.
  • Call Bedrock with permit.invokeModelId, pass permit.requestMetadata unchanged and set the output limit to at most permit.maxOutputTokens. Keep the input within maxInputTokens.
  • Report usage before expiresAt (15 minutes). An unreported permit is charged at the full reserved amount. Report not_called if you decide not to call the model; that releases the reservation.
  • When permit.model.synthetic is true (the demo model, demo inference mode only), there is no model to call: produce your own placeholder output and report synthetic usage.
  • A call without a permit, a second call under one permit, or usage above what you reported or what the permit allowed trips the agent stage's circuit breaker.

requestModelPermit and reportModelUsage are also available separately, for example when the call happens in another process.

MethodPathNotes
POST/agent/v1/runsRegisters a reported run; does not start an agent. Returns runId, releaseId and per-run limits
POST/agent/v1/runs/{id}/model-permits{model, maxInputTokens, maxOutputTokens, idempotencyKey}. Checks grant, policy and limits, reserves the worst-case cost and returns a permit (permitId, invokeModelId, token limits, reservedMicroUsd, expiresAt, requestMetadata). ACP does not call the model
POST/agent/v1/runs/{id}/model-permits/{permitId}/usagestatus (succeeded, failed or not_called) and token counts. Settles the reservation; not_called releases it; 409 permit_expired after expiry
POST/agent/v1/runs/{id}/tools/{toolId}200 executed, 202 waiting_approval, 403 denied with reason
GET/agent/v1/runs/{id}/actions/{actionId}Poll an action (for example after approval)
POST/agent/v1/runs/{id}/heartbeatHeartbeat plus up to 50 telemetry events (marked self-reported)
POST/agent/v1/runs/{id}/completeTechnical (and optional functional) outcome
POST/agent/v1/runs/{id}/outcomesSeparately identified business outcome (self-reported)
GET/agent/v1/configModels, tools and limits available to the bound agent and stage

Errors use {error: {code, message, requestId, retryable}}. Policy denial is 403 with a stable reason code such as policy_denied, tool_not_granted, model_not_approved, model_access_suspended or sandbox_real_side_effect; waiting for approval is 202, not a denial. Also: 401, 404, 409 (state or idempotency conflict), 422 (validation), 429 (budget, limits, throttling), 502 (tool adapter error or outcome_unknown), 503 (dependency unavailable; ACP fails closed). Unbound roles get unregistered_principal.

Idempotency. Every mutating call takes an idempotencyKey (1–200 printable ASCII characters), scoped to agent, stage, route and run. Same key and payload returns the recorded result; a different payload returns 409. Denials replay identically; outcome_unknown is never retried by ACP. Replaying a permit request returns the same permit (with replayed: true); it does not grant a second call. Reporting usage for a permit again returns already_settled.

Approvals. Never hold a request open for a human. On waiting_approval, persist runId, actionId and your task state, end the invocation, and later (from a schedule or queue in your stack) poll GET /agent/v1/runs/{runId}/actions/{actionId}. Resume on succeeded; handle rejected, expired, cancelled and outcome_unknown explicitly. Your agent owns checkpoints, retries, timeouts and resumption; ACP only reports state.

AWS Lambda

The reference runtime, and the only one for which ACP creates workload roles and verifies deployments. Not yet verified on live AWS.

  1. Register the Agent Card with runtime.service: lambda and accessProfile: iam-managed.
  2. Create one workload role per stage: POST /api/v1/agents/{id}/permissions/apply with {stage: sandbox, mode: create}, then production (mode: adopt adopts an existing role). Roles are acp-<installation>-<agentId>-sbx|prod under /acp/<installation>/workloads/, trust only lambda.amazonaws.com (with aws:SourceAccount) and carry the workload permissions boundary. They allow only the ACP agent API, the function's own log groups (/aws/lambda/<agentId>-<stage>*) and read-only grants from the agent's permissions.md, and synchronous model invocation on the exact ARNs of the agent stage's approved models. Asynchronous and batch inference, Bedrock agents and flows, SES, IAM, role assumption and ACP's tables are explicitly denied (see permissions). When the approved models or policy change, apply permissions again so the role matches.
  3. Deploy the functions yourself, named <agentId>-sbx… / <agentId>-prod… so the log permissions match, with the role imported as immutable in your CDK (see infra/stack.ts). The deployer needs iam:PassRole for that role only.
  4. Set AGENT_CONTROL_ENDPOINT to the agent API URL; the SDK uses the default credential chain.
  5. Publish immutable versions behind a controlled alias and submit the published version (never $LATEST) as evidence. ACP calls GetFunction and checks CodeSha256 against the approved digest and the execution role against the bound role before activation.
  6. Restrict lambda:UpdateFunctionCode, UpdateAlias and iam:PassRole on production to the production deployer.

The model allowlist and the denies live in IAM, not the client. The iam-managed profile does not prevent network egress to non-AWS endpoints.

Amazon ECS

Recipe only; not tested on AWS. Tasks call ACP with the SDK using their task role.

  • Bind a dedicated task role per stage as the workload role: POST /api/v1/agents/{id}/bindings with kind: workload (adopt). Attach the ACP workload permissions boundary and grant model invocation only on the approved model ARNs in ACP's desired policy (GET /api/v1/agents/{id}/permissions). ACP never changes an adopted role, so its circuit breaker can only refuse permits for it, not add an IAM deny.
  • ACP emits Lambda trust policies only, so a role trusting ecs-tasks.amazonaws.com shows a trust-policy drift finding and coverage stays integrated, not managed. Review its trust yourself.
  • Release verification is Lambda-only; ECS release linkage shows as unverified. Use immutable image digests in task definitions and record them as the release artifactDigest.
  • Restrict your deployer's iam:PassRole for ecs.amazonaws.com/ecs-tasks.amazonaws.com to the bound role.

Amazon Bedrock AgentCore

Recipe only; not tested against AgentCore. AgentCore Runtime, Gateway, Identity, Memory and Observability are not dependencies of ACP and are not installed by it. To govern an agent you already host on AgentCore Runtime:

  1. Register it with runtime.service: agentcore and accessProfile: registered, or iam-managed if you can give it a dedicated, ACP-verified execution role.
  2. Adopt the runtime's execution role (bindings, kind: workload). Its trust must name the AgentCore service principal for your region, so expect trust-policy drift findings.
  3. Request a model permit before each Bedrock call and send tool calls through the SDK. Grant model invocation only on the approved model ARNs in ACP's desired policy; the ACP boundary denies bedrock-agentcore:*, asynchronous and batch inference, agents and flows. Review the runtime's own permissions separately.
  4. Optionally send AgentCore observability data as scoped heartbeat step events (marked self-reported).

Release linkage shows as unverified and coverage as integrated, not managed.

Release pipeline

ACP does not build, deploy, test or roll back your code; releases covers the approval side. Any pipeline that can sign AWS requests can take part with a deployer role bound per stage (POST /api/v1/agents/{id}/bindings with {kind: deployer, stage, roleArn}). Deployment identities cannot request model permits or approve their own releases.

StepWhoAPI
Build immutable artifact, compute SHA-256Your pipeline—
Register candidate version (artifactDigest, sourceCommit)Human or owner automationPOST /api/v1/agents/{id}/versions
Record a test request and get the sandbox manifestAgent ownerPOST /api/v1/agents/{id}/versions/{v}/test
Deploy to sandbox, run evaluationsYour pipeline (sandbox deployer)POST /deploy/v1/agents/{id}/releases/{v}/evaluations
Submit for reviewAgent ownerPOST /api/v1/agents/{id}/versions/{v}/submit
Independent reviewCTO or delegated approverPOST /api/v1/agents/{id}/versions/{v}/approve
Retrieve approved manifest; verify digestYour pipeline (production deployer)GET /deploy/v1/agents/{id}/releases/{v}/manifest
Deploy, publish versionYour pipeline—
Submit deployment evidenceYour pipeline (production deployer)POST /deploy/v1/agents/{id}/releases/{v}/evidence
ActivateHuman with releases.activatePOST /api/v1/agents/{id}/versions/{v}/activate
  • A failed or missing evaluation blocks submission. The manifest returns 409 until approval, so you cannot deploy first and seek approval later.
  • Re-fetch the manifest just before deploying; abort if approval was withdrawn or the manifest hash changed; never deploy an artifact whose digest differs from it.
  • Rollback authorises a previously approved digest (…/versions/{v}/rollback); your pipeline redeploys it and submits fresh evidence.

GitHub Actions

examples/github-actions has sandbox and production workflow templates, a deploy helper using AgentControlPlaneDeployClient and a CDK stack for OIDC deployer roles. Not verified against live AWS or GitHub. The pattern: GitHub OIDC, never long-lived AWS keys; one deployer role per stage trusted only for your repository, ref and environment (token.actions.githubusercontent.com:sub = repo:ORG/REPO:environment:production) with iam:PassRole limited to that stage's workload role; a protected production environment with required reviewers in addition to ACP approval. Its README covers action pinning and the CDK bootstrap caveat.

Examples

Separate applications, never installed with ACP, and not run against live AWS.

ExampleShows
standalone-lambda-agentLambda agent with its own CDK app: full release flow, durable approval resume, teardown, a known resume-state write limitation
external-sdk-agentMinimal agent for checking a workload binding
agentcore-integrationAgentCore recipe (unverified)
github-actionsOIDC deployer roles and workflow templates

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