Skip to main content

Pilot Protocol — Python SDK

ci codecov License: AGPL-3.0

PyPI version Python versions

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 (returning Conn / 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:

  1. PILOT_LIB_PATH environment variable (explicit path)
  2. The installed package directory (bundled wheel layout)
  3. ~/.pilot/bin/ (entry-point install location)
  4. <project_root>/bin/ (development layout)
  5. System library search path

Examples

See examples/ for runnable programs:

  • basic_usage.py — connection, identity, trust
  • data_exchange_demo.py — messages, files, JSON
  • event_stream_demo.py — pub/sub
  • task_submit_demo.py — task delegation
  • pydantic_ai_agent.py / pydantic_ai_multiagent.py — PydanticAI integration

Testing

python -m pytest tests/ -v

License

AGPL-3.0-or-later. See LICENSE.

Metadata

Release files for pilotprotocol 1.17.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pilotprotocol 1.17.0
File Size Uploaded
pilotprotocol-1.17.0.tar.gz 22.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pilotprotocol 1.17.0
File
pilotprotocol-1.17.0-py3-none-manylinux_2_34_x86_64.manylinux_2_35_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64, Linux glibc 2.35+ x86-64 Details
pilotprotocol-1.17.0-py3-none-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl Python 3 none Linux glibc 2.35+ ARM64, Linux glibc 2.34+ ARM64 Details
pilotprotocol-1.17.0-py3-none-macosx_11_0_x86_64.whl Python 3 none macOS 11.0+ x86-64 Details
pilotprotocol-1.17.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details

Total release size: 92.8 MB

Release files / pilotprotocol-1.17.0.tar.gz

Download URL pilotprotocol-1.17.0.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0e7390174e7ca9dfda695f90be548340805256844659988240ac34c834356b6c
BLAKE2b-256 checksum
How to use checksums
862f81342f8d0f73b212c079718a1ba5d3d7601ca4d2276f95818efdb281f9d1
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.17.0-py3-none-manylinux_2_34_x86_64.manylinux_2_35_x86_64.whl

Download URL pilotprotocol-1.17.0-py3-none-manylinux_2_34_x86_64.manylinux_2_35_x86_64.whl
Size 24.0 MB
Tags Linux glibc 2.34+ x86-64 Linux glibc 2.35+ x86-64 Python 3
SHA-256 checksum
How to use checksums
c35fe95945d4b1e4a8bdad1b7c5c093679e5571b6962024bb4685389bec5601c
BLAKE2b-256 checksum
How to use checksums
31f03938a291fea64369a7df51694ff00b675b9a855f33387a986f2e30c3bcbb
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.17.0-py3-none-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl

Download URL pilotprotocol-1.17.0-py3-none-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl
Size 21.7 MB
Tags Linux glibc 2.34+ ARM64 Linux glibc 2.35+ ARM64 Python 3
SHA-256 checksum
How to use checksums
aa2ff7fc2ff3d09b677766f445bffb165e5b34331ad6f3d7437315e19e51a2bc
BLAKE2b-256 checksum
How to use checksums
82585fe06c0bd78fa0472e29916a8b073c8980aad7f0c43cca7503087aa15a25
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.17.0-py3-none-macosx_11_0_x86_64.whl

Download URL pilotprotocol-1.17.0-py3-none-macosx_11_0_x86_64.whl
Size 24.7 MB
Tags Python 3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
a39d005185158b90fa56e8979d1189eb6fe9a118b05c292045436a1060a50e81
BLAKE2b-256 checksum
How to use checksums
f7681ec0eeba63b0d9587b1b2ad7665162bc4be590dbb118fd2e0203c1347123
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.17.0-py3-none-macosx_11_0_arm64.whl

Download URL pilotprotocol-1.17.0-py3-none-macosx_11_0_arm64.whl
Size 22.4 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
161032c522d37be88f47eadc1f6b6edb98eb17eb0700505c65a0e7ebee68bf1b
BLAKE2b-256 checksum
How to use checksums
9255b046bd2877ce6d6346287382f9712a4bffcb0571e6132f5ae11b3b20cd84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

1.17.0 This release

5 release files

1.13.9

5 release files

1.13.8

5 release files

1.13.7

5 release files

1.13.6

3 release files

1.13.5

3 release files

1.13.4

3 release files

1.13.3

3 release files

1.13.2

3 release files

1.13.1

3 release files

1.13.0

3 release files

1.12.8

3 release files

1.12.7

3 release files

1.12.6

3 release files

1.12.5

3 release files

1.12.4

3 release files

1.12.3

3 release files

1.10.5

3 release files

1.10.4

3 release files

1.10.3

3 release files

1.10.2

3 release files

1.10.1

3 release files

1.10.0

3 release files

1.9.1

3 release files

1.7.2

3 release files

0.1.2

3 release files

0.1.1

3 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page