SDK and client libraries
You can use Midcore programmatically by invoking the CLI as a subprocess or by calling the HTTP API when your deployment exposes it. Prefer the OpenAPI document from your running API for exact paths and request bodies.
CLI as subprocess
From any language, run the Midcore CLI in a subprocess (e.g. midcore agent "task", midcore gates run). Parse stdout/stderr and exit codes to detect success or failure. See CLI reference for commands and exit codes.
HTTP API
Call the API host directly (server-to-server or tools like curl) using the paths in OpenAPI—typically under /api/v1/… including /api/v1/autonomy/…. From a browser against the Next.js app, same-origin calls use the BFF prefixes /api/backend/… or /api/autonomy/… as described in Web app & API proxies.
Auth is via API keys, cookies, or SSO depending on your deployment. See API overview and Authentication.
Note
Direct to FastAPI (typical for scripts)
# Health and spec (unauthenticated on many dev setups — confirm yours)
curl -sS "${API_HOST}/health"
curl -sS "${API_HOST}/openapi.json" -o openapi.json
# Example automation path shape (see OpenAPI for the real operation)
curl -sS -X POST "${API_HOST}/api/v1/autonomy/run" \
-H "Content-Type: application/json" \
-d '{"prompt":"example"}'Through the Next.js app (browser or same-origin tools)
# Rewritten to /api/v1/autonomy/... on the API service
curl -sS "https://your-web.example.com/api/autonomy/smart-gates"Future SDK packages
Dedicated SDK packages (e.g. npm, PyPI) may be offered in the future for a more idiomatic way to call the API and run the CLI. For now, use the CLI or HTTP API as above, or generate a client from the OpenAPI guide.