Skip to main content

Python implementation of the Agent Remote Communication (ARC) Protocol

Project description

Agent Remote Communication (ARC) Protocol - Multi-Agent Communication Revolution

PyPI version License: Apache 2.0 Python 3.8+ Downloads GitHub stars Code style: black

๐Ÿš€ Advanced Agent-to-Agent Communication Protocol

ARC (Agent Remote Communication) is a next-generation agent-to-agent protocol that solves multi-agent deployment complexity with built-in agent routing, workflow tracing, and SSE streaming. Deploy hundreds of different agent types on a single endpoint with zero infrastructure overhead.

๐Ÿ—๏ธ Flexible Server Architecture

Single package, multiple deployment options - choose the approach that fits your infrastructure:

  • ๐Ÿ”ง Custom ASGI Server - Standalone server with built-in middleware (zero dependencies)
  • โšก FastAPI Integration - Router for existing FastAPI applications (optional: pip install arc-sdk[fastapi])
  • ๐Ÿชถ Starlette Integration - Lightweight ASGI toolkit integration (optional: pip install arc-sdk[starlette])

๐ŸŽฏ Protocol Advantages Over A2A & ACP:

  • ๐Ÿ—๏ธ Single Endpoint, Multiple Agents - Deploy 10s or 100s of agents behind https://company.com/arc
  • โš–๏ธ Built-in Load Balancing - Route to finance-agent-01, finance-agent-02, finance-agent-03 automatically
  • ๐Ÿ”„ Cross-Agent Workflows - Agent A โ†’ Agent B โ†’ Agent C with full traceability via traceId
  • ๐ŸŽฏ Agent-First Design - Purpose-built for agent communication with native routing
  • ๐Ÿ“ก Unified Agent Management - No service discovery, no API gateways, no orchestration engines required
  • ๐Ÿ” End-to-End Tracing - Track complex workflows across multiple agent interactions
  • โšก Zero Infrastructure Overhead - Single deployment handles all agent types
  • ๐Ÿ”ง Flexible Server Architecture - Custom ASGI, FastAPI, or Starlette integration

๐Ÿ†š ARC vs Other Agent-to-Agent Protocols:

Feature ARC Protocol A2A (Google) ACP (IBM/Linux Foundation)
Streaming Model โœ… SSE (Server-Sent Events) โœ… SSE downstream โš ๏ธ Chunked HTTP, not duplex
Transport โœ… HTTP/1.1 + SSE โœ… HTTP/1.1 + SSE โŒ HTTP/1.x only
Message Format โœ… JSON with structured parts โœ… JSON with parts โœ… JSON with MIME parts
Task Lifecycle โœ… Native task methods + webhooks โš ๏ธ SSE + webhook registration โš ๏ธ Client polling/resume
Multi-Agent Routing โœ… Single endpoint, built-in โœ… Agent Card discovery โš ๏ธ Manifest-based, looser
Agent Discovery โœ… Built-in agent routing โœ… Agent Card system โš ๏ธ Manifest-based discovery
Error Handling โœ… Rich error taxonomy (500+ codes) โš ๏ธ JSON-RPC error codes โš ๏ธ HTTP status codes
Workflow Tracing โœ… Native traceId support โš ๏ธ Custom implementation โš ๏ธ Custom implementation
Learning Curve โœ… Simple RPC-style โœ… Familiar JSON-RPC โœ… REST-like HTTP
Governance โœ… Open Protocol โš ๏ธ Google-led โœ… Linux Foundation

๐Ÿ“ฆ Quick Start

Installation Options

Core Package (Custom ASGI Server):

pip install arc-sdk

With FastAPI Integration:

pip install arc-sdk[fastapi]

With Starlette Integration:

pip install arc-sdk[starlette]

All Framework Integrations:

pip install arc-sdk[all]

๐Ÿ”ฅ 30-Second Multi-Agent Demo

from arc import ARCClient

# Create ARC client
client = ARCClient("https://company.com/arc", token="your-oauth2-token")

# Step 1: User requests document analysis
task_response = await client.task.create(
    target_agent="document-analyzer-01",
    initial_message={"role": "user", "parts": [{"type": "TextPart", "content": "Analyze quarterly report"}]},
    trace_id="workflow_quarterly_report_789"  # ๐Ÿ” Workflow tracking
)

# Step 2: Document agent automatically calls chart generator
chart_response = await client.task.create(
    target_agent="chart-generator-01", 
    initial_message={"role": "agent", "parts": [{"type": "DataPart", "content": "{\"revenue\": 1000000}"}]},
    trace_id="workflow_quarterly_report_789"  # ๐Ÿ” Same workflow ID!
)

# Step 3: Real-time chat with customer support agent
chat = await client.chat.start(
    target_agent="support-agent-01",
    initial_message={"role": "user", "parts": [{"type": "TextPart", "content": "Help with account"}]}
)

