Skip to main content

pact-ax-client

Python SDK for PACT-AX — multi-agent collaboration primitives.

pip install pact-ax-client

30-second quickstart

from pact_ax_client import Agent

agent = Agent("my-agent", base_url="http://localhost:8000")

# Declare what this agent can do
agent.register_capability("contract_review", description="Reviews NDAs and MSAs")

# Find the best trusted agent for a task
decision = agent.route("contract_review")
if decision.routed:
    # Hand off state and wait for acknowledgment
    result = agent.handoff(decision.best_agent, state_data={"doc": "..."})

    # Record the outcome so trust scores update
    agent.remember("contract_review",
                   partner_id=decision.best_agent,
                   outcome="positive")

What's inside

Primitive What it does
Capabilities Register/discover agent skills
Trust Weighted, persistent trust scores between agents
Router Route tasks to the best trusted+capable agent
Episodic Memory Record and recall past interactions
Handoff / Transfer Prepare → send → receive state packets
Dead Letter Queue Park failed deliveries for retry
Consensus Weighted-vote consensus across agents

Resource clients (advanced)

The Agent class is a façade over seven focused clients. Use them directly when you need full control:

from pact_ax_client import (
    CapabilityClient, TrustClient, RouterClient,
    MemoryClient, DLQClient, ConsensusClient, TransferClient,
    HttpClient, Vote,
)

http = HttpClient(base_url="http://localhost:8000")

# Capabilities
caps = CapabilityClient(http)
caps.register("agent-a", "tax_analysis", tags=["finance"])
candidates = caps.find("tax_analysis")

# Trust
trust = TrustClient(http)
ts = trust.get("agent-a", "agent-b")
print(ts.score, ts.recommendation)

# Routing
router = RouterClient(http)
decision = router.route(from_agent="orch", skill="contract_review", min_trust=0.6)
print(decision.best_agent, decision.strategy_used)

# Episodic Memory
mem = MemoryClient(http)
ep = mem.record("agent-a", "reviewed_nda", partner_id="agent-b", outcome="positive")
episodes = mem.recall("agent-a", outcome="positive", limit=10)

# Dead Letter Queue
dlq = DLQClient(http)
entry = dlq.enqueue("pkt-xyz", "agent-a", "agent-b", reason="timeout")
dlq.retry(entry.id)

# Consensus
consensus = ConsensusClient(http)
votes = [Vote("agent-a", "deploy", 0.9), Vote("agent-b", "deploy", 0.75)]
result = consensus.run(votes)
print(result.reached, result.winning_decision)

Error handling

from pact_ax_client.exceptions import NotFoundError, ConflictError, ValidationError, ServerError

try:
    ts = agent.get_trust("unknown-agent")
except NotFoundError:
    print("agent not found")
Exception HTTP status
NotFoundError 404
ConflictError 409
ValidationError 422
ServerError 500

Async support

from pact_ax_client._http import AsyncHttpClient
from pact_ax_client.capabilities import CapabilityClient

async with AsyncHttpClient(base_url="http://localhost:8000") as http:
    caps = CapabilityClient(http)
    result = await caps.register_async("agent-a", "contract_review")

Development

git clone https://github.com/neurobloomai/pact-ax-client
cd pact-ax-client
pip install -e ".[dev]"
pytest tests/ -v

License

MIT © NeuroBloom.ai

Release files for pact-ax-client 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 pact-ax-client 0.1.0
File Size Uploaded
pact_ax_client-0.1.0.tar.gz 15.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pact-ax-client 0.1.0
File Interpreter ABI Platform
pact_ax_client-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.3 kB

Release files / pact_ax_client-0.1.0.tar.gz

Download URL pact_ax_client-0.1.0.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1c1afadac80cdd2c33a858e170cdac6d7161beb84335be09a85f4a92593a8631
BLAKE2b-256 checksum
How to use checksums
43ec10ced0006d31cb83eb529fd103e3600fcdd0bbbb10f6faa6666747ae109b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

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

Download URL pact_ax_client-0.1.0-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c51ede347d2dd37db13797d9a3d347660804e693dce153b3d7e1ec75821e3ef
BLAKE2b-256 checksum
How to use checksums
ae3010b4f401c01dbf76f15a8a054c45e05110978e9418b539248b000746d1f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

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