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.


翻译:本文提出 **Turn**,一种编译型、基于参与者的编程语言——在模式推断层面采用静态类型,在值层面采用动态类型——专为智能体软件设计:即通过将推理任务委托给大型语言模型(LLM)来实现自主推理与行动的程序。现有方法通常在通用编程语言基础上通过框架进行增强,将关键不变性约束(如上下文边界、类型化推理输出、凭证隔离、持久化状态)编码为应用层约定而非语言级保障。Turn 通过引入五种语言级构造来填补这一空白。**认知类型安全** 将 LLM 推理实现为类型化原语:编译器根据结构体定义生成 JSON Schema,虚拟机在绑定前验证模型输出。**置信度运算符** 支持基于模型确定性的确定性控制流门控。Turn 的 **基于参与者的进程模型**(源自 Erlang)为每个智能体提供独立的上下文窗口、持久化内存和消息邮箱。**基于能力的身份系统** 从虚拟机宿主返回不透明且不可伪造的句柄,确保原始凭证永不进入智能体内存。最后,**编译时模式吸收**(`use schema::<protocol>`)在编译时根据外部规范合成类型化 API 绑定;`openapi` 适配器已随发行版提供,`graphql`、`fhir` 与 `mcp` 适配器正在积极开发中。本文阐述了语言设计、类型规则、模式语义及基于 Rust 的字节码虚拟机,并通过典型智能体工作负载对 Turn 进行了评估。Turn 已在 https://github.com/ekizito96/Turn 开源。

0
下载
关闭预览

相关内容

智能体,顾名思义,就是具有智能的实体,英文名是Agent。
大语言模型的智能体化推理
专知会员服务
33+阅读 · 1月21日
大语言模型智能体
专知会员服务
97+阅读 · 2024年12月25日
【WWW2024教程】大型语言模型驱动智能体,附slides
专知会员服务
64+阅读 · 2024年5月14日
从语言模型到语言智能体,普林斯顿Shunyu Yao
专知会员服务
63+阅读 · 2023年9月18日
深入理解BERT Transformer ,不仅仅是注意力机制
大数据文摘
22+阅读 · 2019年3月19日
【强化学习】强化学习+深度学习=人工智能
产业智能官
55+阅读 · 2017年8月11日
自然语言处理(二)机器翻译 篇 (NLP: machine translation)
DeepLearning中文论坛
12+阅读 · 2015年7月1日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
0+阅读 · 3月9日
Arxiv
0+阅读 · 3月4日
VIP会员
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员