Skip to main content
QUICK REVIEW

[Paper Review] Turn: A Language for Agentic Computation

Muyukani Kizito|arXiv (Cornell University)|Mar 7, 2026
Multi-Agent Systems and NegotiationComputer Science0 citations
TL;DR

Turn is a compiled, actor-based language that makes LLM-driven inference a typed primitive, provides probabilistic control, and enforces strong safety and persistence guarantees for agentic software.

ABSTRACT

We present extbf{Turn}, a compiled, actor-based programming language -- statically typed for schema inference, dynamically typed at the value level -- for agentic software: programs that reason and act autonomously by delegating inference to large language models (LLMs). Existing approaches augment general-purpose languages with frameworks, encoding critical invariants (bounded context, typed inference output, credential isolation, durable state) as application-level conventions rather than language guarantees. Turn introduces five language-level constructs that address this gap. \emph{Cognitive Type Safety} makes LLM inference a typed primitive: the compiler generates a JSON Schema from a struct definition and the VM validates model output before binding. The \emph{confidence operator} enables deterministic control flow gated on model certainty. Turn's \emph{actor-based process model}, derived from Erlang, gives each agent an isolated context window, persistent memory, and mailbox. A \emph{capability-based identity system} returns opaque, unforgeable handles from the VM host, ensuring raw credentials never enter agent memory. Finally, \emph{compile-time schema absorption} ( exttt{use schema::}) synthesizes typed API bindings from external specifications at compile time; the exttt{openapi} adapter is shipped with exttt{graphql}, exttt{fhir}, and exttt{mcp} in active development. We describe the language design, type rules, schema semantics, and a Rust-based bytecode VM, and evaluate Turn against representative agentic workloads. Turn is open source at https://github.com/ekizito96/Turn.

Motivation & Objective

  • Motivate the need for language-level invariants in agentic software to prevent common failure modes (unbounded context, untyped inference, fragmented state, no durable execution, credential leakage).
  • Introduce Turn’s five core language primitives that enforce these invariants at the language level.
  • Present the cognitive type safety, probabilistic control flow, actor-based processes, capability-based identity, and compile-time schema absorption.
  • Describe the design, semantics, and implementation of Turn, including its Rust VM and the end-to-end workflow with LLM inference.

Proposed method

  • Define a typed inference primitive infer T { ... } where a JSON Schema is generated at compile time from a Turn struct and the VM validates LLM output before binding.
  • Introduce the confidence operator to extract model certainty and enable deterministic control flow over stochastic outputs.
  • Adopt Erlang-like actor model with per-process context window, persistent memory, and durable execution via suspend/resume checkpoints.
  • Implement grant identity as an opaque, unforgeable Identity capability to prevent credential leakage into agent memory.
  • Provide use schema::<protocol>("url") macro to fetch API specifications at compile time and synthesize native structs and closures for API bindings.

Experimental results

Research questions

  • RQ1Can LLM inferences be made type-safe at the language level to guarantee structural conformance of responses?
  • RQ2How can probabilistic model certainty be integrated into deterministic control flow within a programming language?
  • RQ3Does an actor-based, per-process context architecture improve recall and isolation in agentic computation?
  • RQ4Can credentials be securely managed to prevent leakage without sacrificing tool access?
  • RQ5Can compile-time schema absorption synthesize safe native bindings from external API specifications?

Key findings

  • Inference expressions infer T { … } produce values that structurally conform to T when successful, with compile-time schema generation and runtime validation.
  • The confidence operator enables deterministic branching based on model certainty, with a defined algebra for certainty propagation.
  • Turn’s agent processes have isolated contexts and persistent memory, with fault-tolerant supervision via linked processes.
  • Identity capabilities prevent raw credentials from entering agent memory, ensuring credential opacity.
  • Compile-time schema absorption synthesizes typed API bindings from external specifications, enabling safe API consumption by LLM-driven agents.
  • Experiments show 105/105 tests pass across five suites, with per-case evaluations of credential opacity, confidence semantics, context primacy/recency, memory isolation, and exact durable execution.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.