When an LLM generates JSON, it might produce valid syntax with invalid semantics — a field that should be an integer appears as a string, or a required key is missing. The program crashes downstream, far from the generation site. Debugging is archaeological.
Turn (arXiv:2603.08755) is a compiled language designed specifically for agentic software. Its core move: the compiler generates JSON Schema from struct definitions, and the VM validates model output against that schema before binding it to program variables. If the LLM produces an integer where a boolean was expected, the error fires at the boundary between model and program, not three function calls later.
This is cognitive type safety — type checking applied not to programmer-written code but to model-generated data. The compiler can't reason about what the LLM will produce, but it can enforce what the program will accept.
Four other features follow from the same design principle. A confidence operator lets deterministic program flow branch on model certainty. An actor model (borrowed from Erlang) gives each agent isolated context and persistent memory. Capability-based identity provides unforgeable credential handles from the VM, preventing raw secrets from entering agent memory where the LLM could leak them. And compile-time schema absorption synthesizes typed API bindings from external specifications — the agent's interface to the world is type-checked before deployment.
The language treats the LLM as an untrusted data source operating inside a trusted execution environment. This inverts the usual framing, where the model is the intelligent core and the program is scaffolding. In Turn, the program is the authority and the model is a powerful but unreliable input device — like a sensor that sometimes hallucinates.
The sensor metaphor is exact. You don't trust a thermometer to produce valid data; you validate its output against physical constraints. Turn applies the same discipline to language models.