---
title: "Discussion on \"我用 SubAgent 做了一个 AI 自动修复闭环：流式修代码、自动构建、失败重试\" | Hashnode"
description: "Discussion on \"我用 SubAgent 做了一个 AI 自动修复闭环：流式修代码、自动构建、失败重试\". 最近用 AI 零代码项目生成前端页面有时候会出现问题，但是直接把原始报错信息返回给前端，再让用户手动点击按钮才能开始修复，用户体验不是很好，那么如何优化呢？我想到了 SubAgent 来进行修复！\n如果把这类修复工作一直交给主 Agent 来做，会带来两个明显问题：\n\n修复过程会不断污染主 Agent 的上下文。\n\n错误日志、修复尝试和中间结果会迅速挤占上下文窗口，影响主 Agent 后续继续处理"
url: "https://hashnode.com/posts/subagent-ai/69ca6cf19fffa74740171f7c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [我用 SubAgent 做了一个 AI 自动修复闭环：流式修代码、自动构建、失败重试](https://leikooo.hashnode.dev/subagent-ai?utm_source=hashnode&utm_medium=feed)

最近用 AI 零代码项目生成前端页面有时候会出现问题，但是直接把原始报错信息返回给前端，再让用户手动点击按钮才能开始修复，用户体验不是很好，那么如何优化呢？我想到了 SubAgent 来进行修复！ 如果把这类修复工作一直交给主 Agent 来做，会带来两个明显问题： 修复过程会不断污染主 Agent 的上下文。 错误日志、修复尝试和中间结果会迅速挤占上下文窗口，影响主 Agent 后续继续处理

Mar 30 · 4 min read · leikooo.hashnode.dev  
Read the article

## Written by

[leikooo](https://hashnode.com/@Simtch)

@Simtch

  
[View profile](https://hashnode.com/@Simtch)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
