Files
nexus/wiki/concepts/Agent-Collapse.md
2026-05-03 05:42:12 +08:00

33 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Agent Collapse"
type: concept
tags:
- "agentic-ai"
- "failure-mode"
- "context-window"
sources:
- "Your-AI-Isn-t-Stupid---It-Just-Needs-a-Better-Harness--Lychee-Technology-Engineering-Blog"
last_updated: 2026-04-20
---
## Overview
Agent Collapse10-Step Collapse——AI Agent 在多步任务执行过程中逐渐崩溃的现象,典型表现为步骤 1-3 正常执行,步骤 7 开始幻觉数据,步骤 10 输出损坏的 JSON 或崩溃。
## Root Causes
- **Context window 静默截断**:工具输出超出上下文窗口后被静默截断,模型感知不到数据丢失
- **无 Schema 验证**LLM 输出的字段类型漂移price 从 float 变为 string下游管道静默产生垃圾数据
- **无状态管理**context window 是易失的,关键状态(如 pending/in-progress/completed 标记)随上下文重置丢失
- **无幂等重试**:单步失败导致整个管道重启,而非精确重试失败步骤
## Manifestation Example
> 部署一个自主 Agent 编写市场研究报告。步骤 1-3 完美执行:计划任务 → 搜索网页 → 提取竞品数据。步骤 7 开始幻觉统计数据(因为搜索工具 payload 超出上下文窗口被静默截断)。步骤 10 输出损坏的 JSON 字符串(因为管道中没有 Schema 验证器)。
## Solutions
- [[Harness-Engineering]]:系统性地为每个失效点增加防护层
- [[State-Externalization]]:将任务状态写入磁盘,不依赖 context window
- [[Schema-Drift]] 防护:每个 LLM 输出必须经过 JSON Schema 验证
- [[Idempotency]]:单步失败只重试该步,不重启管道
## Source
- [[Your-AI-Isn-t-Stupid---It-Just-Needs-a-Better-Harness--Lychee-Technology-Engineering-Blog]]