用分层栈结构让大模型智能体高效调用工具,避免混乱和资源浪费。
A Formal Hierarchical Architecture for Agentic Orchestration with Stack-Based Execution and Lazy Discovery
- 工具按树状结构组织,通过栈管理执行路径
- 仅加载当前路径的子工具,内存和计算成本随探索深度增长
- 适合需要严格隔离的金融、企业级AI应用
大型语言模型(LLM)代理能力快速扩展,但若工具以扁平单体形式注册,模型需同时评估数百甚至上千个选项,导致决策空间爆炸、上下文窗口饱和和路由准确率下降。为此,本文提出一种基于技能的分层架构,将能力组织为有根树,内部节点负责路由决策,叶节点执行确定性任务。运行时采用后进先出(LIFO)栈机制,实现类似下推自动机的记忆功能,支持嵌套上下文追踪与可确定性恢复。能力发现采用声明式、懒加载协议:仅加载当前活跃节点的直接子节点,使内存与提示成本随探索路径长度增长,而非全局工具库规模。通过局部栈帧替代全局记忆,防止不同执行分支间输出泄露,满足受监管企业环境部署所需的隔离保障。文中还以UPI Help——一个AI驱动的数字支付支持产品——为例说明实际应用场景。提供了编排状态的数学形式化、执行循环的算法分析,以及在工具目录扩大、多步工作流压力和每轮调用可见模式令牌暴露增加条件下,对比扁平与分层路由的控制实验。
原文摘要 · Abstract (English)
The rapid expansion of capabilities in Large Language Model (LLM) agents has exposed a critical architectural bottleneck: when agents are given access to a flat, monolithic registry of tools, the model must evaluate hundreds or thousands of options simultaneously. This leads to decision-space explosion, context window saturation, and degraded routing accuracy. To address these limitations, this paper presents a hierarchical, skill-based architecture for agentic orchestration. Capabilities are organized as a rooted tree where internal nodes make routing decisions and leaf nodes execute deterministic tasks. The runtime enforces a single-step execution loop governed by a Last-In-First-Out (LIFO) stack, giving the agent a form of memory akin to a Pushdown Automaton, therefore enabling it to track nested execution contexts and resume deterministically from any depth. Capability discovery follows a manifest-driven, lazy-loading protocol: only the immediate children of the active node are loaded, so memory and prompt costs scale with the explored path rather than the global registry. By replacing global memory with localized stack frames, the architecture prevents outputs from one execution branch from leaking into another, establishing the isolation guarantees required for deployment in regulated enterprise environments. We also discuss UPI Help, an AI-powered digital payments support product, as a motivating production deployment context. We provide a mathematical formalization of the orchestration state, detailed algorithmic analysis of the execution loop, and controlled benchmarks comparing flat and hierarchical routing under increasing tool catalogs, multi-step workflow pressure, and visible schema-token exposure per LLM call.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。