Source: lib/api/

Mediator REST API skeleton

FastAPI reference implementation of the AWAP v0.1 ledger service per spec §11.

Endpoints

Method Path Purpose
GET /healthz Liveness probe
POST /attest Validate + persist a signed attestation
GET /verify/{attestation_id} Fetch + verify an attestation
GET /agent/{agent_id}/score Agent reputation score (cached or live-computed)

All endpoints reject:

Run locally

cd ~/mediator/lib/python && source .venv/bin/activate
cd ~/mediator/lib/api
PYTHONPATH=. uvicorn app.main:app --reload --port 8765

Then hit http://localhost:8765/docs for the OpenAPI swagger UI.

Tests

cd ~/mediator/lib/api
source ~/mediator/lib/python/.venv/bin/activate
PYTHONPATH=. python -m pytest tests/ -v

7 tests: healthz, attest+verify roundtrip, tamper rejection, unknown-key rejection, 404 paths, agent scoring, agent 404.

Env vars

Production gaps

This is a skeleton. Before going public: