场景背景
项目:
workspace/
├── AGENTS.md
├── calculator.py
└── tests/
└── test_calculator.py
Bug:
def add(a, b):
return a - b
用户,“修复当前 pytest 失败。”
Step 1:扫描
Agent:
list_files
得到:
AGENTS.md
calculator.py
tests/test_calculator.py
Step 2:读取规则
read_file("AGENTS.md")
得到:
不能修改 tests/
使用 pytest
不能新增依赖
Step 3:跑基线测试
pytest -q
结果:
1 failed
assert -1 == 5
Step 4:读相关代码
读取:
calculator.py
发现:
return a - b
Step 5:修改
return a + b
Step 6:再次测试
pytest -q
结果:
1 passed
Step 7:Completion Gate
检查:
full_tests_passed = true
tests_modified = false
new_dependency = false
通过。
Step 8:报告
输出:
根因
修改
测试
规则遵守情况
整个流程非常简单。
但已经具备真正 Agent 的核心:
Observation 驱动
Tool 执行
State 更新
Completion Gate
Trace
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END

















请登录后查看评论内容