Python SDK for Pilot Protocol - the network stack for AI agents
Project description
Pilot Protocol — Python SDK
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.
Install
pip install pilotprotocol
The 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.
Quick start
Make sure a daemon is running:
pilotctl daemon start --hostname my-agent
Then, from your code:
from pilotprotocol import Driver, PilotError
try:
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))
except (PilotError, FileNotFoundError) as e:
# Raised when libpilot isn't installed or no daemon is running.
# Start one with: pilotctl daemon start --hostname my-agent
print(f"pilot daemon unavailable: {e}")
API overview
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, FileNotFoundError) as e:
print(f"error: {e}")
Native library lookup
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
Examples
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
Testing
python -m pytest tests/ -v
Links
- Homepage: https://pilotprotocol.network
- Issues: https://github.com/pilot-protocol/sdk-python/issues
- Node.js SDK:
pilotprotocolon npm - Swift SDK:
sdk-swift
License
AGPL-3.0-or-later. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pilotprotocol-1.13.4.tar.gz.
File metadata
- Download URL: pilotprotocol-1.13.4.tar.gz
- Upload date:
- Size: 15.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8aa9714e27b4e026813a75408c2ca5dd045315edbd2b3dbaf1ce649f74983e71
|
|
| MD5 |
0579d8eb2f48046de248e5fbccc3144c
|
|
| BLAKE2b-256 |
b9a08f4df3359af700fecd6971c2b1093d1b9883a7901e74d83db47f8cf45273
|
File details
Details for the file pilotprotocol-1.13.4-cp311-cp311-manylinux_2_34_x86_64.manylinux_2_35_x86_64.whl.
File metadata
- Download URL: pilotprotocol-1.13.4-cp311-cp311-manylinux_2_34_x86_64.manylinux_2_35_x86_64.whl
- Upload date:
- Size: 15.5 MB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b8a8c99af7bb2b40f18a1ec151560bf220569a2d245efd375aee9d13792771e
|
|
| MD5 |
42e830536f893d3c3245c76a3866b094
|
|
| BLAKE2b-256 |
300cf1c75da59fc83060fb6d039c6f1aa0151f3daa9999ada690791c72899694
|
File details
Details for the file pilotprotocol-1.13.4-cp311-cp311-macosx_26_0_universal2.whl.
File metadata
- Download URL: pilotprotocol-1.13.4-cp311-cp311-macosx_26_0_universal2.whl
- Upload date:
- Size: 14.1 MB
- Tags: CPython 3.11, macOS 26.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3f1966dd8296bf74b400c42b1d8a17c8199d3a4813bc5b68d833c708b93d5e8
|
|
| MD5 |
f2e302342812a1e00b63e0ada2ac7d9c
|
|
| BLAKE2b-256 |
1eca4be8254a4673eb146b68ad950bab6654cec0b192474808a8865e9b796b15
|