๐Ÿ—๏ธ Architecture: Single Endpoint, Infinite Agents

https://company.com/arc  โ† Single endpoint for everything
โ”œโ”€โ”€ finance-analyzer-01, finance-analyzer-02    (Load balanced)
โ”œโ”€โ”€ document-processor-03, document-processor-04
โ”œโ”€โ”€ chart-generator-05
โ”œโ”€โ”€ customer-support-06
โ””โ”€โ”€ report-writer-07

๐ŸŽฏ Core Methods - Simple but Powerful

๐Ÿ“‹ Task Methods (Asynchronous)

Perfect for long-running operations like document analysis, report generation:

# Create task
task = await client.task.create(target_agent="doc-analyzer", initial_message=msg)

# Send additional input (when agent needs more info)
await client.task.send(task_id="task-123", message=additional_msg)

# Get results
result = await client.task.get(task_id="task-123")

# Cancel if needed
await client.task.cancel(task_id="task-123")

# Subscribe to notifications
await client.task.subscribe(task_id="task-123", webhook_url="https://myapp.com/hooks")

๐Ÿ’ฌ Chat Methods (Real-time)

Perfect for interactive chat, live assistance, collaborative editing:

# Start real-time conversation
chat = await client.chat.start(target_agent="chat-agent", initial_message=msg)

# Continue conversation
await client.chat.message(chat_id="chat-456", message=followup_msg)

# End when done
await client.chat.end(chat_id="chat-456")

๐Ÿ”” Notification Methods (Server-initiated)

Agents push updates back automatically:

# Agents send task progress notifications
await client.task.notification(task_id="task-123", event="TASK_COMPLETED", data={...})

# Agents can stream real-time responses
await client.chat.message(chat_id="chat-456", message=response_msg, stream=True)

๐Ÿ” Enterprise Security & OAuth2

ARC uses industry-standard OAuth2 with agent-specific scopes:

# Requesting agents (initiate work)
scopes = ["arc.task.controller", "arc.chat.controller", "arc.agent.caller"]

# Processing agents (receive work, send notifications)  
scopes = ["arc.task.notify", "arc.chat.receiver", "arc.agent.receiver"]

# Full-service agents (can do both)
scopes = ["arc.task.controller", "arc.task.notify", "arc.chat.controller", "arc.chat.receiver", "arc.agent.caller", "arc.agent.receiver"]

๐ŸŒŸ Real-World Examples

๐Ÿ“Š Multi-Agent Financial Analysis

# Router agent orchestrates entire workflow
trace_id = "financial_analysis_Q4_2024"

# 1. Extract data from documents
doc_task = await client.task.create(
    target_agent="document-extractor-01",
    initial_message={"role": "user", "parts": [{"type": "FilePart", "content": "base64pdf..."}]},
    trace_id=trace_id
)

# 2. Generate charts from extracted data  
chart_task = await client.task.create(
    target_agent="chart-generator-01",
    initial_message={"role": "agent", "parts": [{"type": "DataPart", "content": extracted_data}]},
    trace_id=trace_id  # Same workflow!
)

# 3. Write executive summary
summary_task = await client.task.create(
    target_agent="report-writer-01", 
    initial_message={"role": "agent", "parts": [{"type": "TextPart", "content": "Create summary"}]},
    trace_id=trace_id  # All connected!
)

๐ŸŽง Real-time Customer Support

# Start customer conversation
support_chat = await client.chat.start(
    target_agent="tier1-support-agent",
    initial_message={"role": "user", "parts": [{"type": "TextPart", "content": "My account is locked"}]}
)

# Agent can escalate to specialist
if needs_escalation:
    specialist_chat = await client.chat.start(
        target_agent="account-security-specialist", 
        initial_message={"role": "agent", "parts": [{"type": "TextPart", "content": "Escalated case: account lockout"}]}
    )

๐Ÿ—๏ธ Server Deployment Options

The ARC SDK provides three flexible deployment approaches to fit your infrastructure needs:

1. Custom ASGI Server (Built-in)

Our custom ASGI implementation provides a complete, standalone server with built-in middleware:

from arc.server import create_server

# Create multi-agent server with built-in features
server = create_server(
    server_id="my-arc-server",
    enable_chat_manager=True,
    enable_cors=True,
    enable_auth=True
)

@server.agent_handler("finance-agent", "chat.start")
async def handle_finance_chat(params, context):
    return {"type": "chat", "chat": {...}}

# Run standalone server
server.run(host="0.0.0.0", port=8000)

2. FastAPI Integration

Integrate ARC into existing FastAPI applications using our router:

from fastapi import FastAPI
from arc.fastapi import ARCRouter

