arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.11767cs.PLcs.MAcs.SE
收藏

$λ_A$: 一种用于LLM代理组合的类型lambda演算

$λ_A$: A Typed Lambda Calculus for LLM Agent Composition

State Key Laboratory of Novel Software Technology, Nanjing University(南京大学软件新技术国家重点实验室);Software Institute, Nanjing University(南京大学软件学院)

Qin Liu

AI总结:

本文提出$λ_A$类型lambda演算,通过引入oracle调用、有界固定点、概率选择和可变环境扩展简单类型lambda演算,证明类型安全性和终止性,并展示其在代理配置检测中的应用。

摘要:

现有LLM代理框架缺乏形式语义:无法确定代理配置是否正确或终止。本文提出$λ_A$,一种用于代理组合的类型lambda演算,扩展了简单类型lambda演算,引入oracle调用、有界固定点(ReAct循环)、概率选择和可变环境。证明了类型安全性、有界固定点的终止性和衍生lint规则的正确性,全Coq机械化(1,519行,42个定理,0个Admitted)。作为实际应用,推导出一个lint工具,直接从操作语义检测结构配置错误。对835个真实世界GitHub代理配置的评估显示,94.1%存在结构不完整,仅YAML lint精度为54%,在175个样本上联合YAML+Python AST分析时升至96-100%。这一差距首次量化了代理生态系统中声明式配置与命令式代码之间语义交织的程度。进一步展示五个主流范式(LangGraph、CrewAI、AutoGen、OpenAI SDK、Dify)嵌入为类型$λ_A$片段,确立$λ_A$为LLM代理组合的统一演算。

英文摘要:

Existing LLM agent frameworks lack formal semantics: there is no principled way to determine whether an agent configuration is well-formed or will terminate. We present $λ_A$, a typed lambda calculus for agent composition that extends the simply-typed lambda calculus with oracle calls, bounded fixpoints (the ReAct loop), probabilistic choice, and mutable environments. We prove type safety, termination of bounded fixpoints, and soundness of derived lint rules, with full Coq mechanization (1,519 lines, 42 theorems, 0 Admitted). As a practical application, we derive a lint tool that detects structural configuration errors directly from the operational semantics. An evaluation on 835 real-world GitHub agent configurations shows that 94.1% are structurally incomplete under $λ_A$, with YAML-only lint precision at 54%, rising to 96--100% under joint YAML+Python AST analysis on 175 samples. This gap quantifies, for the first time, the degree of semantic entanglement between declarative configuration and imperative code in the agent ecosystem. We further show that five mainstream paradigms (LangGraph, CrewAI, AutoGen, OpenAI SDK, Dify) embed as typed $λ_A$ fragments, establishing $λ_A$ as a unifying calculus for LLM agent composition.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