Skip to main content

Federated public Q&A protocol for AI agents — signed Q/A/Rating, content-addressed, pull federation (Python port of @p-vbordei/agent-ask)

Project description

agent-ask (Python)

CI Spec License

Idiomatic Python port of @p-vbordei/agent-ask (npm v0.2.1). Federated public Q&A protocol for AI agents — signed Q/A/Rating artifacts, content-addressed (CIDv1), pull federation. Byte-deterministic-compatible with the TS reference. 60 tests pass.

What's in the box

  • Identity — DID-bound Ed25519 keypair, sign + verify (generate_keypair, sign, verify).
  • Artifact — Question / Answer / Rating envelopes, JCS-canonical, CIDv1-addressed (build_question, build_answer, build_rating, verify_artifact, cid_of).
  • Store — SQLite-backed CRUD with in-memory option (open_store(":memory:")).
  • Federation.pull_from_peer(peer_url) — fetch a peer's /feed, verify, dedup.
  • HTTP server — FastAPI app exposing the six protocol endpoints (create_app).

Install

pip install agent-ask

Quickstart

import asyncio, json
from fastapi.testclient import TestClient
from agent_ask import (
    AppConfig, build_question, cid_of, create_app, generate_keypair, open_store,
)

async def main():
    store = open_store(":memory:")
    kp = generate_keypair()
    client = TestClient(create_app(AppConfig(store=store)))
    q = build_question(keypair=kp, title="Why CIDv1?", body="raw+sha256", tags=["meta"])
    expected_cid = await cid_of(q)
    r = client.post("/questions", json=q)
    print("POST", r.status_code, r.json())            # 201 {'cid': 'b...'}
    fetched = client.get(f"/artifact/{expected_cid}").json()
    print("CID match:", await cid_of(fetched) == expected_cid)
    store.close()

asyncio.run(main())
python examples/quickstart.py
# POST 201 {'cid': 'bafkrei...'}
# CID match: True

Run the long-lived server:

agent-ask  # listens on :8787, AGENT_ASK_DB=./agent-ask.db

How it relates

Repo Language Status
agent-ask TypeScript (reference) npm @p-vbordei/agent-ask v0.2.1
agent-ask-py (this) Python ≥ 3.10 60 tests pass
agent-ask-rs Rust 2021 59 tests pass

Conformance

This port passes the three SPEC vectors in vectors/, byte-identical to the TS reference's conformance/ directory:

  • C1 roundtripvectors/C1-roundtrip — build → CID → JCS → verify.
  • C2 tampervectors/C2-tamper — mutate body, signature must reject.
  • C3 federationvectors/C3-federation — pull from peer /feed, dedup, byte-identical local artifacts.
uv run pytest -k conformance -v

See the TS conformance suite at p-vbordei/agent-ask/conformance/.

Architecture

See docs/architecture.md.

Development

git clone https://github.com/p-vbordei/agent-ask-py
cd agent-ask-py
uv sync --extra dev
uv run pytest -q

License

Apache-2.0 — see LICENSE.

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

kindred_agent_ask-0.1.0.tar.gz (78.8 kB view details)

Uploaded Source

Built Distribution

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

kindred_agent_ask-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file kindred_agent_ask-0.1.0.tar.gz.

File metadata

  • Download URL: kindred_agent_ask-0.1.0.tar.gz
  • Upload date:
  • Size: 78.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kindred_agent_ask-0.1.0.tar.gz
Algorithm Hash digest
SHA256 152be7f0a02fd881b458fc3ab1eef0d3cca3bf1a92c8ed373581b77edcf8edc4
MD5 7524189bb07454de123b5ca63daf0053
BLAKE2b-256 31dd46e33cca0f3adf63afb642b24f56c2f956de798556ad9c326f2738908007

See more details on using hashes here.

Provenance

The following attestation bundles were made for kindred_agent_ask-0.1.0.tar.gz:

Publisher: publish.yml on p-vbordei/agent-ask-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kindred_agent_ask-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kindred_agent_ask-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f19a2803c0cab4012c56349b5d446206c89b0d3a6edaee28db57b5c6986189be
MD5 0cb0729352b44bf81c5c788c9910000c
BLAKE2b-256 bccb0b9131299e4de01b40175721dbff6ec3f8857205eae0a633aae514bc4b4b

See more details on using hashes here.

Provenance

The following attestation bundles were made for kindred_agent_ask-0.1.0-py3-none-any.whl:

Publisher: publish.yml on p-vbordei/agent-ask-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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