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.
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.
| Object | API | Purpose | Example |
|---|---|---|---|
| Dataset | Forecasting | Structured table of historical observations used to train a model; can be appended over time. | 12 months of daily SKU-level sales |
| Model | Forecasting | Trained forecaster that accepts input features and returns predictions with confidence intervals. | 7-day demand forecast for APAC |
| Prediction | Forecasting | Point-in-time forecast from current feature values. | SKU-4521 → 342 units, CI 295–389 |
| Simulation | Forecasting | What-if scenario where one or more inputs are modified to read the predicted impact. | +10% price → demand −14.6% |
| Digital Twin | Both | Persistent entity holding a model, receiving telemetry, tracking accuracy over time. | A twin for "APAC Revenue" |
| Role Twin | Outcome | An agent identity or version; aggregates performance across all its action types. | support-bot-v2 |
| Action Twin | Outcome | A specific task type the agent performs; holds the predictive model and receives telemetry. | resolve-ticket |
| Action Outcome | Outcome | A recorded business result (success / failure / pending) linked to an Action Twin, the training label. | ticket_reopened |
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.
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /v1.0/auth/register | Authenticate and obtain a license token + account id |
| POST | /v1.0/datasets | Upload a new dataset (schema + data URL) |
| POST | /v1.0/datasets/{id}/append | Append new rows to an existing dataset |
| POST | /v1.0/models/train | Train a forecasting model (target, horizon, entity column) |
| POST | /v1.0/models/{id}/predict | Generate predictions, single or batch, with confidence intervals |
| POST | /v1.0/models/{id}/simulate | Run what-if scenario simulations against a baseline |
| POST | /v1.0/models/{id}/retrain | Trigger a manual model retrain |
| GET | /v1.0/models/{id}/accuracy | Retrieve accuracy metrics and drift indicators |
| POST | /v1.0/twins | Create a Role or Action Twin (outcome modeling) |
| POST | /v1.0/twins/{id}/telemetry | Record an agent execution trace as a feature vector |
| POST | /v1.0/twins/{id}/predict | Pre-action prediction: will this task succeed? |
| POST | /v1.0/twins/{id}/outcomes | Record an asynchronous business outcome (the label) |
| GET | /v1.0/twins/{id}/outcome-summary | Aggregated success rate and breakdown by signal type |
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.
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
}'
{
"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
}
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
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}, ...]
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.
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.
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.
The path from a fresh API key to forecasts surfaced in your product. Each step maps to one or two endpoints above.
license_token and account_id from /v1.0/auth/register./v1.0/models/train with target, horizon, and entity column.predict as a tool in your agent's calling framework.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.
@phaeth/cortex-sdk
Typed client for the full forecasting and outcome surface. npm i @phaeth/cortex-sdk
phaeth-cortex
The CortexClient used in the quick-start above. pip install phaeth-cortex
/v1.0/openapi.json
Generate a client in any language, or wire the routes as MCP tools straight from the spec.
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].