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.
Release files for pilotprotocol 1.13.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pilotprotocol-1.13.11.tar.gz | 22.3 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pilotprotocol-1.13.11-py3-none-manylinux_2_34_x86_64.manylinux_2_35_x86_64.whl | Python 3 | none | Linux glibc 2.35+ x86-64, Linux glibc 2.34+ x86-64 | Details |
| pilotprotocol-1.13.11-py3-none-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl | Python 3 | none | Linux glibc 2.34+ ARM64, Linux glibc 2.35+ ARM64 | Details |
| pilotprotocol-1.13.11-py3-none-macosx_11_0_x86_64.whl | Python 3 | none | macOS 11.0+ x86-64 | Details |
| pilotprotocol-1.13.11-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
Total release size: 96.0 MB
Release files / pilotprotocol-1.13.11.tar.gz
| Download URL | pilotprotocol-1.13.11.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b938aac01e642a51af684f52671d8606002ce5c6e0eada2a6a602f5152092b9d
|
|
BLAKE2b-256 checksum How to use checksums |
5a49523d6bad9f66b6fb3ad81ac5cc88e2958c4dda9fd79cbe74b5c6d094caaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / pilotprotocol-1.13.11-py3-none-manylinux_2_34_x86_64.manylinux_2_35_x86_64.whl
| Download URL | pilotprotocol-1.13.11-py3-none-manylinux_2_34_x86_64.manylinux_2_35_x86_64.whl |
|---|---|
| Size | 24.8 MB |
| Tags | Linux glibc 2.34+ x86-64 Linux glibc 2.35+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
01bb8b797b4bb81e45a5907eb0dd06abdfe66c37f5f51f986d26d745da89b323
|
|
BLAKE2b-256 checksum How to use checksums |
befccb9cbf24b990ab295f5b8cafa7699054f874f3e3dfc62d6ca582a09b54d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / pilotprotocol-1.13.11-py3-none-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl
| Download URL | pilotprotocol-1.13.11-py3-none-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl |
|---|---|
| Size | 22.5 MB |
| Tags | Linux glibc 2.34+ ARM64 Linux glibc 2.35+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
ce96f4fce000e5ce4999dd17390936173abb07020c5f4e3088f575ece271c214
|
|
BLAKE2b-256 checksum How to use checksums |
733e03a70ede0f435fbd06c5ddf0fd4618eca5d139f09ec00bdf6d510d9037d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / pilotprotocol-1.13.11-py3-none-macosx_11_0_x86_64.whl
| Download URL | pilotprotocol-1.13.11-py3-none-macosx_11_0_x86_64.whl |
|---|---|
| Size | 25.5 MB |
| Tags | Python 3 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
8c610df596153b0ee6f2a57cc22ef3640bdfde99b08571ff77e27ce95a41b891
|
|
BLAKE2b-256 checksum How to use checksums |
3cc46169cc3cd0d5e444fe1bd778c440b025bbc827fa8722d390e45813ff3b67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / pilotprotocol-1.13.11-py3-none-macosx_11_0_arm64.whl
| Download URL | pilotprotocol-1.13.11-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 23.1 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c3ea0f54978f818b0c8bb045743f0ee73a431850033be03fdb087b4351da2936
|
|
BLAKE2b-256 checksum How to use checksums |
1aa3e59568af0bb46cb28092bfa685a14068b5bc0c2510fe7c315a719de38ec9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|