Skip to content

mariagorskikh/robotcontextprotocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ARP — Autonomous Robot Protocol

The open protocol for connecting LLM agents to physical robots.

CI License Version Python Transport Protocol

Specification  ·  Python SDK  ·  Examples  ·  Schema


What is ARP?

ARP is a protocol — a standardized way for AI agents to discover, control, and monitor physical robots. Think MCP for the physical world.

Today, connecting an LLM to a robot requires custom integration every time. ARP changes that: wrap your robot in an ARP server, and any LLM agent can immediately control it through a universal interface — with safety constraints that the AI cannot override.

ARP Architecture

Key Features

Server Primitives (Robot → LLM)

Primitive Description
Physical Tools Callable actions with safety metadata, preconditions, and execution state
Physical Context Streaming sensor data with coordinate frames (odometry, camera, lidar)
Safety Constraints Non-overridable rules enforced at protocol level

Client Primitives (LLM → Robot)

Primitive Description
Planning Server requests LLM to generate or revise action plans
Workspace Physical/logical boundaries the robot operates within
Confirmation Human approval required for dangerous actions
🛡️ Safety-first
Constraints enforced at protocol level — LLMs cannot override workspace bounds, velocity limits, or force limits
Real-time
Streaming sensor data and execution progress over WebSocket, not just request/response
🤖 LLM-native
Designed for AI agents with tool discovery, natural language descriptions, and human-in-the-loop confirmation
🔌 Universal
Any LLM, any robot. JSON-RPC 2.0 over WebSocket. Python SDK included, more coming.

Quick Start

Install

pip install arp-sdk

Or install from source:

git clone https://github.com/mariagorskikh/robotcontextprotocol.git
cd robotcontextprotocol/sdk/python
pip install -e .

1. Define a Robot Server

from arp_sdk import ARPServer, SafetyMetadata, SafetyLevel

server = ARPServer(name="my-robot", robot_model="Robot Arm v2")

@server.tool(
    description="Move arm to [x, y, z]",
    safety=SafetyMetadata(level=SafetyLevel.NORMAL),
    parameters={"target": {"type": "array"}},
)
async def move_to(target: list[float]) -> dict:
    # Your robot control code here
    return {"reached": target}

asyncio.run(server.run())  # ws://localhost:8765

2. Control from an LLM Agent

from arp_sdk import ARPClient

client = ARPClient("ws://localhost:8765")
await client.connect()
await client.initialize()

# Discover what the robot can do
tools = await client.list_tools()

# Execute an action
result = await client.call_tool("move_to", target=[1.0, 0.5, 0.0])
print(result.state)  # "completed"

# Stream sensor data
await client.subscribe_context("odometry", callback, max_rate=10)

# Safety is enforced — this gets blocked
result = await client.call_tool("move_to", target=[999, 0, 0])
print(result.error)  # "Safety violation: exceeds workspace boundary"

MCP vs ARP

MCP ARP
Domain Digital tools & APIs Physical robots
Safety Application-level Protocol-level enforcement
Real-time Request/response Streaming context + progress
Emergency Stop Built-in primitive
Human-in-the-loop Confirmation primitive
Coordinate Frames Native support
Transport stdio / SSE WebSocket (JSON-RPC 2.0)

Safety

ARP enforces safety at the protocol level — constraints cannot be bypassed by the LLM agent:

Constraint Description
🔲 Workspace bounds Reject motions outside defined boundaries
🏎️ Velocity limits Cap linear and angular speed
💪 Force limits Cap contact force and torque
🚧 Collision zones Define no-go regions
🔴 Emergency stop Immediate halt, callable by any party
Human confirmation Required for critical/dangerous actions

Project Structure

robotcontextprotocol/
├── spec/                  # Protocol specification
│   └── specification.md
├── schema/                # JSON Schema for all messages
│   └── arp.schema.json
├── sdk/python/            # Python SDK
│   ├── arp_sdk/
│   │   ├── server.py      # ARPServer — define robot capabilities
│   │   ├── client.py      # ARPClient — connect and control
│   │   ├── types.py       # Pydantic models for all protocol types
│   │   └── transport.py   # WebSocket transport layer
│   └── tests/             # 72 tests (unit + integration)
├── examples/              # Working examples
│   ├── simple_robot_server.py
│   └── llm_agent_client.py
├── website/               # Project website
└── .github/workflows/     # CI (Python 3.11, 3.12, 3.13)

Protocol Specification

The full spec lives at spec/specification.md. Key design decisions:

  • Transport: JSON-RPC 2.0 over WebSocket (ws:// / wss://)
  • Types: Pydantic models with full JSON Schema validation
  • Lifecycle: InitializeDiscoverExecuteShutdown
  • Error codes: ARP-specific codes (-40001 through -40009) for safety violations, confirmation timeouts, e-stop, etc.
  • State machine: Tools go through IDLE → RUNNING → COMPLETED/FAILED/CANCELLED with progress notifications

Development

# Clone and install
git clone https://github.com/mariagorskikh/robotcontextprotocol.git
cd robotcontextprotocol/sdk/python
pip install -e ".[dev]"

# Run tests
pytest tests/ -v
============================== 72 passed ==============================

Roadmap

  • TypeScript/JavaScript SDK
  • ROS 2 bridge
  • Authentication & TLS
  • Protocol v0.2 with batch tool calls
  • Simulator adapters (Isaac Sim, Gazebo, MuJoCo)
  • PyPI package publication

Contributing

ARP is an early-stage protocol. Contributions welcome — please open an issue to discuss before submitting a PR.

License

Apache 2.0


Built by Maria Gorskikh

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors