DEVELOPER DOCS

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/run returns 409 migration_disabled and 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.

code
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:

stageWhat is happening
samplingSelecting a representative slice of recent traces
evidenceExtracting structured evidence from that slice
ontologyInferring entities and relations
ontology_savePersisting the ontology
inferenceThe single cumulative call — cost and optimization findings
doneFinished; 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.

HTTP
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:

JSON
{
  "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"])

Errors

StatusCodeMeaning
422—A list field received a non-list value
403—PUT by a caller below workspace_admin

Start a run

HTTP
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

JSON
{ "run_id": "mig_7f3a91c4" }

Errors

StatusCodeMeaning
409migration_disabledEVIGAUGE_MIGRATION_ENABLED is off for this deployment
403—Caller is below workspace_admin

Poll run status

HTTP
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

NameTypeRequiredDefaultDescription
run_idstring➖latestWhich run to report on

Response 200 — not schema-modelled

JSON
{
  "run_id": "mig_7f3a91c4",
  "status": "running",
  "stage": "ontology",
  "trace_count": 1000,
  "error": "",
  "savings_total_usd": 0,
  "anomaly_count": 0
}
FieldNotes
statuspending · running · done · failed
stageSee the stage table above — use it to light a progress display
trace_countTraces sampled by this run
errorNon-empty only when status is failed
savings_total_usd0 until status is done
anomaly_count0 until status is done

Errors

StatusCodeMeaning
404migration_not_foundThis project has never had a run

Read the ontology

HTTP
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

JSON
{
  "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

FieldTypeNotes
idstring"{kind}:{key}", globally unique — usable directly as a graph node id
kindstringOpen string, not an enum — desk, workflow, agent, model, tool, data, vendor, source, …
keystringThe identifier within its kind
labelstringDisplay name
layerinteger0 desk · 1 workflow · 2 agent · 3 model/tool · 4 data
trace_countintegerHow many sampled traces it appeared in
propsobjectKind-specific extras; may be empty

Style by layer, label by kind. layer is a fixed 0–4 scale and is safe to switch on. kind is 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" and trace_count == 0 was declared via the pipeline manifest and not yet seen in traffic — badge it "declared" if you like. Once traces confirm it, the same node's trace_count rises above zero.

OntologyRelation

FieldTypeNotes
src / dststringEntity ids
kindstringuses, calls, reads, invokes, runs, … — also open
weightfloatRelative strength of the relation
trace_countintegerTraces 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")

Read the cumulative inference

HTTP
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

JSON
{
  "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
}
FieldTypeNotes
prompt routing fleet operationsobjectObjects, 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_usdnumberThe run's own total for the sampled window
anomaly_countintegerAnomalies found in that window
skippedbooleantrue means the LLM call failed open and these came from deterministic fallbacks — still renderable; worth a quiet "partial" marker

On totalling savings. savings_total_usd is 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']}")

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")

Do not skip the poll. Reading …/ontology straight 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.