The proliferation of Large Language Models (LLMs) has catalyzed a shift towards autonomous agents capable of complex reasoning and tool use. However, current agent architectures are frequently constructed using imperative, ad hoc patterns. This results in brittle systems plagued by difficulties in state management, error handling, and concurrency. This paper introduces Monadic Context Engineering (MCE), a novel architectural paradigm leveraging the algebraic structures of Functors, Applicative Functors, and Monads to provide a formal foundation for agent design. MCE treats agent workflows as computational contexts where cross-cutting concerns, such as state propagation, short-circuiting error handling, and asynchronous execution, are managed intrinsically by the algebraic properties of the abstraction. We demonstrate how Monads enable robust sequential composition, how Applicatives provide a principled structure for parallel execution, and crucially, how Monad Transformers allow for the systematic composition of these capabilities. This layered approach enables developers to construct complex, resilient, and efficient AI agents from simple, independently verifiable components. We further extend this framework to describe Meta-Agents, which leverage MCE for generative orchestration, dynamically creating and managing sub-agent workflows through metaprogramming.


翻译:大型语言模型(LLM)的激增推动了能够进行复杂推理和工具使用的自主智能体的发展。然而,当前的智能体架构通常采用命令式的、临时性的模式构建。这导致了脆弱的系统,饱受状态管理、错误处理和并发性等难题的困扰。本文介绍了单子上下文工程(MCE),这是一种新颖的架构范式,它利用函子、应用函子和单子的代数结构,为智能体设计提供了形式化的基础。MCE将智能体工作流视为计算上下文,其中横切关注点,如状态传播、短路错误处理和异步执行,由抽象的代数性质进行内在管理。我们论证了单子如何实现稳健的顺序组合,应用函子如何为并行执行提供原则性结构,以及关键的是,单子变换器如何允许这些能力的系统化组合。这种分层方法使开发者能够从简单的、可独立验证的组件构建复杂、健壮且高效的人工智能体。我们进一步扩展该框架来描述元智能体,其利用MCE进行生成式编排,通过元编程动态创建和管理子智能体工作流。

0
下载
关闭预览

相关内容

专门化大型语言模型综述
专知会员服务
35+阅读 · 2025年8月28日
上下文工程到底是什么?一文起底
专知会员服务
24+阅读 · 2025年7月21日
基于大型语言模型的软件工程智能体综述
专知会员服务
61+阅读 · 2024年9月6日
自然语言处理精品资料
人工智能前沿讲习班
14+阅读 · 2019年3月13日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
Arxiv
0+阅读 · 2月1日
Arxiv
0+阅读 · 1月27日
VIP会员
最新内容
博士论文 | 面向大模型推理的内存高效算法
专知会员服务
0+阅读 · 今天15:20
美空军新型反无人机部队初探
专知会员服务
4+阅读 · 今天5:45
《防空交战流程的概率建模研究》
专知会员服务
6+阅读 · 今天5:04
ICML 2026 教程 | 数值优化理论还重要吗?
专知会员服务
4+阅读 · 7月26日
ICM 2026 | 陶哲轩:人工智能时代的数学
专知会员服务
8+阅读 · 7月26日
《反无人机交战场景下的战斗归零研究》
专知会员服务
7+阅读 · 7月26日
博士论文 | 用代码结构感知方法推进代码大模型
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员