# Your existing FastAPI app
app = FastAPI()
app.add_middleware(CORSMiddleware, ...)  # Your middleware
app.add_middleware(AuthMiddleware, ...)  # Your auth

# Add ARC router
arc_router = ARCRouter(enable_chat_manager=True, chat_manager_agent_id="server")

@arc_router.agent_handler("finance-agent", "chat.start")
async def handle_finance_chat(params, context):
    return {"type": "chat", "chat": {...}}

# Mount ARC router into your app
app.include_router(arc_router, prefix="/arc")

3. Starlette Integration

For lightweight ASGI applications using Starlette toolkit:

from starlette.applications import Starlette
from starlette.middleware import Middleware
from arc.starlette import ARCRouter

# Lightweight Starlette app
app = Starlette(middleware=[...])  # Your middleware

# Add ARC router
arc_router = ARCRouter(enable_chat_manager=True, chat_manager_agent_id="server")

@arc_router.agent_handler("finance-agent", "chat.start")
async def handle_finance_chat(params, context):
    return {"type": "chat", "chat": {...}}

# Mount ARC router
app.mount("/arc", arc_router)

๐Ÿ”ง Framework Architecture

ASGI Stack Hierarchy:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚    FastAPI      โ”‚ โ† Full web framework with automatic docs, validation
โ”‚   (Full Stack)  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚   Starlette     โ”‚ โ† Lightweight ASGI toolkit with routing, middleware
โ”‚  (Lightweight)  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ASGI Spec      โ”‚ โ† Asynchronous Server Gateway Interface standard
โ”‚ (Foundation)    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

ARC SDK Options:
โ”œโ”€โ”€ Custom ASGI    โ† Our own ASGI implementation (standalone)
โ”œโ”€โ”€ FastAPI        โ† Router for existing FastAPI apps  
โ””โ”€โ”€ Starlette      โ† Router for lightweight ASGI apps

Choose Your Deployment:

  • Custom ASGI: Standalone server, zero dependencies, built-in features
  • FastAPI: Integrate into existing FastAPI apps, full framework features
  • Starlette: Lightweight integration, minimal overhead, ASGI toolkit

๐Ÿข Production Deployment

Docker Deployment

# docker-compose.yml
version: '3.8'
services:
  arc-gateway:
    image: arc-protocol/gateway:latest
    ports:
      - "443:443"
    environment:
      - ARC_OAUTH2_PROVIDER=https://auth.company.com
      - ARC_AGENT_REGISTRY=https://registry.company.com
      
  document-analyzer:
    image: company/document-analyzer:latest
    environment:
      - ARC_ENDPOINT=https://gateway/arc
      - ARC_AGENT_ID=document-analyzer-01

Load Balancing

# Multiple instances automatically load balanced
agents = [
    "finance-analyzer-01",
    "finance-analyzer-02", 
    "finance-analyzer-03"
]

# ARC automatically routes to available instance
task = await client.task.create(
    target_agent="finance-analyzer-01",  # ARC handles routing
    initial_message=analysis_request
)

๐Ÿ“š Documentation

๐Ÿค Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

๐Ÿ“„ License

Licensed under the Apache License 2.0. See LICENSE for details.


๐Ÿš€ Ready to revolutionize your multi-agent architecture?

Choose your deployment approach:

# Standalone server (custom ASGI)
pip install arc-sdk

# FastAPI integration  
pip install arc-sdk[fastapi]

# Starlette integration
pip install arc-sdk[starlette]

# All options
pip install arc-sdk[all]

Join the ARC Protocol community: https://arc-protocol.org

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

arc_sdk-1.2.1.tar.gz (119.7 kB view details)

Uploaded Source

Built Distribution

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

arc_sdk-1.2.1-py3-none-any.whl (100.6 kB view details)

Uploaded Python 3

File details

Details for the file arc_sdk-1.2.1.tar.gz.

File metadata

  • Download URL: arc_sdk-1.2.1.tar.gz
  • Upload date:
  • Size: 119.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for arc_sdk-1.2.1.tar.gz
Algorithm Hash digest
SHA256 966aa04dbb71fe76fa688c6db7dac4e012e33847c57000cf2a3a82e7cd426618
MD5 4dd090c302ad1675de26429561b75ad1
BLAKE2b-256 10d7f26258bbbe54e9f41e57fb9143895c3bf1ff9c85f5acecd144379fbe4e00

See more details on using hashes here.

File details

Details for the file arc_sdk-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: arc_sdk-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 100.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for arc_sdk-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 03d4f4209eaf399dc2a08ef53c04db683b596b570d07b56b070abc100db45066
MD5 44000fce67eddba65d39ce10ee908e04
BLAKE2b-256 9ae33501e17b5b9c980d0742743b97f1bb84d7840dc509db88742ed5165f6c25

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