Skip to main content

Reference implementation of the Agent Deliberation Protocol (ADP). Python/FastAPI runtime for agents that deliberate, sign proposals, journal outcomes, and publish signed calibration snapshots.

Project description

adp-agent

PyPI Downloads Python License Spec

Python / FastAPI reference implementation of the Agent Deliberation Protocol. Sister project to the TypeScript @ai-manifests/adp-agent and the C# Adp.Agent runtimes — same wire format, same cross-language signing interop.

Install

pip install adp-agent

Packages are published to the Gitea PyPI feed. Configure pip once:

# pyproject.toml
[tool.pip]
extra-index-url = "https://git.marketally.com/api/packages/ai-manifests/pypi/simple"

Or with uv:

# pyproject.toml
[[tool.uv.index]]
name = "ai-manifests"
url = "https://git.marketally.com/api/packages/ai-manifests/pypi/simple"

Minimal use

from adp_agent import AgentConfig, AdpAgentHost, JournalBackend
from adp_manifest import StakeMagnitude, Vote


config = AgentConfig(
    agent_id="did:adp:my-agent-v1",
    port=3000,
    domain="my-agent.example.com",
    decision_classes=("code.correctness",),
    authorities={"code.correctness": 0.7},
    stake_magnitude=StakeMagnitude.MEDIUM,
    default_vote=Vote.APPROVE,
    default_confidence=0.65,
    dissent_conditions=("if any test marked critical regresses",),
    journal_dir="./journal",
)

host = AdpAgentHost(config)
await host.run()

The AdpAgentHost class serves:

  • GET /healthz
  • GET /.well-known/adp-manifest.json
  • GET /.well-known/adp-calibration.json (signed, ADJ §7.4)
  • POST /api/propose
  • POST /api/respond-falsification
  • POST /api/deliberate
  • POST /api/record-outcome
  • GET /adj/v0/calibration
  • GET /adj/v0/deliberation/{id}
  • GET /adj/v0/deliberations
  • GET /adj/v0/outcome/{id}
  • GET /adj/v0/entries
  • POST /api/budget

The adopter implements an Evaluator (the function that produces votes) and hands it to the host. See adp-agent-template-python for the full starter pattern.

With optional chain anchoring

from adp_agent_anchor import BlockchainStoreFactory, CalibrationAnchorScheduler

host = AdpAgentHost(config)

if config.calibration_anchor and config.calibration_anchor.enabled:
    store = BlockchainStoreFactory.create(config.calibration_anchor)
    if store:
        scheduler = CalibrationAnchorScheduler(config, host.journal, store)
        host.after_start(scheduler.start)
        host.before_stop(scheduler.stop)

await host.run()

Targets: mock, neo-express, neo-custom, neo-testnet, neo-mainnet. Same code, same smart contract, only the RPC URL, contract hash, and signing wallet differ.

Feature parity vs TypeScript @ai-manifests/adp-agent@0.3.0

See CHANGELOG.md for the full feature parity matrix. Short version: everything except distributed deliberation, MCP tool server, and the Neo3 RPC client itself ships in 0.1.0. Those three are v0.2.0 deliverables, stubbed with 501 responses / NotImplementedError so adopters get honest errors instead of silent failures.

License

Apache-2.0 — see LICENSE for the full license text and NOTICE for attribution.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adp_agent-0.7.0.tar.gz (51.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adp_agent-0.7.0-py3-none-any.whl (54.3 kB view details)

Uploaded Python 3

File details

Details for the file adp_agent-0.7.0.tar.gz.

File metadata

  • Download URL: adp_agent-0.7.0.tar.gz
  • Upload date:
  • Size: 51.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for adp_agent-0.7.0.tar.gz
Algorithm Hash digest
SHA256 8048c81a22e1115f3da4168ed30c972d3152081e67c1f1f65388f4ae232dc8d7
MD5 39d5b161ecc17ffccd1e59b78269c9f4
BLAKE2b-256 f9db0d73e377e10dbc6d69b5bd0b8ef0df27f5b14b2ba05508042c2ae5eb25b2

See more details on using hashes here.

File details

Details for the file adp_agent-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: adp_agent-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 54.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for adp_agent-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fc2727a8fc38540feb0f2b722b86d72a20b074a27a7d222d39a8c0765a13d75
MD5 195c7d159b98d09078faecb6da4af36e
BLAKE2b-256 8052bbca3794260598154ec3cf8d2ebea0614c791b03cfefb7afcef4e898c7a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page