arXiv:2603.08755cs.PLcs.AI2026-03

Turn让智能体程序更安全可靠,通过语言级设计保障推理输出类型和权限隔离。

Turn: A Language for Agentic Computation

  • 用类型系统约束LLM输出,编译时生成JSON Schema并验证模型结果
  • 支持基于置信度的确定性控制流,确保智能体决策可预测
  • 适合构建需高安全性的自主智能体系统,如金融、医疗自动化

我们提出Turn,一种为自主智能体程序设计的编译型、基于角色的编程语言。该语言在类型层面静态推断结构,在值层面动态类型,旨在让程序通过调用大语言模型实现自主推理与行动。现有方法依赖通用语言框架,将关键约束(如上下文范围、类型输出、凭证隔离、持久状态)作为应用层约定,缺乏语言保证。Turn引入五种语言级构造:认知类型安全使LLM推理成为有类型的原语,编译器从结构定义生成JSON Schema,虚拟机在绑定前验证模型输出;置信度操作符实现基于模型置信度的确定性控制流;基于Erlang的角色式进程模型赋予每个智能体独立的上下文窗口、持久内存和信箱;基于能力的身份系统由虚拟机主机返回不可伪造的句柄,确保原始凭证永不进入智能体内存;编译时模式吸收(use schema::<protocol>)可在编译期合成外部规范的类型化API绑定,已支持openapi、graphql、fhir及mcp协议。我们描述了语言设计、类型规则、模式语义及基于Rust的字节码虚拟机,并在典型智能体工作负载上评估其性能。代码开源于https://github.com/ekizito96/Turn。

原文摘要 · Abstract (English)

We present \textbf{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} (\texttt{use schema::<protocol>}) synthesizes typed API bindings from external specifications at compile time; the \texttt{openapi} adapter is shipped with \texttt{graphql}, \texttt{fhir}, and \texttt{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.

智能体编程语言设计LLM安全类型系统

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。