Typed bindings
The worker protocol is published as machine-readable schemas. Point a code generator at them for typed request and response bindings in your language, instead of hand-writing the wire types.
Artifacts
Both live in schemas/ and are generated from the engine's Rust
types.
| File | Covers |
|---|---|
protocol.schema.json | Every wire type, one JSON Schema. Top-level type Protocol. |
worker.openapi.json | The worker endpoint: POST /, DecisionRequest to DecisionResponse. |
Generating
Point a generator at protocol.schema.json. The examples commit the output as
protocol.ts, protocol.go, or protocol.py.
TypeScript and Go, with quicktype:
npx quicktype --src-lang schema --lang typescript \
--src schemas/protocol.schema.json --top-level Protocol \
--just-types --prefer-unions -o protocol.tsSwap --lang go --package main -o protocol.go for Go.
Python, with datamodel-code-generator:
datamodel-codegen \
--input schemas/protocol.schema.json --input-file-type jsonschema \
--output-model-type pydantic_v2.BaseModel --output protocol.pyFor OpenAPI tooling, generate from worker.openapi.json instead.
Next
- Protocol: the types the schemas describe.
- Core concepts: what the worker exchanges.