AgentSkillsCN

acp

在实施基于 REST 的代理间通信、任务委托以及多模态消息交换的 Agent Communication Protocol(ACP)时使用。 适用场景:ACP 代理服务器、ACP 客户端集成、通过清单进行代理发现、运行生命周期管理、基于会话的状态化工作流、BeeAI 代理。 切勿用于:JSON-RPC 代理通信(使用 A2A)、LLM 工具集成(使用 MCP)、代理支付(使用 AP2 或 X402)、代理定义(使用 ADL)。

SKILL.md
--- frontmatter
name: acp
description: |
    Use when implementing the Agent Communication Protocol (ACP) for REST-based agent-to-agent communication, task delegation, and multimodal message exchange.
    USE FOR: ACP agent servers, ACP client integration, agent discovery via manifests, run lifecycle management, session-based stateful workflows, BeeAI agents
    DO NOT USE FOR: JSON-RPC agent communication (use a2a), tool integration for LLMs (use mcp), agent payments (use ap2 or x402), agent definition (use adl)
license: Apache-2.0
metadata:
  displayName: "ACP (Agent Communication Protocol)"
  author: "Tyler-R-Kendrick"
compatibility: claude, copilot, cursor

ACP — Agent Communication Protocol

Overview

ACP is an open protocol (originally from IBM / BeeAI, now contributed to the Linux Foundation alongside A2A) for communication between AI agents, applications, and humans. It uses plain REST endpoints — no JSON-RPC, no specialized transport — making it usable with standard HTTP tools like curl, Postman, or any HTTP client.

Status: The standalone ACP repository is archived. ACP's design has been merged into the A2A project under the Linux Foundation. New projects should evaluate A2A, but existing ACP deployments and the SDK remain functional.

Core Concepts

Agent Manifest

Every ACP agent exposes a manifest describing its capabilities — without revealing implementation details:

json
{
  "name": "research-agent",
  "description": "Finds and summarizes information on any topic",
  "metadata": {
    "capabilities": ["streaming", "sessions"]
  }
}

Messages and Parts

Agents exchange Messages composed of Parts. Each part carries a MIME type, enabling multimodal payloads (text, images, audio, files) without protocol changes:

json
{
  "role": "user",
  "parts": [
    {
      "content": "Summarize this document",
      "content_type": "text/plain",
      "content_encoding": "plain"
    },
    {
      "content": "<base64-data>",
      "content_type": "application/pdf",
      "content_encoding": "base64",
      "name": "report.pdf"
    }
  ]
}

Part Metadata

Parts can carry structured metadata for observability and attribution:

  • TrajectoryMetadata — exposes reasoning steps and tool calls
  • CitationMetadata — attributes content to source documents

REST API

Endpoints

MethodPathDescription
GET/agentsList available agents with their manifests
POST/runsExecute an agent (sync, async, or streaming)

Run Lifecycle

code
pending → running → [awaiting] → completed / error
StateMeaning
pendingRun queued, not yet started
runningAgent is executing
awaitingAgent paused, requesting external input
completedFinished successfully
errorExecution failed

Communication Modes

ACP supports three response modes on a single endpoint:

  • Synchronous — block until the run completes
  • Asynchronous — return immediately, poll for status
  • Streaming — SSE stream of incremental results

Python Server Example

python
from acp_sdk.server import Server, Context
from acp_sdk.models import Message, MessagePart

server = Server()

@server.agent()
async def summarizer(input: list[Message], context: Context):
    """Summarizes the provided text."""
    for message in input:
        text = message.parts[0].content
        yield {"thought": "Analyzing content..."}
        yield Message(
            role="agent/summarizer",
            parts=[MessagePart(
                content=f"Summary of: {text[:50]}...",
                content_type="text/plain"
            )]
        )

server.run()

Python Client Example

python
from acp_sdk.client import Client
from acp_sdk.models import Message, MessagePart

async with Client(base_url="http://localhost:8000") as client:
    # Discover agents
    agents = await client.agents()

    # Synchronous run
    run = await client.run_sync(
        agent="summarizer",
        input=[Message(
            role="user",
            parts=[MessagePart(
                content="Summarize this article...",
                content_type="text/plain"
            )]
        )]
    )
    print(run.output)

Session Management

Sessions enable stateful, multi-turn conversations. The SDK manages session state automatically, giving agents access to complete interaction history:

python
async with Client(base_url="http://localhost:8000") as client:
    # First turn — creates a session
    run1 = await client.run_sync(
        agent="assistant",
        input=[Message(role="user", parts=[
            MessagePart(content="My name is Alice", content_type="text/plain")
        ])]
    )

    # Second turn — continues the session
    run2 = await client.run_sync(
        agent="assistant",
        session=run1.session_id,
        input=[Message(role="user", parts=[
            MessagePart(content="What is my name?", content_type="text/plain")
        ])]
    )

High Availability

For production deployments, ACP supports centralized storage backends:

  • Redis — fast, in-memory session and run state
  • PostgreSQL — durable, persistent storage
  • Distributed sessions — URI-based resource sharing across server instances

ACP vs A2A vs MCP

AspectACPA2AMCP
TransportREST (HTTP)HTTP + JSON-RPC + SSEstdio, HTTP + SSE
DiscoveryGET /agentsAgent Cards (.well-known/agent.json)Capabilities negotiation
InteractionRuns (sync/async/stream)Tasks (long-running)Request-response (tool calls)
FocusAgent-to-agent + human-to-agentAgent-to-agent delegationAgent-to-tool integration
MultimodalMIME-typed partsTyped partsTool arguments
SessionsBuilt-in stateful sessionsTask contextConversation context

SDKs

LanguageServerClient
Pythonacp-sdkacp-sdk
TypeScriptacp-sdk
bash
# Python
pip install acp-sdk

# TypeScript
npm install acp-sdk

Best Practices

  • Use GET /agents for runtime discovery so clients can dynamically route to the right agent without hardcoding endpoints.
  • Use sessions for multi-turn workflows — the SDK handles session continuity automatically.
  • Use streaming mode for long-running agents to give callers incremental progress.
  • Attach TrajectoryMetadata to parts when exposing reasoning steps for observability.
  • Use Redis or PostgreSQL backends in production for high availability and fault tolerance.
  • Since ACP has merged into A2A, evaluate A2A for greenfield projects — but ACP SDKs remain functional for existing deployments.