Skip to main content

Axon Protocol — Python SDK (axon-protocol)

Official Python client library for integration with the Axon core server. Handles semantic memory, coordination locks, and tamper-proof reasoning receipts for multi-agent AI environments.


Installation

Install the library locally:

pip install axon-protocol

Quickstart

Async Usage

import asyncio
from axon import AxonClient

async def main():
    async with AxonClient(api_key="axon-...", project_id="my-project") as axon:
        # Store memory
        await axon.memory.store("User prefers dark mode")
        
        # Search memory
        results = await axon.memory.search("ui preferences")
        print(results.results[0].content)

        # Acquire lock
        async with axon.lock("resource_1"):
            print("Lock held!")

asyncio.run(main())

Sync Usage

from axon import AxonSyncClient

with AxonSyncClient(api_key="axon-...", project_id="my-project") as axon:
    # Store memory
    axon.memory.store("User prefers dark mode")
    
    # Search memory
    results = axon.memory.search("ui preferences")
    print(results.results[0].content)

    # Acquire lock
    with axon.lock("resource_1"):
        print("Lock held!")

Features

A. Persistent Memory (Semantic Vector Search)

Store memories and query them with semantic similarity matching:

# Async
memory_id = await axon.memory.store(
    content="The API service key is stored in the vault.",
    tags={"category": "vault"},
    scope="project",
    ttl=3600  # auto-expire in 1 hour
)

results = await axon.memory.search(
    query="Where is the API key?",
    limit=5,
    min_similarity=0.6
)

B. Resource Locking (Mutex)

Prevent race conditions in multi-agent environments. Use the lock context manager to automatically release locks:

# Sync Lock Context Manager
with axon.lock("resource_lock", timeout=60) as lock:
    # Exclusive access section
    print(f"Lock acquired, expires at: {lock.expires_at}")

C. Reasoning Steps Recording

Generate cryptographically chained, signed receipts validating agent reasoning processes:

# Async receipt creation
receipt = await axon.receipts.create(
    input="Fix the login bug in auth.py",
    steps=[
        ReasoningStep(thought="Read the login function"),
        ReasoningStep(
            thought="Found missing token validation",
            tool_called="read_file",
            result="Null check missing at line 47"
        )
    ],
    output="Bug fixed"
)

# Automated decoration
@axon.receipts.track(input_param="task")
async def agent_function(task: str, steps_logger=None) -> str:
    steps_logger.add(thought="Analyzing the task")
    return "Done"

D. Real-Time Events Stream

Listen to event streams (like memory additions or lock releases) happening across your project:

# Async stream
async for event in axon.events.listen():
    print(f"Event Captured: {event['event_type']}")

Metadata

Release files for axon-protocol 0.1.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 axon-protocol 0.1.0
File Size Uploaded
axon_protocol-0.1.0.tar.gz 18.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for axon-protocol 0.1.0
File Interpreter ABI Platform
axon_protocol-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.5 kB

Release files / axon_protocol-0.1.0.tar.gz

Download URL axon_protocol-0.1.0.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9a958c08e5d9629466bda41fe7164db9963db1d175d086bbfd35d17526a60910
BLAKE2b-256 checksum
How to use checksums
4385b92f050ca3abf50fa3f0c37fc4850d290948f07ea2a63ecb45a743937dc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / axon_protocol-0.1.0-py3-none-any.whl

Download URL axon_protocol-0.1.0-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64dc49878ecb016bb59fa605c659568aa11664096cb91995f1c21c2a7347e58a
BLAKE2b-256 checksum
How to use checksums
5248fcb5b9a6c31907ce13d2e65948c0898eaf85158b6fadaa522cf5d4e15aa4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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