API & MCP

Everything a person can do on Twinworks Factory Simulation, a program or AI agent can do with the same inputs and get the identical result.

HTTP API

  • POST https://twinworkssimulate.usefulweb.site/api/v1/calculate – run Twinworks Factory Simulation
  • GET https://twinworkssimulate.usefulweb.site/api/v1/tool – inputs, output schema, examples
  • OpenAPI 3.1: /openapi.json · /openapi.yaml
  • Errors: application/problem+json; 422 includes per-field errors.

Twinworks Factory Simulation

Runs the Twinworks discrete-event simulation on a factory model (sources, buffers, machines with failures and setups, assembly, conveyors, quality checks, operators and shift calendars). Returns throughput per hour, lead time, WIP with a Little’s-law check, per-station states and OEE, the bottleneck and a cost per good part, with Student-t confidence intervals across seeded replications.

Inputs of Twinworks Factory Simulation
FieldTypeDefaultDescription
modeltextarea—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.
templateselect (, 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
horizonHoursnumber—Run length per replication. Overrides the model setting (includes the warm-up).
warmupMinutesnumber—Warm-up. Statistics are reset after the warm-up. Overrides the model setting.
seedinteger—Random seed. Same seed → same result. Replication r uses a seed derived from it.
replicationsinteger—Replications. Independent runs with different seeds; used for the confidence intervals.
confidenceselect (, 0.9, 0.95, 0.99)—Confidence level

Example request

3-station line template, 5 replications

curl -X POST https://twinworkssimulate.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"template":"three-station-line","replications":5}'

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://twinworkssimulate.usefulweb.site/mcp – protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake).
  • Tools: twinworks_simulate
  • Local stdio connector: node src/mcp-stdio.ts --tool=twinworks-simulate
{
  "mcpServers": {
    "twinworks-simulate": { "type": "http", "url": "https://twinworkssimulate.usefulweb.site/mcp" }
  }
}