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)
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 roundtrip —
vectors/C1-roundtrip— build → CID → JCS → verify. - C2 tamper —
vectors/C2-tamper— mutate body, signature must reject. - C3 federation —
vectors/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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
152be7f0a02fd881b458fc3ab1eef0d3cca3bf1a92c8ed373581b77edcf8edc4
|
|
| MD5 |
7524189bb07454de123b5ca63daf0053
|
|
| BLAKE2b-256 |
31dd46e33cca0f3adf63afb642b24f56c2f956de798556ad9c326f2738908007
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kindred_agent_ask-0.1.0.tar.gz -
Subject digest:
152be7f0a02fd881b458fc3ab1eef0d3cca3bf1a92c8ed373581b77edcf8edc4 - Sigstore transparency entry: 1591083405
- Sigstore integration time:
-
Permalink:
p-vbordei/agent-ask-py@f1aa39477d2e98083776f8ecff9d9f27726c48d7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/p-vbordei
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f1aa39477d2e98083776f8ecff9d9f27726c48d7 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file kindred_agent_ask-0.1.0-py3-none-any.whl.
File metadata
- Download URL: kindred_agent_ask-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f19a2803c0cab4012c56349b5d446206c89b0d3a6edaee28db57b5c6986189be
|
|
| MD5 |
0cb0729352b44bf81c5c788c9910000c
|
|
| BLAKE2b-256 |
bccb0b9131299e4de01b40175721dbff6ec3f8857205eae0a633aae514bc4b4b
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kindred_agent_ask-0.1.0-py3-none-any.whl -
Subject digest:
f19a2803c0cab4012c56349b5d446206c89b0d3a6edaee28db57b5c6986189be - Sigstore transparency entry: 1591083426
- Sigstore integration time:
-
Permalink:
p-vbordei/agent-ask-py@f1aa39477d2e98083776f8ecff9d9f27726c48d7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/p-vbordei
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f1aa39477d2e98083776f8ecff9d9f27726c48d7 -
Trigger Event:
workflow_dispatch
-
Statement type: