用事件溯源解决大模型智能体状态丢失与执行不可靠问题
ESAA: Event Sourcing for Autonomous Agents in LLM-Based Software Engineering
- 将智能体意图与项目状态分离,通过只读日志记录所有操作
- 9任务和50任务案例均成功完成,验证任务不可逆与可追溯性
- 适合需要高可靠性、可审计的自动化软件开发场景
基于大语言模型(LLM)的自主智能体已从被动响应演变为具备规划、工具调用与环境迭代能力的系统。然而,其仍面临原生状态缺失、长期上下文退化及概率生成与确定性执行之间的矛盾。本文提出ESAA(事件溯源用于自主智能体)架构,借鉴事件溯源思想,将智能体的认知意图与项目状态变更分离。在该架构中,智能体仅输出结构化意图(如JSON格式的agent.result或issue.report),由确定性编排器验证并持久化至追加型日志(activity.jsonl),应用文件写入效应,并生成可验证的物化视图(roadmap.json)。系统引入边界契约(AGENT_CONTRACT.yaml)、元提示配置(PARCER)及哈希回放验证(esaa verify),确保已完成任务的不可篡改与溯源能力。两个案例验证:(i) 着陆页项目(9任务,49事件,单智能体);(ii) 临床仪表盘系统(50任务,86事件,4个并发智能体跨8阶段),均达成run.status=success且verify_status=ok。多智能体案例使用异构LLM(Claude Sonnet 4.6、Codex GPT-5、Antigravity/Gemini 3 Pro、Claude Opus 4.6),实证表明该架构可扩展至复杂多智能体协作场景。
原文摘要 · Abstract (English)
Autonomous agents based on Large Language Models (LLMs) have evolved from reactive assistants to systems capable of planning, executing actions via tools, and iterating over environment observations. However, they remain vulnerable to structural limitations: lack of native state, context degradation over long horizons, and the gap between probabilistic generation and deterministic execution requirements. This paper presents the ESAA (Event Sourcing for Autonomous Agents) architecture, which separates the agent's cognitive intention from the project's state mutation, inspired by the Event Sourcing pattern. In ESAA, agents emit only structured intentions in validated JSON (agent.result or issue.report); a deterministic orchestrator validates, persists events in an append-only log (activity.jsonl), applies file-writing effects, and projects a verifiable materialized view (roadmap.json). The proposal incorporates boundary contracts (AGENT_CONTRACT.yaml), metaprompting profiles (PARCER), and replay verification with hashing (esaa verify), ensuring the immutability of completed tasks and forensic traceability. Two case studies validate the architecture: (i) a landing page project (9 tasks, 49 events, single-agent composition) and (ii) a clinical dashboard system (50 tasks, 86 events, 4 concurrent agents across 8 phases), both concluding with run.status=success and verify_status=ok. The multi-agent case study demonstrates real concurrent orchestration with heterogeneous LLMs (Claude Sonnet 4.6, Codex GPT-5, Antigravity/Gemini 3 Pro, and Claude Opus 4.6), providing empirical evidence of the architecture's scalability beyond single-agent scenarios.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。