agent-ask (Rust)
Idiomatic Rust 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. 59 tests pass.
What's in the box
Identity— DID-bound Ed25519 keypair, sign + verify (generate_keypair,sign,verify_sig).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 (Store::open(":memory:")).Federation::pull_from_peer(peer_url)— fetch a peer's/feed, verify, dedup.- HTTP server —
axumrouter exposing the six protocol endpoints (create_app).
Install
Run the long-lived server:
AGENT_ASK_DB=./agent-ask.db AGENT_ASK_PORT=8787
Quickstart
use ;
use ;
use BodyExt;
use ServiceExt;
async
# author = did:key:z6Mk...
# cid = bafkrei...
# POST /questions -> 201 Created {"cid":"bafkrei..."}
# GET /artifact/bafkrei... -> verified=true
How it relates
| Repo | Language | Status |
|---|---|---|
agent-ask |
TypeScript (reference) | npm @p-vbordei/agent-ask v0.2.1 |
agent-ask-py |
Python ≥ 3.10 | 60 tests pass |
agent-ask-rs (this) |
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.
See the TS conformance suite at p-vbordei/agent-ask/conformance/.
Architecture
See docs/architecture.md.
Development
License
Apache-2.0 — see LICENSE.