API & MCP
Everything a person can do on Twinworks Buffer Allocation Optimiser, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://twinworksbufferallocation.usefulweb.site/api/v1/calculate– run Twinworks Buffer Allocation OptimiserGET https://twinworksbufferallocation.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 Allocation Optimiser
Solves the buffer allocation problem of a production line by simulation: a fixed total of buffer places (for example the floor space you have) is distributed over the buffers so that throughput is as high as possible. Greedy marginal allocation with common random numbers, compared against the current allocation with a paired confidence interval.
| 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 |
total | integer | — | Total buffer places. Places to distribute over the buffers. Default: the sum of the current capacities (same space, better placement). |
minCapacity | integer | 1 | Minimum per buffer |
buffers | text | — | Buffer ids. Comma-separated ids (e.g. B1,B2,B3). Default: every buffer with a finite capacity. |
replications | integer | 3 | Replications per candidate |
horizonHours | number | — | Run length per replication. Overrides the model setting. |
Example request
Bottleneck demo: 8 places over four buffers
curl -X POST https://twinworksbufferallocation.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"template":"bottleneck-buffer-sizing","total":8,"replications":3,"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://twinworksbufferallocation.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
twinworks_buffer_allocation - Local stdio connector:
node src/mcp-stdio.ts --tool=twinworks-buffer-allocation
{
"mcpServers": {
"twinworks-buffer-allocation": { "type": "http", "url": "https://twinworksbufferallocation.usefulweb.site/mcp" }
}
}