层层代理:从底层到生产构建自定义AI代理的方法论
Agents All the Way Down; A Methodology for Building Custom AI Agents from Substrate to Production
AI总结:
提出一种无框架的方法论,通过两个前提条件(将LLM作为软件组件和构建块)和三个实践(原型设计、打包为CLI、代理测试代理)来构建自定义AI代理,实现端到端开发。
摘要:
自定义AI代理是存在于自己应用程序中的代理,它们与自己的数据和工具交互,强制执行自己的安全边界,并携带自己的品牌和审计跟踪。它们与通用层级的区别在于适配性而非能力:每个代理由维护它的工程师为一项工作而构建。目前没有已发布的实践说明如何端到端地构建一个自定义AI代理。各个部分随处可见(函数调用API、模型上下文协议、可配对的代码代理),但将这些部分串联起来的实践存在于播客、博客和泄露的系统提示中。本文将这些实践记录为一种方法论,即“层层代理”:两个前提条件一次交叉并保持,然后三个实践在代理的生命周期中重复。前提条件是(P1)底层:将LLM作为软件组件,框架化为工具、系统,然后在提示缓存下框架化为消息;(P2)构建块:函数调用、MCP、CLI编排、liteshell模式、代理循环、技能、角色、钩子和脚手架。三个实践是(P3)使用通用代理进行原型设计;(P4)收获、折叠并将结果作为CLI发布,即Turtle模式;(P5)代理测试代理,其中通用代理通过行为场景驱动自定义代理,这是对经典测试的补充而非替代。工作循环是P3到P4再到P5并返回,一个推论自然得出:多代理编排就是CLI组合。该方法论在构造上是无框架的。它从AAC中提炼而来,AAC是开源LAMB平台的自定义代理,由一名开发人员使用AI配对程序员在大约十天内构建并投入生产。我们将其作为一种可迁移的实践呈现,独立于任何语言或框架。
英文摘要:
Custom AI agents areagents that live inside their own application, talk to their own data and tools, enforce their own security boundaries, and carry their own brand and audit trail. What separates them from the general-purpose tier is fit, not capability: each is built for one job, by the engineer who will maintain it. No published practice sets out how to build one end to end. The pieces are everywhere (function-calling APIs, the Model Context Protocol, code agents to pair with), but the practice that chains them lives in podcasts, blogs, and leaked system prompts. This paper writes that practice down as a methodology, Agents All the Way Down: two preconditions crossed once and kept, then three practices repeated for the agent's life. The preconditions are (P1) Substrate, the LLM as a software component, framed as tools, then system, then messages under prompt-caching; and (P2) Building blocks: function calling, MCP, CLI orchestration, the liteshell pattern, the agent loop, skills, characters, hooks, and scaffolding. The practices are (P3) prototype with a general-purpose agent; (P4) harvest, fold, and ship the result as a CLI, the Turtle pattern; and (P5) agent-tests-agent, in which a general-purpose agent drives it through behavioural scenarios, a complement to classical testing, not a replacement. The working loop is P3 to P4 to P5 and back, and one corollary falls out for free: multi-agent orchestration is just CLI composition. The methodology is framework-free by construction. It was distilled from the AAC, a custom agent for the open-source LAMB platform, built in about ten days by one developer with an AI pair-programmer and in production . We present it as a transferable practice, independent of any language or framework.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。