ACP Quickstart

Integrating ACP into your agent framework requires just four straightforward steps. This guide will walk you through initializing a governed agent and executing its first verified action.

Step 1: Install the SDK

Begin by adding the ACP core library to your project.

npm install @acp/core
# or
pip install acp-core

Step 2: Initialize Identity

Generate a cryptographically secure identity for your agent rooted in your organization's key.

import { IdentityManager } from '@acp/core';

// Load institutional root credentials
const rootAuthority = IdentityManager.loadRoot("org-credentials.pem");

// Spawn a new agent identity delegated by the root
const agentIdentity = IdentityManager.spawnAgent({
    parent: rootAuthority,
    name: "trading-agent-beta",
    type: "autonomous_execution"
});

Step 3: Issue Capability Token

Grant the exact capabilities the agent is permitted to perform.

import { CapabilityIssuer } from '@acp/core';

// Create a scoped token restrictng the agent to specific actions
const capabilityToken = CapabilityIssuer.issue({
    agentId: agentIdentity.id,
    allowedActions: ["payments.transfer", "market.query"],
    maxRiskThreshold: 0.25,
    expiresIn: "24h"
});

// Bind capability to the agent
agentIdentity.attachCapability(capabilityToken);

Step 4: Execute Governed Action

Wrap the intended execution payload in an ACP request, signing it with the agent's identity.

import { AcpClient } from '@acp/core';

const client = new AcpClient(agentIdentity);

// The protocol evaluates the invariant before transmission
const response = await client.execute({
    targetSystem: "api.partner-bank.com",
    action: "payments.transfer",
    payload: {
        amount: 1500,
        currency: "USD",
        recipient: "vendor-889"
    }
});

console.log("Verified Execution Result:", response);

Ready to see exactly how the backend validates this request? Check out the Reference Implementation.