A stateless forecasting API your agent calls mid-workflow.

LLMs reason over text; they can't forecast from structured data. Cortex is the prediction layer you wire into your agent's tool-calling loop. Upload a dataset, train a model, then call predict, simulate, and outcomes over plain REST, with a TypeScript and Python SDK, an OpenAPI 3.0 spec, and an MCP-ready surface. Stateless by design: every call carries its own inputs, so it drops straight into any agent runtime.

Get an API key
your agent · calling cortex
agent › POST /v1.0/models/mdl-demand-v1/predict
✓ 200 SKU-4521 → 342 units (CI 295–389) · confidence 0.95
agent › POST /v1.0/models/mdl-demand-v1/simulate
scenario run_promotion · vs baseline…
✓ +24.7% units revenue impact +$19,154 / 7d
agent ›

Ten objects, two APIs, one mental model.

The forecasting API turns a dataset into a queryable model. The outcome API turns your agent's own execution traces into a model of what succeeds and what fails. Both share the same auth and base URL.

ObjectAPIPurposeExample
DatasetForecastingStructured table of historical observations used to train a model; can be appended over time.12 months of daily SKU-level sales
ModelForecastingTrained forecaster that accepts input features and returns predictions with confidence intervals.7-day demand forecast for APAC
PredictionForecastingPoint-in-time forecast from current feature values.SKU-4521 → 342 units, CI 295–389
SimulationForecastingWhat-if scenario where one or more inputs are modified to read the predicted impact.+10% price → demand −14.6%
Digital TwinBothPersistent entity holding a model, receiving telemetry, tracking accuracy over time.A twin for "APAC Revenue"
Role TwinOutcomeAn agent identity or version; aggregates performance across all its action types.support-bot-v2
Action TwinOutcomeA specific task type the agent performs; holds the predictive model and receives telemetry.resolve-ticket
Action OutcomeOutcomeA recorded business result (success / failure / pending) linked to an Action Twin, the training label.ticket_reopened

The full surface: two families of routes.

Everything is versioned under /v1.0 and authenticated with a bearer license_token from register. The forecasting routes build and query models; the outcome routes model how your agent performs.

MethodEndpointPurpose
POST/v1.0/auth/registerAuthenticate and obtain a license token + account id
POST/v1.0/datasetsUpload a new dataset (schema + data URL)
POST/v1.0/datasets/{id}/appendAppend new rows to an existing dataset
POST/v1.0/models/trainTrain a forecasting model (target, horizon, entity column)
POST/v1.0/models/{id}/predictGenerate predictions, single or batch, with confidence intervals
POST/v1.0/models/{id}/simulateRun what-if scenario simulations against a baseline
POST/v1.0/models/{id}/retrainTrigger a manual model retrain
GET/v1.0/models/{id}/accuracyRetrieve accuracy metrics and drift indicators
POST/v1.0/twinsCreate a Role or Action Twin (outcome modeling)
POST/v1.0/twins/{id}/telemetryRecord an agent execution trace as a feature vector
POST/v1.0/twins/{id}/predictPre-action prediction: will this task succeed?
POST/v1.0/twins/{id}/outcomesRecord an asynchronous business outcome (the label)
GET/v1.0/twins/{id}/outcome-summaryAggregated success rate and breakdown by signal type

Real calls, real payloads.

A demand predict with its response, a what-if simulate, and the Python quick-start. Same SKU-4521 example throughout, copy, swap the token, run.

predict · 7-day demand for SKU-4521
curl -X POST https://cortex.phaeth.com/v1.0/models/mdl-demand-v1/predict \
  -H "Authorization: Bearer $LICENSE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "inputs": [{
      "sku_id": "SKU-4521",
      "price": 29.99,
      "promotion_active": false,
      "day_of_week": 2,
      "competitor_price": 32.50,
      "weather_temp_c": 24.0
    }],
    "horizon": 7,
    "include_confidence_interval": true
  }'
