Skip to content

Using pyhall from Any Language

pyhall is language-agnostic. The Python, TypeScript, and Go SDKs are convenience wrappers around a plain HTTP API. If your language has an HTTP client — and every language does — you can use pyhall directly.

The Registry API

All pyhall operations go through api.pyhall.dev. Authentication uses your API key as a Bearer token.

Base URL: https://api.pyhall.dev
Auth: Authorization: Bearer phk_live_<your-key>
Format: application/json

Core Operations

1. Route a Request

Ask the registry whether a capability is allowed to run.

POST /api/v1/dispatch

Body:

{
"namespace": "org.yourco",
"capability": "llm.text.generate",
"worker_id": "wkr_abc123",
"context": {
"risk_tier": "low",
"correlation_id": "req-456"
}
}

Response (allowed):

{
"outcome": "allow",
"worker_id": "wkr_abc123",
"capability": "llm.text.generate",
"correlation_id": "req-456",
"decision_id": "dec_xyz"
}

Response (denied):

{
"outcome": "deny",
"deny_code": "POLICY_BLOCKED",
"reason": "Capability is restricted by namespace policy",
"correlation_id": "req-456"
}

2. Verify a Worker

Check whether a worker is registered, attested, and not banned.

GET /api/v1/verify/{worker_id}

Response:

{
"worker_id": "wkr_abc123",
"namespace": "org.yourco",
"status": "active",
"attested": true,
"attest_sha256": "a1b2c3...",
"ban_status": "clean"
}

3. Enroll a Worker (Hall API)

The local Hall Server handles enrollment — this is the POST /api/v1/hall/enroll endpoint on api.pyhall.dev, called with your API key.

POST /api/v1/hall/enroll
Authorization: Bearer phk_live_<your-key>

Body:

{
"namespace": "org.yourco",
"display_name": "My Worker",
"capabilities": ["llm.text.generate"],
"sha256": "<package-hash>"
}

Code Examples

Terminal window
# Route a request
curl -X POST https://api.pyhall.dev/api/v1/dispatch \
-H "Authorization: Bearer phk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"namespace": "org.yourco",
"capability": "llm.text.generate",
"worker_id": "wkr_abc123"
}'
# Verify a worker
curl https://api.pyhall.dev/api/v1/verify/wkr_abc123 \
-H "Authorization: Bearer phk_live_YOUR_KEY"

Authentication

Every request needs your API key. Get one in the dashboard.

Authorization: Bearer phk_live_<your-key>

API keys are scoped to a namespace. A key for org.yourco cannot route requests for x.someone-else.

Error Responses

All errors return JSON with an error field and a standard HTTP status code.

StatusMeaning
400Bad request — missing or invalid fields
401Unauthorized — missing or invalid API key
403Forbidden — key doesn’t have access to this namespace
404Not found — worker or namespace doesn’t exist
429Rate limited — slow down
500Registry error — try again

What the SDK Adds

The Python, TypeScript, and Go SDKs provide:

  • Local Hall Server — runs in-process, maintains a session, polls the ban list
  • Policy Gate — enforces dispatch rules before your worker runs
  • Attestation — SHA-256 hash of your worker package, verified against the registry
  • Correlation tracking — automatic correlation_id threading through your logs

For lightweight use cases (single scripts, cron jobs, webhooks), calling the REST API directly is completely valid. For production AI agents, the SDK gives you the full safety stack.


Have a language or framework you’d like to see covered? Open an issue in the examples repo.