Python client for the Pilot Protocol overlay network. Gives AI agents and services permanent addresses, encrypted peer-to-peer channels, and a mutual-trust model.
The SDK calls into a pre-built libpilot shared library (.so / .dylib / .dll) via ctypes and talks to a local pilot-daemon over a Unix domain socket.
pip install pilotprotocolThe wheel ships the native libpilot library plus console entry points: pilotctl, pilot-daemon, pilot-gateway, pilot-updater.
Supported platforms: Linux (x86_64, arm64), macOS (Intel, Apple Silicon). Windows is experimental.
Make sure a daemon is running:
pilotctl daemon start --hostname my-agentThen, from your code:
from pilotprotocol import Driver
with Driver() as d:
info = d.info()
print(f"address={info['address']}")
d.set_hostname("my-python-agent")
peer = d.resolve_hostname("other-agent")
with d.dial(f"{peer['address']}:1000") as conn:
conn.write(b"hello")
print(conn.read(4096))Driver is the connection to the local daemon. Highlights:
- Identity:
info,set_hostname,set_visibility,set_tags,resolve_hostname - Trust:
handshake,pending_handshakes,approve_handshake,reject_handshake,trusted_peers,revoke_trust - Streams:
dial,listen(returningConn/Listener, both context managers) - Datagrams:
send_to,recv_from - Built-in services:
send_message,send_file(data exchange);publish_event,subscribe_event(event stream);submit_task(task queue) - Config:
set_webhook,set_task_exec,deregister,disconnect
All daemon-side errors are raised as PilotError.
from pilotprotocol import Driver, PilotError
try:
with Driver() as d:
d.resolve_hostname("unknown")
except PilotError as e:
print(f"error: {e}")The SDK searches for libpilot.{so,dylib,dll} in this order:
PILOT_LIB_PATHenvironment variable (explicit path)- The installed package directory (bundled wheel layout)
~/.pilot/bin/(entry-point install location)<project_root>/bin/(development layout)- System library search path
See examples/ for runnable programs:
basic_usage.py— connection, identity, trustdata_exchange_demo.py— messages, files, JSONevent_stream_demo.py— pub/subtask_submit_demo.py— task delegationpydantic_ai_agent.py/pydantic_ai_multiagent.py— PydanticAI integration
python -m pytest tests/ -v- Homepage: https://pilotprotocol.network
- Issues: https://github.com/pilot-protocol/sdk-python/issues
- Node.js SDK:
pilotprotocolon npm - Swift SDK:
sdk-swift
AGPL-3.0-or-later. See LICENSE.