Shared job API
The job envelope optimization.job/0.1, the result contract
optimization.result/0.2, the worker SDK and the optimization-run runner
live in optimization-jobs,
shared with the other worker repositories
(fcmaes-rust,
LP-IP-craft,
SQP-craft). This repository depends
on its crates optimization-job-api and optimization-runner at the revision
pinned in the root Cargo.toml, and contributes sqp-job-worker.
The shared guide
| Topic | Section of the guide |
|---|---|
| Envelope fields, inputs and validation | Envelope |
cpu_slots, outer_workers and inner_threads | Eight CPU slots |
| Commands, lifecycle states and cancellation | Run, inspect and stop |
| Error codes | Errors |
| Claims, evidence and refutations | Termination, claim and evidence |
| Journals, accounting and recovery | Accounting and recovery |
| Agents and MCP | Agents and MCP |
| JSON Schemas of jobs and results | docs/job-api/schemas |
| Implementation history and gates | Plan |
sqp-job-worker
Profiles sqp.solve/1 (registered smooth Rust models, initial points, active-set and Clarabel backends, optional elastic mode, independent KKT checks) and sqp.evaluate/1 (given points); see the tutorial and
the validation report; the review records the corrections made before the 0.1 merge.
cargo build --release --locked -p optimization-runner -p sqp-job-worker builds the
runner, the MCP server and the worker; Cargo fetches the shared crates.
The worker is a library plus a thin binary: an application registers its
own models in a Registry and runs them in a worker of its own
(application models,
crates/sqp-job-worker/examples/custom_worker.rs). Its describe lists the
JSON Schema of each payload (payload_schemas) and runnable examples
(examples).
For registered models above 256 variables, sqp.solve/1 accepts opt-in
partitioned curvature with Clarabel. See
model registration and structured payloads.
Agents: the MCP server
The same build makes optimization-mcp, an MCP server over one node
(Agents and MCP). On a node with this
worker registered (as sqp), connect an MCP client, for example Claude Code:
claude mcp add sqp-jobs -- "$PWD/target/release/optimization-mcp" --root /abs/node
Its tools describe the node and the worker, validate and submit jobs, wait for them, read their claims and evidence, and cancel or repair them; with the MCP Tasks extension, a submitted job is a task that completes with its result. The tutorial connects it to the tutorial’s node.
Running the shared tests here
The shared harness runs from Cargo’s checkout of optimization-jobs at the pinned revision, against this repository’s binaries:
cargo build --release --locked -p optimization-runner -p sqp-job-worker
SHARED=$(python3 scripts/job-api/shared_root.py)
export JOB_API_TARGET="$PWD/target/release" JOB_API_TUTORIALS="$PWD/tutorials/job-api"
python3 "$SHARED/scripts/job-api/test_integration.py"
python3 "$SHARED/scripts/job-api/test_review.py"
python3 "$SHARED/scripts/job-api/test_mcp.py"
A change to the shared crates lands in optimization-jobs first. Then change
rev in the root Cargo.toml and run
cargo update -p optimization-job-api -p optimization-runner. To develop both
at once, add a [patch."https://github.com/dietmarwo/optimization-jobs"]
section with path dependencies to a local checkout, as the
optimization-jobs README
shows.