API & MCP
Everything a person can do on Twinworks Buffer & Parameter Sweep, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://twinworksbuffersweep.usefulweb.site/api/v1/calculate– run Twinworks Buffer & Parameter SweepGET https://twinworksbuffersweep.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Twinworks Buffer & Parameter Sweep
Runs a Twinworks factory model repeatedly while one parameter changes — typically the capacity of a buffer from 1 to 10 places, but also servers, cycle times, MTTR, batch sizes, conveyor speed or the number of operators. Returns throughput, lead time and WIP per value with confidence intervals, plus the knee point where extra capacity stops paying off.
| Field | Type | Default | Description |
|---|---|---|---|
model | textarea | — | Model or project JSON. A Twinworks project (.twinworks.json, format "twinworks-project") or a bare model with "nodes" and "links". Times in seconds, lengths in metres. Leave empty and pick a template instead. |
template | select (, three-station-line, line-with-failures, assembly-two-feeders, job-shop-routings, bottleneck-buffer-sizing, conveyor-packaging, mm1-validation, shared-forklifts, plc-control) | — | Or start from a template |
target | text | — | Object id. Id of the buffer/machine/conveyor/source to change, or pool:<id> for an operator pool. Default for the bottleneck template: B2. |
parameter | select (capacity, servers, cycle.value, cycle.mean, batchSize, interval.mean, interval.value, speed, length, failure.mttr.mean, failure.mtbf.mean, setup.value, scrapPct, count) | "capacity" | Parameter |
from | number | 1 | From |
to | number | 10 | To |
step | number | 1 | Step |
replications | integer | 4 | Replications per value |
horizonHours | number | — | Run length per replication. Overrides the model setting. |
Example request
Bottleneck demo: buffer B2 from 1 to 10
curl -X POST https://twinworksbuffersweep.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"template":"bottleneck-buffer-sizing","target":"B2","parameter":"capacity","from":1,"to":10,"step":1,"replications":4,"horizonHours":6}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://twinworksbuffersweep.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
twinworks_buffer_sweep - Local stdio connector:
node src/mcp-stdio.ts --tool=twinworks-buffer-sweep
{
"mcpServers": {
"twinworks-buffer-sweep": { "type": "http", "url": "https://twinworksbuffersweep.usefulweb.site/mcp" }
}
}