Wolfram Router is a Node.js service that runs multi-agent workflows and optional Wolfram queries behind one HTTP API and browser dashboard. It stores runs in SQLite and can combine built-in agents, remote HTTP agents, and a dedicated Wolfram query path.
- Single HTTP service plus browser dashboard
- Built-in agents and remote HTTP agents
- Run history stored in SQLite
- Direct Wolfram query endpoint
mock,direct, and localclawbackends- Cache, in-flight request coalescing, and upstream budget controls
- Local tests and E2E checks
- Node
>=24
Optional:
WOLFRAM_APPIDfor direct Wolfram API accessprivate/Clawif you want the local adapter backend
git clone https://github.com/RAPIDENN/wolfram-router.git
cd wolfram-router
cp .env.example .envFor a simple local setup, put this in .env:
API_KEYS=test-key
WOLFRAM_PROVIDER=mock
ALLOW_LOOPBACK_AGENT_ENDPOINTS=1Start the server:
node src/server.mjsOpen:
http://127.0.0.1:8787/
If you want live Wolfram queries, set WOLFRAM_APPID in .env and keep WOLFRAM_PROVIDER=auto or live.
POST /v1/runsexecutes selected agents for a topic and ranks the resulting experiments.POST /v1/labs/wolframruns one Wolfram query directly.GET /v1/runs/:idreturns stored agent reports and the ranked summary./serves the dashboard from the same backend.
mock: local mock responses, no credentials requireddirect: calls the public Wolfram API whenWOLFRAM_APPIDis setclaw: uses the localprivate/Clawadapter if it exists
With WOLFRAM_PROVIDER=auto, the server chooses:
clawif the local adapter is availabledirectifWOLFRAM_APPIDis setmockotherwise
Useful result notes:
verification.liveWolframValidated=truemeans the request reached Wolfram successfully.selectedPod: n/ameans Wolfram returned no useful pod for that query. It does not necessarily mean the request failed.source.mode=mock-localmeans mock data was used.source.mode=live-v1-resultmeans the public Wolfram API answered directly.source.mode=live-v2means the localprivate/Clawadapter answered the query.
GET /healthz: service health and active Wolfram backendGET /v1/agents: built-in agents and default planGET /v1/templates: dashboard templatesGET /v1/metrics: aggregate run metricsGET /v1/runs: recent runsGET /v1/runs/:id: full run with agent reports and summaryPOST /v1/runs: create a runPOST /v1/labs/wolfram: run a direct Wolfram query
curl \
-H 'content-type: application/json' \
-H 'x-api-key: test-key' \
-d '{
"topic":"increase useful throughput with deterministic routing",
"sync":true,
"context":{
"goal":"produce deployable experiments",
"constraint":"keep infra lightweight",
"wolframQuery":"resistivity of copper at 180 Celsius",
"wolframDomain":"engineering"
},
"agents":[
{"name":"systems","kind":"builtin","strategy":"systems"},
{"name":"wolfram","kind":"builtin","strategy":"wolfram"}
]
}' \
http://127.0.0.1:8787/v1/runsIf context.wolframQuery is present, the server canonicalizes it before execution. Equivalent phrasings can share the same cache key, and the canonical form is stored as request.context.wolframQueryCanonical.
curl \
-H 'content-type: application/json' \
-H 'x-api-key: test-key' \
-d '{"input":"resistivity of copper at 180 Celsius","domain":"engineering","provider":"mock"}' \
http://127.0.0.1:8787/v1/labs/wolframKey response fields:
payloadstextSummaryselectedPodharvestPathverification.liveWolframValidatedsource.modesurface.cache.status
Defaults live in .env.example and src/config.mjs.
Core variables:
HOSTPORTDATABASE_PATHREQUEST_TIMEOUT_MSMAX_BODY_BYTESAPI_KEYSCORS_ORIGINALLOWED_AGENT_ORIGINSALLOW_LOOPBACK_AGENT_ENDPOINTSWOLFRAM_PROVIDERWOLFRAM_APPIDWOLFRAM_HARVEST_PATHWOLFRAM_CACHE_TTL_MSWOLFRAM_UPSTREAM_BUDGET_PER_MINUTEWOLFRAM_MAX_CONCURRENCY
Advanced or legacy variables:
CLAW_REPO_PATHCLAW_HARVEST_PATHCLAW_WOLFRAM_PROVIDER
/v1/*requiresx-api-keywhenAPI_KEYSis set.- Remote HTTP agents are blocked unless their origin is listed in
ALLOWED_AGENT_ORIGINS. - Loopback agent endpoints are blocked unless
ALLOW_LOOPBACK_AGENT_ENDPOINTS=1. - Wildcard CORS is disabled when API keys are active.
- Static files are served from
public/only.
An external agent must expose a JSON POST endpoint such as /infer.
Request shape:
{
"runId": "uuid",
"topic": "string",
"context": {},
"agent": {
"name": "string",
"kind": "http",
"promptPrefix": "string"
}
}Response shape:
{
"notes": "string",
"experiments": [
{
"title": "string",
"hypothesis": "string",
"method": "string",
"successMetric": "string",
"risk": "string",
"estimatedDays": 3,
"scores": {
"novelty": 0.8,
"feasibility": 0.7,
"impact": 0.9
}
}
],
"metadata": {
"source": "external-http"
}
}Run the local checks with:
node --test
node scripts/e2e.mjsCI uses WOLFRAM_PROVIDER=mock, so forks and PRs do not need private Wolfram credentials.
Build:
docker build -t wolfram-router .Run in mock mode:
docker run --rm -p 8787:8787 \
-e API_KEYS=test-key \
-e WOLFRAM_PROVIDER=mock \
-v wolfram-router-data:/data \
wolfram-router