Turn: A Language for Agentic Computation

Muyukani Kizito · 2026

Read Turn: A Language for Agentic Computation by Muyukani Kizito (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2603-08755.txt.

Introduction

Muyukani Kizito presents Turn, a compiled actor language for programs that reason and act through language models. Today such safeguards live as app-level habits, not language rules, covering bounded context, typed inference, credential isolation, and durable state. Turn bakes in typed inference, certainty-gated control, sealed agent contexts, unforgeable handles, and compile-time schema bindings.

Catalog record

CREATORMuyukani Kizito
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE50308
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2603.08755

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Turn: A Language for Agentic Computation Muyukani Kizito Abstract Abstract We present 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. 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 confidence operator enables deterministic control flow gated on model certainty. Turn’s actor-based process model , derived from Erlang, gives each agent an isolated context window, persistent memory, and mailbox. A capability-based identity system returns opaque, unforgeable handles from the VM host, ensuring raw credentials never enter agent memory. Finally, compile-time schema absorption ( use schema::<protocol> ) synthesizes typed API bindings from external specifications at compile time; the openapi adapter is shipped with graphql , fhir , and 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 . Keywords: programming languages, agentic software, LLM integration, actor model, type safety, capability-based security. 1 Introduction The emergence of large language models (LLMs) as general-purpose reasoning engines has produced a new class of software: agentic programs that observe their environment, reason over unstructured data, invoke external tools, and act on their conclusions. Unlike traditional software, where all behavior is deterministic, agentic programs delegate critical decision-making to stochastic models whose outputs are structurally unpredictable. Building these systems with existing languages and frameworks reveals a fundamental impedance mismatch. The core abstractions of agentic computation—bounded context windows, typed inference results, durable execution state, process-isolated memory, and credential security—have no direct representation in languages like Python, TypeScript, or Rust. Developers encode them as library conventions, leading to five recurring failure modes: 1. Unbounded context. Context is managed as a plain list of messages. When it exceeds the model’s token limit, it overflows silently or truncates from the front, causing the model to lose critical information. 2. Untyped inference output. The model returns a string. The program parses it as JSON with no guarantee that the schema matches. Schema violations surface as runtime key errors with no connection to the inference that produced them. 3. Fragmented state. Agent state is scattered across variables, databases, API responses, and framework internals. There is no single, serialisable representation of what the agent knows or has done. 4. No durable execution. Long-running agents die with their process. There is no language-level mechanism for checkpointing and resuming execution across restarts. 5. Credential leakage. API keys and OAuth tokens are stored as strings accessible to the LLM’s tool-calling interface, creating an exfiltration vector in any system where the model can invoke I/O. These failure modes are not theoretical. They arose in practice during the development of JarvisCore and other production agentic systems at Prescott Data, where empirical analysis [ 15 , 16 ] confirmed that reliability at scale requires language-level enforcement of the invariants that frameworks leave as convention. Turn is the result: a language in which each of these constraints is a first-class primitive rather than a library pattern. Paper structure. § 2 surveys related work; readers already familiar with the actor model, capability security, and LLM output structuring may proceed directly to § 3 . The contributions in § 4 –§ 8 are self-contained and can be read in any order after § 3 . 1.1 Contributions This paper makes the following contributions: 1. Cognitive Type Safety (§ 4 ): We introduce infer Struct { prompt } , a typed inference primitive where the compiler generates a JSON Schema from the struct definition at compile time and the VM validates the model’s response before binding. We prove that if an infer expression completes without error, the bound value structurally conforms to the declared type. 2. Probabilistic Control Flow (§ 5 ): We introduce the confidence operator, a first-class language construct that extracts the model’s reported certainty from an inference result and enables deterministic branching on stochastic output. 3. The Agentic Process Model (§ 6 ): We adapt Erlang’s actor model to the agentic domain. Rather than a flat list of messages, each agent process has a tripartite structured context architecture to enforce high-recall invariants, O(1) persistent agent memory, an asynchronous mailbox, and durable execution via exact suspend / resume checkpoints. 4. Capability-Based Identity (§ 7 ): We introduce grant identity , a primitive that returns an opaque, unforgeable Identity capability handle from the VM host. The handle cannot be coerced to a string, serialized, or echoed, preventing credential leakage even when the LLM controls the execution flow. 5. Compile-Time Schema Absorption (§ 8 ): We introduce use schema::<protocol>("url") , a protocol-dispatching compile-time macro that fetches an API specification, parses it, and synthesizes native Turn structs and closures. We ship the openapi adapter; graphql , fhir , and mcp adapters are in active development. Turn at a Glance Primitive Failure mode infer Struct {..} Untyped inference confidence v Unchecked certainty context, remember, suspend Fragmented state grant identity Credential leakage use schema::..("url") API contract gap Running example. Throughout this paper we reference the investment committee program (available at impl/examples/ in the repository 1 1 1 https://github.com/ekizito96/Turn ). In 89 lines, three specialist actors evaluate an NVDA equity position concurrently: a committee chair fetches live market data under a scoped network credential, a fundamental analyst gates its verdict on model confidence ( confidence < 0.7 triggers a deterministic fallback), and a risk officer enforces an exposure limit. The chair collects mailbox messages from both, synthesizes a final committee memo with infer , and writes it durably with a scoped filesystem credential. All five contributions in § 4 –§ 8 are exercised; each section references the relevant constructs. 2 Background and Related Work 2.1 Agent Frameworks The dominant approaches to agentic software are library-based: LangChain [ 8 ] chains LLM calls with tool invocations in Python; AutoGPT [ 9 ] implements a goal-directed decomposition loop; CrewAI [ 10 ] organises role-based agent teams; Semantic Kernel [ 11 ] provides a plugin architecture for .NET; MetaGPT [ 22 ] assigns agents distinct roles in a software pipeline. At the interaction pattern level, Yao et al. [ 20 ] introduced ReAct—interleaved reasoning traces and tool actions—which has become the standard agent loop template, and Park et al. [ 21 ] demonstrated persistent-memory multi-agent simulation. These approaches share a fundamental limitation: they are libraries, not languages. The invariants they attempt to enforce—context bounds, output schemas, tool permissions—exist as runtime conventions that the host language cannot statically verify. Kizito [ 16 ] provides empirical evidence that autonomous sub-agent loops fail at a rate governed by stochastic accumulation ( 0.95^{20}=0.36 ), and that reliability requires typed boundaries and deterministic repair routing rather than better prompts. 2.2 Programming Language Theory Turn draws on several established traditions in programming language design. Actor model. The actor model, introduced by Hewitt et al. [ 1 ]

Read the complete text