Interactive demo

Break it. On purpose.

Type any task. Watch tokens stream in, the run pause for approval (approve, edit, deny, or respond), halt at the budget, survive a kill -9, and replay for free, while OTel spans export and cost is tagged to a customer. The model here is simulated, no API calls leave your browser, but the state machine, journal, budgets, streaming, approval verbs, tags, and telemetry are exactly the real runtime's.

refund delete data send email deploy
$0.0000 / $0.01

Drag left to watch the run halt mid-flight, before spending, not after.

Rides the record, journal, webhooks, and OTel spans. Every dollar attributed to this customer.

run journal · live
Press “Run the agent”, then try to break it.
Human approval required · four moves, all journaled
edit corrects the arguments before the tool runs; respond answers directly so the tool never runs. Every decision is journaled with who made it.

What's simulated, what's real: the model responses here are scripted so the demo runs offline in your browser (real providers stream over SSE the same way). Everything else, the seven-state machine, pre-flight budget enforcement, durable approval pauses with approve/edit/deny/respond, buffered tool results, crash resume, journal step types, run tags, OTel span export, and $0 replay, matches the open-source runtime exactly. Run the real thing with npm run demo, or the new capabilities with npx tsx examples/03-observability-and-hitl.ts.


The same thing, in code

Everything you just did is ~20 lines.

agent.ts, define once
import { NexusRuntime, FileStorage, AnthropicProvider,
         defineAgent, defineTool } from '@nexusaiframework/runtime';

const runtime = new NexusRuntime({ storage: new FileStorage('.nexus') });

runtime.register(defineAgent({
  name: 'support',
  provider: new AnthropicProvider(),
  model: 'claude-sonnet-4-5',
  tools: [lookupCustomer, issueRefund],  // issueRefund: requiresApproval
  budget: { maxUsd: 0.50 },
  approvalPolicy: ({ arguments: a }) =>
    a.amountUsd < 50 ? 'approve' : 'ask',
}));
lifecycle, run, decide, observe, survive
attachOtel(runtime, { endpoint: OTLP_URL }); // spans to Datadog/Grafana

const run = await runtime.run('support', 'Refund jane $250',
  { tags: { customerId: 'acme' } });   // cost, attributed
// waiting_approval, durably paused. Four moves:
await runtime.approve(run.id, callId, { amountUsd: 200 }); // edit
await runtime.respond(run.id, callId, 'use account B');  // answer

await runtime.resume(run.id);   // crashed? pick up where it died
const report = await replayRun(run);  // re-run offline, $0.00
Full developer documentation →