REST API
Estate Migration & Ontology
On this page
Point Evigauge at an enterprise's existing AI estate and it will map it.
One run samples the workspace's recent traces, infers an operational ontology from them — the desks, workflows, agents, models, tools and data sources that actually appear in the traffic — and produces one cumulative inference: cost and optimization findings for the estate as a whole.
The economics are the point. This is a single LLM call for the whole estate (≈ $0.08 per run), not one call per trace. The per-trace intelligence stack is a separate, much more expensive ingest-time choice; mapping is cheap enough to re-run whenever the estate changes.
Entities and relations are inferred from the traces you have already sent; a thin corpus still returns a valid, sparser ontology, never an error. With no traffic yet, declare your pipeline with a pipeline manifest — the ontology is seeded from it and reconciles with real traces as they arrive.
Active workspaces are re-mapped automatically as traffic accumulates; you do not re-run anything. The cumulative inference runs on BYOK — your LLM credentials. Without a key, the ontology and findings still populate from the deterministic path.
Feature flag. The whole family is gated on
EVIGAUGE_MIGRATION_ENABLED. When it is off,POST …/migration/runreturns 409migration_disabledand the reads behave as if no run exists.
The flow
A run is asynchronous. The POST creates the run row and returns its id before any work has happened — it is a handle to poll, not a result.
POST …/migration/run → { run_id } workspace_admin
GET …/migration/status?run_id=… → { status, stage } workspace_viewer ← poll ~1.5s
GET …/ontology?run_id=… → entities+relations workspace_viewer ← 404 until built
GET …/migration/inference?run_id=… → cumulative findings workspace_viewer ← 404 until built
The run moves through six stages, in this order:
stage | What is happening |
|---|---|
sampling | Selecting a representative slice of recent traces |
evidence | Extracting structured evidence from that slice |
ontology | Inferring entities and relations |
ontology_save | Persisting the ontology |
inference | The single cumulative call — cost and optimization findings |
done | Finished; savings_total_usd and anomaly_count are populated |
The two result endpoints 404 by design, not by failure. …/ontology 404s
until the run passes ontology_save, and …/migration/inference 404s until it
passes inference. Treat a 404 on these as "not yet" and keep polling status;
only status returning 404 means no run exists at all.
Scoping
A run belongs to the resolved (workspace, project) pair, so each project
gets its own. Omitting run_id on any read means the latest run for the active
project. Cross-workspace and cross-project access returns 404, never 403 —
the resource is not visible, so its existence is not confirmed.
Declare your pipeline (manifest)
Seed the ontology before you have traffic. A pipeline manifest is your own
declaration of the pipeline — the agents, models, tools, compute steps and
workflow roles it is built from, plus a short description of what the product
does. Declared entities appear in the ontology immediately with trace_count: 0
and props.source: "manifest", and reconcile with real traces as they arrive: a
declared agent that later shows up in traffic becomes the same node, its count
rising from zero.
The manifest is per (workspace, project) — scope it with ?project= exactly
like every other route here.
GET /v1/observ/orgs/{org}/workspaces/{ws}/pipeline-manifest
PUT /v1/observ/orgs/{org}/workspaces/{ws}/pipeline-manifest
Auth: API key or JWT · Roles: GET workspace_viewer · PUT workspace_admin
Body (PUT)
The bare manifest object — every field optional:
{
"agents": ["planner", "pricing-agent"],
"models": ["claude-opus-4-6", "gpt-4o"],
"tools": ["web_search", "sql"],
"compute_steps": ["ffmpeg_transcode", "ocr"],
"workflows": ["quote", "refund"],
"business_context": "We generate insurance quotes from uploaded documents."
}
Each list is capped at 200 items, each item trimmed to ≤128 characters,
duplicates and blanks dropped; business_context is trimmed to ≤2000
characters. A non-list value for a list field is rejected 422 — send
agents: [], never agents: "". The latest PUT wins.
Response 200
The stored manifest (same shape) under data. A GET before any PUT returns
an empty manifest (all lists [], business_context: null) with 200,
never 404.
How it feeds the ontology
business_context is handed to the cumulative inference, so the estate-wide
findings are written in terms of what your product actually does. Declared
entities are pinned: they are never dropped from the ontology for lack of
traffic, so your architecture stays visible until — and after — traces confirm it.
Examples
root = "/v1/observ/orgs/{org}/workspaces/{ws}"
evigauge.put(f"{root}/pipeline-manifest", json={
"agents": ["planner", "pricing-agent"],
"models": ["claude-opus-4-6"],
"business_context": "We generate insurance quotes from uploaded documents.",
})
manifest = evigauge.get(f"{root}/pipeline-manifest")["data"]
print(manifest["agents"])
const root = "/v1/observ/orgs/{org}/workspaces/{ws}";
await evigauge.put(`${root}/pipeline-manifest`, {
agents: ["planner", "pricing-agent"],
models: ["claude-opus-4-6"],
business_context: "We generate insurance quotes from uploaded documents.",
});
const { data } = await evigauge.get(`${root}/pipeline-manifest`);
Errors
| Status | Code | Meaning |
|---|---|---|
422 | — | A list field received a non-list value |
403 | — | PUT by a caller below workspace_admin |
Start a run
POST /v1/observ/orgs/{org}/workspaces/{ws}/migration/run
Creates the run row synchronously and returns immediately. No body is required.
Auth: API key or JWT · Role: workspace_admin
Response 200 — not schema-modelled
{ "run_id": "mig_7f3a91c4" }
Errors
| Status | Code | Meaning |
|---|---|---|
409 | migration_disabled | EVIGAUGE_MIGRATION_ENABLED is off for this deployment |
403 | — | Caller is below workspace_admin |
Poll run status
GET /v1/observ/orgs/{org}/workspaces/{ws}/migration/status?run_id={run_id}
Omit run_id for the latest run in the active project.
Auth: API key or JWT · Role: workspace_viewer
Query parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
run_id | string | ➖ | latest | Which run to report on |
Response 200 — not schema-modelled
{
"run_id": "mig_7f3a91c4",
"status": "running",
"stage": "ontology",
"trace_count": 1000,
"error": "",
"savings_total_usd": 0,
"anomaly_count": 0
}
| Field | Notes |
|---|---|
status | pending · running · done · failed |
stage | See the stage table above — use it to light a progress display |
trace_count | Traces sampled by this run |
error | Non-empty only when status is failed |
savings_total_usd | 0 until status is done |
anomaly_count | 0 until status is done |
Errors
| Status | Code | Meaning |
|---|---|---|
404 | migration_not_found | This project has never had a run |
Read the ontology
GET /v1/observ/orgs/{org}/workspaces/{ws}/ontology?run_id={run_id}
Omit run_id for the latest run. 404s until the run passes ontology_save.
Auth: API key or JWT · Role: workspace_viewer
Response 200 — not schema-modelled
{
"entities": [
{
"id": "agent:pricing-agent",
"kind": "agent",
"key": "pricing-agent",
"label": "pricing-agent",
"layer": 2,
"trace_count": 201,
"props": {}
}
],
"relations": [
{
"src": "agent:pricing-agent",
"dst": "model:claude-opus-4-6",
"kind": "uses",
"weight": 52.0,
"trace_count": 52
}
]
}
OntologyEntity
| Field | Type | Notes |
|---|---|---|
id | string | "{kind}:{key}", globally unique — usable directly as a graph node id |
kind | string | Open string, not an enum — desk, workflow, agent, model, tool, data, vendor, source, … |
key | string | The identifier within its kind |
label | string | Display name |
layer | integer | 0 desk · 1 workflow · 2 agent · 3 model/tool · 4 data |
trace_count | integer | How many sampled traces it appeared in |
props | object | Kind-specific extras; may be empty |
Style by
layer, label bykind.layeris a fixed 0–4 scale and is safe to switch on.kindis open and will gain values without a breaking change, so a hard-coded enum over it will silently drop new entity types.
Declared vs observed. An entity with
props.source == "manifest"andtrace_count == 0was declared via the pipeline manifest and not yet seen in traffic — badge it "declared" if you like. Once traces confirm it, the same node'strace_countrises above zero.
OntologyRelation
| Field | Type | Notes |
|---|---|---|
src / dst | string | Entity ids |
kind | string | uses, calls, reads, invokes, runs, … — also open |
weight | float | Relative strength of the relation |
trace_count | integer | Traces evidencing it |
Guarantees. Every src and dst is an entity emitted in the same response
— there are no dangling edges — and no relation is duplicated. The payload is
safe to hand straight to a graph renderer without a reachability pass.
Examples
onto = evigauge.get("/v1/observ/orgs/{org}/workspaces/{ws}/ontology")
by_layer = {}
for e in onto["entities"]:
by_layer.setdefault(e["layer"], []).append(e["label"])
for layer in sorted(by_layer):
print(f"layer {layer}: {', '.join(by_layer[layer])}")
print(f"{len(onto['relations'])} relations")
const onto = await evigauge.get("/v1/observ/orgs/{org}/workspaces/{ws}/ontology");
const agents = onto.entities.filter((e: any) => e.layer === 2);
const models = new Set(
onto.relations
.filter((r: any) => r.kind === "uses")
.map((r: any) => r.dst),
);
console.log(`${agents.length} agents across ${models.size} models`);
Read the cumulative inference
GET /v1/observ/orgs/{org}/workspaces/{ws}/migration/inference?run_id={run_id}
Omit run_id for the latest run. 404s until the run passes inference.
Auth: API key or JWT · Role: workspace_viewer
Response 200 — not schema-modelled
{
"prompt": { "narrative": "Four of the six agents re-send the same 3.1k-token preamble…" },
"routing": { "narrative": "claude-sonnet-4-5 carries 437 traces, but 38% of those…" },
"fleet": { "narrative": "Six agents across four desks. pricing-agent and risk-scorer…" },
"operations": { "narrative": "Three anomalies in the sampled window, all on claims-triage…" },
"savings": [
{ "lever": "model_routing", "monthly_usd": 21600, "detail": "Route the simple half of intake classification from sonnet to haiku." },
{ "lever": "prompt_caching", "monthly_usd": 18400, "detail": "Cache the shared policy preamble across four agents." }
],
"savings_total_usd": 54000,
"anomaly_count": 3,
"skipped": false
}
| Field | Type | Notes |
|---|---|---|
prompt routing fleet operations | object | Objects, not strings. Read .narrative off each — stringifying the object yields [object Object] |
savings[] | array | { lever, monthly_usd, detail }; lever is an open string |
savings_total_usd | number | The run's own total for the sampled window |
anomaly_count | integer | Anomalies found in that window |
skipped | boolean | true means the LLM call failed open and these came from deterministic fallbacks — still renderable; worth a quiet "partial" marker |
On totalling savings.
savings_total_usdis this run's figure over its sampled window. If you also show a total derived from Savings & Optimization, do not present both as the number — they are two measurements of the same idea over different windows, and showing them side by side leaves a reader with no way to tell which to quote.
Examples
f = evigauge.get("/v1/observ/orgs/{org}/workspaces/{ws}/migration/inference")
if f["skipped"]:
print("(fallback findings — the inference call failed open)")
for section in ("prompt", "routing", "fleet", "operations"):
print(f"{section}: {f[section]['narrative']}")
for lever in sorted(f["savings"], key=lambda s: -s["monthly_usd"]):
print(f" {lever['lever']}: ${lever['monthly_usd']:,}/mo — {lever['detail']}")
const f = await evigauge.get("/v1/observ/orgs/{org}/workspaces/{ws}/migration/inference");
if (f.skipped) console.warn("fallback findings — the inference call failed open");
console.log(f.routing.narrative); // .narrative — the field is an object
f.savings
.sort((a: any, b: any) => b.monthly_usd - a.monthly_usd)
.forEach((l: any) => console.log(` ${l.lever}: $${l.monthly_usd}/mo`));
End-to-end: run and wait
import time
root = "/v1/observ/orgs/{org}/workspaces/{ws}"
run_id = evigauge.post(f"{root}/migration/run")["run_id"]
print(f"started {run_id}")
while True:
s = evigauge.get(f"{root}/migration/status", params={"run_id": run_id})
print(f" {s['stage']:<14} {s['status']}")
if s["status"] == "done":
break
if s["status"] == "failed":
raise RuntimeError(s["error"] or "migration run failed")
time.sleep(1.5)
# Safe to read only now — both 404 before their stage completes.
onto = evigauge.get(f"{root}/ontology", params={"run_id": run_id})
findings = evigauge.get(f"{root}/migration/inference", params={"run_id": run_id})
print(f"{len(onto['entities'])} entities, {len(onto['relations'])} relations")
print(f"${findings['savings_total_usd']:,}/mo across {len(findings['savings'])} levers")
const root = "/v1/observ/orgs/{org}/workspaces/{ws}";
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
const { run_id } = await evigauge.post(`${root}/migration/run`);
let status;
do {
await sleep(1500);
status = await evigauge.get(`${root}/migration/status`, { run_id });
console.log(` ${status.stage} — ${status.status}`);
if (status.status === "failed") throw new Error(status.error || "migration run failed");
} while (status.status !== "done");
const [onto, findings] = await Promise.all([
evigauge.get(`${root}/ontology`, { run_id }),
evigauge.get(`${root}/migration/inference`, { run_id }),
]);
console.log(`$${findings.savings_total_usd}/mo across ${findings.savings.length} levers`);
Do not skip the poll. Reading
…/ontologystraight after the POST will 404 — the run has not built anything yet. The poll is not politeness, it is the only thing that tells you the results exist.