Response (abridged)
{
  "model_id": "mdl-demand-v1",
  "predictions": [{
    "entity": "SKU-4521",
    "forecast": [
      {"date": "2026-06-23", "value": 342, "lower": 295, "upper": 389},
      {"date": "2026-06-24", "value": 318, "lower": 271, "upper": 365},
      {"date": "2026-06-25", "value": 356, "lower": 309, "upper": 403}
    ]
  }],
  "confidence_level": 0.95
}
Simulate · rank what-if scenarios
curl -X POST https://cortex.phaeth.com/v1.0/models/mdl-demand-v1/simulate \
  -H "Authorization: Bearer $LICENSE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "entity": "SKU-4521",
    "baseline": {"price": 29.99, "promotion_active": false,
                 "competitor_price": 32.50, "weather_temp_c": 24.0},
    "scenarios": [
      {"name": "price_increase_10pct", "changes": {"price": 32.99}},
      {"name": "run_promotion", "changes": {"promotion_active": true}}
    ],
    "horizon": 7
  }'
# run_promotion → +24.7% units · revenue impact +$19,154 / 7d
Python quick-start · pip install phaeth-cortex
from phaeth_cortex import CortexClient

client = CortexClient(api_key="your-api-key")

# Get a 7-day demand forecast
forecast = client.predict(
    model_id="mdl-demand-v1",
    inputs=[{
        "sku_id": "SKU-4521",
        "price": 29.99,
        "promotion_active": False,
        "day_of_week": 2,
        "competitor_price": 32.50,
        "weather_temp_c": 24.0,
    }],
    horizon=7,
)

print(forecast.predictions[0].forecast)
# [{"date": "2026-06-23", "value": 342, "lower": 295, "upper": 389}, ...]

Same API surface. Two ways to run it.

Both modes expose identical routes, SDKs, and the OpenAPI spec, the only difference is the base URL and where your data lives. Start on hosted SaaS, move to your VPC when compliance demands it, without rewriting a line.

ENTERPRISE SAAS

Hosted at cortex.phaeth.com

Multi-tenant, fully managed, auto-scaling. Single-entity predictions serve in 20–80ms. The fastest path to a working integration: register, upload, train, call. Best for startups, SMBs, and teams that want zero infrastructure.

base url · cortex.phaeth.com
LOCAL HOSTING

On-prem or in your VPC

Single-tenant, deployed inside your infrastructure. Raw data never leaves your environment, only encrypted structural metadata reaches the AI layer. Best for regulated industries, data-sovereignty requirements, and large enterprises.

base url · your-host · data stays put

Nine steps to a forecasting agent.

The path from a fresh API key to forecasts surfaced in your product. Each step maps to one or two endpoints above.

  1. Register: obtain your license_token and account_id from /v1.0/auth/register.
  2. Upload data: POST a dataset with a schema and a data URL (Parquet, CSV, or JSON).
  3. Train: POST to /v1.0/models/train with target, horizon, and entity column.
  4. Validate: confirm MAE / RMSE / MAPE / R² meet your business requirements.
  5. Wire predict: register predict as a tool in your agent's calling framework.
  6. Wire simulate: enable what-if reasoning so the agent can compare scenarios.
  7. Stream data: append new rows daily or hourly to keep the model current.
  8. Configure alerts: notify on accuracy degradation or detected drift.
  9. Surface forecasts: display predictions with confidence intervals in your UI.

Pick your stack.

First-class SDKs for the two languages most agent platforms ship in, plus a machine-readable spec you can generate clients or MCP tools from.

TypeScript / Node.js
@phaeth/cortex-sdk

Typed client for the full forecasting and outcome surface. npm i @phaeth/cortex-sdk

Python
phaeth-cortex

The CortexClient used in the quick-start above. pip install phaeth-cortex

REST / OpenAPI 3.0
/v1.0/openapi.json

Generate a client in any language, or wire the routes as MCP tools straight from the spec.


Point your agent at the endpoint.
Ship the forecast.

Get an API key, register, train a model, and wire predict and simulate into your agent's tool loop: REST, SDK, OpenAPI, MCP-ready. SaaS or self-hosted, under your brand.

Questions on deployment or limits? Email [email protected].

STATELESS API SELF-HOSTABLE MCP-READY