Skip to main content

Python SDK for building ACP agents that integrate with the Shepaw app

Project description

shepaw-acp-sdk

Python SDK for building ACP (Agent Communication Protocol) agents that integrate with the Shepaw app.

Installation

pip install shepaw-acp-sdk

Quick Start

from shepaw_acp_sdk import ACPAgentServer, TaskContext

class MyAgent(ACPAgentServer):
    async def on_chat(self, ctx: TaskContext, message: str, **kwargs):
        await ctx.send_text(f"You said: {message}")

MyAgent(name="My Agent", token="secret").run(port=8080)

Then in the Shepaw app, add a remote agent:

  • Address: ws://<your-ip>:8080/acp/ws
  • Token: secret

Features

  • ACP Protocol: JSON-RPC 2.0 over WebSocket (RFC 6455)
  • Streaming responses: Real-time token-by-token output
  • Interactive UI: Send rich UI components (buttons, forms, etc.)
  • LLM Providers: Built-in support for OpenAI, Claude (Anthropic), GLM
  • Conversation history: Per-session history with configurable TTL
  • Tunnel support: Expose local agents to the public internet via Shepaw Channel Service
  • OpenClaw integration: Bridge to OpenClaw Gateway

Examples

Echo Agent (minimal)

from shepaw_acp_sdk import ACPAgentServer, TaskContext

class EchoAgent(ACPAgentServer):
    async def on_chat(self, ctx: TaskContext, message: str, **kwargs):
        await ctx.send_text(f"Echo: {message}")

EchoAgent(name="Echo Agent", token="my-secret").run(port=8080)

LLM Agent (OpenAI streaming)

import os
from shepaw_acp_sdk import ACPAgentServer, OpenAIProvider, TaskContext

class LLMAgent(ACPAgentServer):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.provider = OpenAIProvider(
            api_base=os.getenv("OPENAI_API_BASE", "https://api.openai.com/v1"),
            api_key=os.getenv("OPENAI_API_KEY", ""),
            model=os.getenv("OPENAI_MODEL", "gpt-4o"),
        )

    async def on_chat(self, ctx: TaskContext, message: str, **kwargs):
        messages = kwargs.get("messages", [])
        async for chunk in self.provider.stream_chat(messages, self.system_prompt):
            await ctx.send_text(chunk)

LLMAgent(name="LLM Agent", token="my-secret").run(port=8080)

Public Tunnel

import os
from shepaw_acp_sdk import ACPAgentServer, ChannelTunnelConfig, TaskContext

class MyAgent(ACPAgentServer):
    async def on_chat(self, ctx: TaskContext, message: str, **kwargs):
        await ctx.send_text(f"Hello: {message}")

agent = MyAgent(name="My Agent")
tunnel = ChannelTunnelConfig(
    server_url=os.environ["PAW_ACP_TUNNEL_SERVER_URL"],
    channel_id=os.environ["PAW_ACP_TUNNEL_CHANNEL_ID"],
    secret=os.environ["PAW_ACP_TUNNEL_SECRET"],
)
agent.run_with_tunnel(tunnel_config=tunnel, port=8080)

API Reference

See API_REFERENCE.md for full documentation.

Protocol Overview

ACP is built on JSON-RPC 2.0 over WebSocket:

Message Direction Description
auth.authenticate Client → Server Token authentication
agent.chat Client → Server Send a message
agent.getCard Client → Server Fetch agent metadata
ui.textContent Server → Client Stream text response
task.started Server → Client Task started notification
task.completed Server → Client Task completed notification

Requirements

  • Python 3.10+
  • aiohttp >= 3.9

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shepaw_acp_sdk-0.1.1.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shepaw_acp_sdk-0.1.1-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file shepaw_acp_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: shepaw_acp_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for shepaw_acp_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c49c19a5fa78822d17815dc0de7b3502efeafe649fc27da7eedc5b0e9f1eeb5a
MD5 f48ac1e365beb3d2e02affdc51816405
BLAKE2b-256 774adb8b108ddfd85065b7b1008cfe1a204d68361138474f5fec43c93be72c66

See more details on using hashes here.

File details

Details for the file shepaw_acp_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: shepaw_acp_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for shepaw_acp_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e1c22e6992d9b14dde79e66186f65b99f5a1cc8cb2d222a4d0096a942874b815
MD5 d3021fe1289602876b0557fb2d3b7fc3
BLAKE2b-256 6917d577b66af4d9d5031c1b6a7e821721d7dea08ef1a256182500001005e5db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page