Quickstart
This page takes you from a fresh checkout to a governed agent run: first offline with scripted model replies, then with a real model, then from your own TypeScript code. Read it after Start Here and before…
This page takes you from a fresh checkout to a governed agent run: first offline with scripted model replies, then with a real model, then from your own TypeScript code. Read it after Start Here and before Build an Environment.
#Before You Start
- Node.js 22.14.0 or newer. The
localprofile stores state with the built-innode:sqlite. - Docker is optional, and nothing on this page needs it. The
localprofile runs sandboxed commands in Docker with no network, so you need it once you plug in a kit that runs commands (sandbox,cli-executor), and for the coding benchmark's--dockerflag.
#1. Install and Build
Clone the repository, then install and build from its root:
git clone https://github.com/Neusym/neusym.git
cd neusym
npm install
npm run buildnpm run build compiles every package with tsc -b. Before a pull request, contributors also run npm run verify (the static checks and the full test suite).
The CLI is apps/cli/dist/src/index.js. This page calls it neusym; to do the same, run this from the checkout root:
alias neusym="node $PWD/apps/cli/dist/src/index.js"#2. Run the Demo Offline
examples/demo-product is a small environment: 13 kits at the review level (the agent may read and answer, never change anything), and a domain pack whose connector gives the agent one read-only tool, demo_inspect.
Check it first:
neusym plan examples/demo-product{
"profile": "test",
"level": "review",
"kits": ["intake", "tasks", "harness", "tool-gateway", "secrets", "budget", "tenancy",
"injection-guard", "observability", "diagnostics", "evals", "worker-pool", "scheduler"],
"drivers": {
"store": "store-memory", "bus": "bus-inproc", "model": "model-scripted", "blobs": "blobs-memory",
"vault": "vault-env", "telemetry": "telemetry-memory", "queue": "queue-memory"
},
"authorities": { "delegation.spawn": "budget" }
}plan starts nothing. It reads the kit and driver manifests and checks that the kits fit together, that the level has every kit it requires, and that grants and driver settings are valid. The test profile picks in-memory backends and a scripted model, so nothing leaves your machine.
Now run a task. --model-turns gives the scripted model its replies in order: first a tool call, then the answer.
cat > /tmp/turns.json <<'EOF'
[
{ "toolCalls": [{ "id": "call-1", "toolName": "demo_inspect", "args": { "itemId": "item-1" } }] },
{ "text": "item-1 is healthy." }
]
EOF
neusym run examples/demo-product "Inspect item-1" --model-turns /tmp/turns.jsontask task_… · run run_… · completed
session ses_…
answer:
item-1 is healthy.
trace tr_…
intake.admit accepted 23ms
└─ guard trigger.admit allow 4ms
task.run task_… completed 39ms
├─ context context.build 1→1 items 2ms
├─ step 0 tool_calls 19ms
│ ├─ guard harness.step allow 1ms
│ ├─ model.call scripted-v1 140 tok $0.0005 tool_calls 3ms
│ ├─ tool.call demo_inspect ok 9ms
│ │ ├─ guard action.authorize allow 2ms
│ │ └─ intercept action.execute 5ms
│ │ └─ context context.build 1→1 items 2ms
│ └─ context context.build 1→1 items 1ms
└─ step 1 completed 8ms
├─ guard harness.step allow 0ms
├─ model.call scripted-v1 140 tok $0.0005 stop 2ms
├─ guard output.release allow 1ms
└─ guard task.complete allow 1ms
summary: ok · 2 step(s) · 2 model call(s) · 280 tokens · $0.0010 · 1 tool call(s) · manifest rm_…The top lines are the result. The tree is the trace of the run: intake admitted the prompt, then the agent loop (harness) took two steps. In step 0 the model asked for demo_inspect; in step 1 it answered. The last line is the run summary from the diagnostics kit. The scripted model reports the same token count and price on every call.
Each guard line is a checkpoint where kits vote before something happens. In this environment:
| Guard | Runs before | Kits that vote |
|---|---|---|
trigger.admit | a prompt becomes a task | tenancy |
harness.step | each model step | budget |
action.authorize | each tool call | budget, tenancy, injection-guard |
output.release | the answer leaves | secrets, tenancy |
task.complete | the task is marked done | none here; the next example adds one |
#A Kit That Checks the Answer
examples/demo-product/status-report runs the same pack with one small custom kit added. The kit puts a guard on task.complete: the answer must report the status that the last demo_inspect call returned.
demo=examples/demo-product/status-report
neusym run "$demo" "Inspect item-1" --model-turns "$demo/turns/matching.json"
neusym run "$demo" "Inspect item-1" --model-turns "$demo/turns/contradicting.json"The first run completes. In the second, the tool says healthy but the scripted model answers item-1 is offline.. The guard refuses, and the command exits with code 1:
task task_… · run run_… · failed (STATUS_CONTRADICTED)
session ses_…
reason: The item or status differs from the latest inspection.
…
└─ ✗ step 1 failed STATUS_CONTRADICTED 51ms
…
└─ guard task.complete deny STATUS_CONTRADICTED by status-report:verify-status 12msThe model proposes an answer, and deterministic code decides whether it stands. The demo README lists the kit's other refusals, such as STATUS_UNVERIFIED for missing or stale evidence.
To make an environment of your own, start from seven kits and plug in what your job needs: Build an Environment.
#3. Run with a Real Model
The local profile keeps state on disk and calls a real model through an OpenAI-compatible driver (model-openai-compat). By default it calls http://127.0.0.1:11434/v1, the address Ollama uses, and needs no API key.
Copy the demo to a folder outside the checkout:
mkdir ~/demo-local
cp examples/demo-product/workspace.json examples/demo-product/pack.json ~/demo-local/In ~/demo-local/workspace.json, change "profile": "test" to "profile": "local" and add a bindingOverrides entry for the model. For a hosted endpoint:
"bindingOverrides": {
"model": {
"config": { "baseUrl": "https://api.openai.com/v1", "defaultModel": "gpt-4o-mini" },
"secrets": { "apiKey": "vault:MODEL_API_KEY" }
}
}For a local Ollama server, set only the model name: "config": { "defaultModel": "llama3.2" }. Costs come from a built-in price list; for a model not on it, add inputUsdPerMillion and outputUsdPerMillion to config, or its cost counts as $0.
vault:MODEL_API_KEY reads the key from the vault, which in the local profile is your environment (the vault-env driver). plan checks the new setup without calling the model, and needs no key; its drivers list now shows store-sqlite, model-openai-compat and telemetry-jsonl. A run needs the key:
neusym plan ~/demo-local
export MODEL_API_KEY=...
neusym run ~/demo-local "Inspect item-1"Without the key, the command stops at startup, before any model call: Secret "MODEL_API_KEY" not found in vault-env. If the endpoint cannot be reached, the task ends interrupted with MODEL_NETWORK_ERROR and keeps its checkpoint; neusym run ~/demo-local --resume <taskId> continues it. On Node 22, the local profile also prints an ExperimentalWarning for SQLite; you can ignore it.
State now lives in ~/demo-local/.neusym/ (a SQLite database, blob files and a JSONL trace file), so later commands see earlier runs:
neusym runs ~/demo-local # recorded runs
neusym events ~/demo-local --run <runId> # what happened in one run, in order
neusym report ~/demo-local --by refusal # refusals, by checkpoint and the kit that refused
neusym feedback ~/demo-local <runId> down --correction "Say when the item was last checked"
neusym eval capture ~/demo-local --suite core --run <runId> --expect-includes "healthy"
neusym eval run ~/demo-local core --repeats 3 # run the suite's cases again; calls the modelThe demo sets kitConfigs.evals.autoCaptureSuite: "rated-down", so feedback … down also adds the run to the suite rated-down. Knowledge and Learning explains what you can do with these suites.
No key yet? Keep "profile": "local", set the model entry to { "driver": "@neusym/driver-model-scripted" }, and pass --model-turns to the commands that call the model (run, eval run), with one set of replies per run. Everything above then works offline.
#4. Embed in TypeScript
@neusym/cli exports openWorkspace, which boots an environment inside your process. Kits are reached through ports: tasks@1 is the interface the tasks kit provides.
import { openWorkspace } from '@neusym/cli';
import { TASKS_PORT, type TasksPort } from '@neusym/contract-tasks';
// Replies for the scripted model, as in /tmp/turns.json. Leave them out for the real-model copy from step 3.
const turns = [
{ toolCalls: [{ id: 'call-1', toolName: 'demo_inspect', args: { itemId: 'item-1' } }] },
{ text: 'item-1 is healthy.' },
];
const session = await openWorkspace('examples/demo-product', {
tenantId: 'acme',
runtimeOverrides: { model: { turns } },
});
try {
const ctx = session.newContext();
const tasks = session.kernel.requirePort<TasksPort>(TASKS_PORT);
const task = await tasks.createTask(ctx, { prompt: 'Inspect item-1' });
const done = await tasks.runTask(ctx, task.id);
await session.flushEvents();
console.log(done.status, done.output); // completed item-1 is healthy.
} finally {
await session.close();
}The packages are linked in the checkout after npm install, so you can save this as embed.ts in the checkout root and run node --experimental-strip-types embed.ts. The kits check this run as they do in the CLI, with one difference: createTask skips the intake kit, so the trigger.admit guard does not run. To run any CLI command against an open session, use executeCommand(session, 'run', ['Inspect item-1', '--json']); it returns the exit code and the output.
#Next Steps
- Build an Environment: plug kits in and out, step up a level, lock the result.
- Domain Packs and Connectors: give the agent your own tools, terms and trial suites.
- Authority and Safety: what each level allows and enforces.
- Deployment and Operations: the HTTP/SSE server, production profiles and day-2 CLI commands.
examples/coding-benchmarkcompares a minimal coding environment with a full one on the same tasks in a real Git repository, offline or with a real model. See its README.