ArXiv TLDR

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

🐦 Tweet
2604.11767

Qin Liu

cs.PLcs.MAcs.SE

TLDR

$λ_A$ introduces a typed lambda calculus for LLM agent composition, offering formal semantics, type safety, and a lint tool to detect configuration errors.

Key contributions

  • Introduces $λ_A$, a typed lambda calculus extending simply-typed lambda calculus for LLM agent composition.
  • Proves type safety, termination of bounded fixpoints (ReAct loop), and soundness of derived lint rules.
  • Develops a lint tool that detects structural configuration errors, finding 94.1% of real-world configs incomplete.
  • Unifies five mainstream LLM agent paradigms (LangGraph, CrewAI, AutoGen, OpenAI SDK, Dify) as $λ_A$ fragments.

Why it matters

This paper addresses the critical lack of formal semantics in LLM agent frameworks, providing a principled way to ensure agent well-formedness and termination. The $λ_A$ calculus and its derived lint tool offer practical benefits by identifying common configuration errors and unifying diverse agent paradigms.

Original Abstract

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 partial Coq mechanization (1,567 lines, 43 completed proofs). 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.

📬 Weekly AI Paper Digest

Get the top 10 AI/ML arXiv papers from the week — summarized, scored, and delivered to your inbox every Monday.