@oxy-hq/sdk
World Model interface exposes that graph to a
customer app so you can build experiences that
let people navigate their business, not just read a dashboard.
Alpha. The node interface below —
useWorldModel() and the
expand / drivers / explain / size / drill verbs — ships today and is
backed by the metric-tree analyses. It is a design preview and may still change.
drill is intentionally limited (see below); action
simulation is not yet built (see Simulate an action).The node paradigm
Everything in the World Model is a node, and every node speaks the same verbs. Learn them once and they compose across the whole surface: render a node, let the user pick a verb, get more nodes back, recurse.Get the interface
A single hook —useWorldModel — returns the whole interface, scoped to the
customer app’s project. It must run inside an OxyAppProvider. Everything else
hangs off it: grab a node with metric(id) and the node speaks the verbs.
world.metric(id) returns a handle. Each verb is an async method on the
handle, so you can nest them into a click-to-open UI.
Expand into components and drivers
expand fetches one hop of the tree on demand — the metric’s components and
drivers — returning each child as a { node, edge, handle } you can render and
recurse into.
Explain a move
explain decomposes a period-over-period change, recursively splitting the
metric by its components and dimensions until the move concentrates — so you can
show where a number came from, not just that it changed.
Size the opportunity
size finds underperforming segments and quantifies the upside of closing the
gap to their peers — “match the best” across a dimension.
Drill into a segment
drill narrows a handle to a dimension = value segment and returns a new,
scoped handle. Structural verbs (node, expand, drivers) are
scope-invariant and keep working on it.
Simulate an action
An action is a lever a human can pull — hire, raise prices, open a store. Actions would live in a catalog and declare only the leaf measure they directly move; everything downstream is already described by the metric tree’s drivers, so the SDK can propagate the effect for you — carrying the nonlinearity in the drivers.Hire 2 servers at San Mateo → +0.14 CSAT (4.62 → 4.76) → +$28k/mo. Diminishing returns past a 3rd hire.The knots of a piecewise driver are inspectable metadata, so the interface can say why the returns diminish rather than emit an opaque number.
The entity-graph hook
useWorldModel() now names the node interface above. The hook that returns
the raw semantic-model entity graph — entities, their measures/dimensions, and
how measures promote up the hierarchy — is now useWorldModelGraph().
What it’s built on
The node interface is a thin composition layer over the metric-tree analyses that already ship — it adds no new backend. If you want the underlying calls directly:- React hooks —
useMetricTree,useSensitivity,usePredict,useExplain,useOpportunity,useTimeDimensions, plususeBaselineanduseProjectionfor scenario forecasting (same/semantic/metric-tree*endpoints, request/response shapes matching the server verbatim). - Node client —
MetricTreeClient(getTree,getSensitivity,predict,explain,findOpportunities,getBaseline,getProjection) for API-key / server-side use — see Hooks & components.
Try it
A runnable example lives in the SDK repo atsdk/typescript/examples/world-model-demo.tsx — an interactive explorer that
starts at one top-line metric and walks the whole business from it (expand into
drivers, explain a drop, size a gap), every object a live handle rather than a
static number. Copy it into a bundle scaffolded with pnpm dlx create-oxy-app.
Next steps
The Metric Tree
Component vs. driver edges, forms, and promotion
Opportunity sizing
How the graph sizes a gap and decomposes it into drivers
Hooks & components
The stable SDK surface
MetricTreeClient sits inWorld Model
The semantic model, metric tree, and entity graph behind it