Control Plane Reference
agnitra-api exposes a Starlette/FastAPI service that backs the CLI and SDK when you run optimizations remotely. This reference summarises the main endpoints, request formats, and operational notes.
Authentication
- The API expects
Authorization: Bearer <AGNITRA_API_KEY>headers on every request. - When running self-hosted, set
AGNITRA_API_KEYandAGNITRA_API_BASE_URL(orAGNITRA_CONTROL_PLANE_URL) in your environment before starting the server. - Optional headers:
Agnitra-Project— override the project associated with the API key.Agnitra-Operator— identify the human or service triggering the optimization.
Endpoints
POST /optimize
Submit a model graph and telemetry bundle for optimization.
model_graph— TorchScript FX graph JSON generated by the SDK/CLI.telemetry— Profiler snapshot generated byagnitra optimize --telemetry-out.target— Hardware target (e.g.A100,H100,L40S).project_id(optional) — Overrides the project derived from the API key.options(optional JSON) — Extra flags such as{"enable_rl": true}.
GET /jobs/{job_id}
Poll queued optimizations.
status (queued, running, completed, failed), progress percentages, and final artifact locations. Failed jobs return a structured error payload with remediation hints.
POST /usage
Record billable usage explicitly or replay stored telemetry.
UsageEvent, dispatch results, and any deferred providers. Use this endpoint to replay events when marketplaces were unavailable during the original optimization run.
Status Codes & Error Handling
401 Unauthorized— missing or invalid API key.403 Forbidden— project mismatch or insufficient privileges for the requested operation.422 Unprocessable Entity— invalid telemetry or graph payload. Inspect the error body for validation failures.429 Too Many Requests— control plane throttling. Back off and retry with jitter.5xx— unexpected error. Include theAgnitra-Request-Idheader in support tickets.
Running Locally
- Combine with
uvicornoptions (--reload,--workers) for iterative development. - Set
AGNITRA_OFFLINE_MODE=1to bypass upstream calls while debugging.
Observability
- The service emits structured logs with request IDs and latency buckets.
- Prometheus metrics are exposed at
/metricswhenAGNITRA_ENABLE_METRICS=1. - Use distributed tracing by setting
AGNITRA_TRACING_EXPORTER=otlpand providingOTEL_EXPORTER_OTLP_ENDPOINT.
Related Documentation
- SDK & CLI Guide — local entry points that call these endpoints when
--offlineis disabled. - Marketplace & Billing — usage event schema powering the
/usageendpoint. - Responses API contract — how AI optimization hints are generated before kernels are patched.