Research on Autopilot

中文翻译即将推出

Research on Autopilot

Most of my early use of AI coding agents was a back and forth loop. I asked for a function, it gave me one, I tweaked it, ran it, and came back for the next one. That is useful, but I am still driving every step.

A while back I started handing whole investigations over instead. In this post I’ll go through how I set that up, and one investigation where it made a difference.

How I set it up

It comes down to three things.

Write the context down first. Before handing anything over I write the problem definition, the current hypothesis, and the directions I want the agent to explore. For a bug, that includes what I have already ruled out. The quality of this document is the biggest lever on how useful the agent ends up being.

Give it permission to run, not just to answer. A partner needs to execute scripts, check logs, spin up environments, make observations and iterate, without asking at every step. You are not taking yourself out of the loop; You are raising the threshold for when your input is needed.

Ask for a running log and explicit checkpoints. Long investigations produce a lot of noise. I ask the agent to record what it tried, what it found and what it is doing next, and to flag me when something specific happens, e.g. a test passes unexpectedly, an error changes character, a pattern shows up.

Example: intermittent backup failures

I was trying to work out why certain backup jobs were failing intermittently. The test cycle was:

  1. Set up an S3 bucket populated with many objects
  2. Make a configuration change, e.g. bucket policy, KMS key, bucket notifications, object versioning
  3. Upload or delete some objects
  4. Wait for the next scheduled backup job to run
  5. Observe job status
  6. Trigger a restore and verify the result
  7. Repeat from step 1 with a different config combination

Ten rounds of this, and every round involved waiting. Before AI agents I had a notebook full of CLI commands. I eventually scripted it, which made it repeatable, but I was still the one watching the terminal, rerunning things and taking notes.

With the investigation handed over, the workflow was different. I wrote the context doc first: the problem statement, the relevant config knobs, what failure looked like, what I had already tried. Then I asked the agent to generate scripts for each phase of the loop, gave it permission to execute them in the test environment, and asked it to watch for job completion, restore verification and error codes, and to notify me when something was worth looking at.

Then I went and did other work.

The agent ran the cycle, kept a log, and flagged me when a restore failed with an unexpected error. I read its summary, formed a hypothesis about the root cause, updated the context and sent it back for another round. What used to take half a day of focused attention became something running in the background.

One small addition worked better than I expected. I asked the agent to use the macOS say command to announce the outcome at each checkpoint, so I would hear “restore completed successfully” or “job failed with error code 403” from the laptop while working on something else. (it is a gimmick, but I stopped checking back manually.)

What is hard about it

The hard part is not technical. It is the impulse to stay in the loop at every step.

Engineers are trained to be hands-on. We want to see the output of every command, and to catch things before they go wrong. Letting an agent run ten test cycles while you are in a meeting feels like losing visibility. What you are trading is low value visibility for high value attention; You do not need to watch a script run, you need to know when it finishes with something interesting.

The enabler is that opening context doc. Investigations handed over with a vague mandate tend to drift; Ones with a clear “flag me when X happens” signal tend to converge.

Conclusion

The setup that works for me is to write the problem, the hypotheses and the success criteria down first, give the agent permission to execute in a test environment, and ask it to flag specific outcomes rather than report every step.

自动驾驶式调查

我早期用 AI coding agent 基本上是一个来回对话的循环。我让它写一个函数,它给我一个,我改一改、跑一跑,然后回来要下一个。这有用,但每一步还是我在开车。

一段时间之前,我开始改成把整个调查任务交出去。这篇文章讲一下我是怎么设置的,以及一次真正见效的调查。

我是怎么设置的

归结为三件事。

先把上下文写下来。在把任务交出去之前,我会写下问题定义、当前的假设,以及我希望 agent 去探索的方向。如果是排查 bug,还包括我已经排除掉的可能。这份文档的质量,是决定 agent 最终有多大用处的最大杠杆。

给它执行的权限,而不只是回答的权限。一个真正的调查伙伴需要能执行脚本、查日志、启动环境、做观察并迭代,而不是每一步都来问你。你不是把自己从循环里拿掉;你是在提高需要你介入的门槛。

要一份运行日志和明确的检查点。长时间的调查会产生很多噪音。我会让 agent 记录它尝试了什么、发现了什么、接下来做什么,并在特定的事情发生时通知我,e.g. 某个测试意外通过了、错误的性质变了、出现了某种规律。

示例:间歇性的备份失败

我当时想搞清楚为什么某些备份任务会间歇性失败。测试周期是这样的:

  1. 搭建一个填充了大量对象的 S3 bucket
  2. 做一个配置更改,e.g. bucket policy、KMS key、bucket notifications、对象版本控制
  3. 上传或删除一些对象
  4. 等待下一次计划的备份任务运行
  5. 观察任务状态
  6. 触发一次恢复并验证结果
  7. 从第一步重来,换一种配置组合

十轮这样的循环,每一轮都要等。在有 AI agent 之前,我有一本记满 CLI 命令的笔记本。后来我把它脚本化了,这让它可重复,但盯着终端、重跑命令、记笔记的还是我。

把调查交出去之后,工作流就不一样了。我先写上下文文档:问题陈述、相关的配置项、失败长什么样、我已经试过什么。然后我让 agent 为循环的每个阶段生成脚本,授权它在测试环境里执行,并让它关注任务完成、恢复验证和错误码,在有值得看的事情发生时通知我。

然后我就去做别的工作了。

agent 跑完了循环,维护了日志,并在一次恢复因为意外错误失败时通知了我。我读了它的摘要,对根因做了一个假设,更新上下文,让它开始下一轮。以前需要我半天专注注意力的事情,变成了在后台跑着的事情。

有一个小改动比我预期的更有用。我让 agent 在每个检查点用 macOS 的 say 命令播报结果,这样我在做别的事情的时候,会直接从笔记本里听到「恢复成功完成」或者「任务失败,错误码 403」。(这是个噱头,但我确实不再手动回查了。)

难在哪里

难的地方不是技术。是那种想在每一步都待在循环里的冲动。

工程师是被训练成动手派的。我们想看到每一条命令的输出,想在出错之前就抓住问题。让一个 agent 在你开会的时候跑十轮测试循环,感觉像是在失去可见性。你实际上是在用低价值的可见性换取高价值的注意力;你不需要看着脚本运行,你需要知道它什么时候跑出了有意思的结果。

关键还是开头那份上下文文档。授权含糊、范围不清的调查往往会漂移;有明确「当 X 发生时通知我」信号的调查往往会收敛。

结论

对我有效的做法是:先把问题、假设和成功标准写下来,给 agent 在测试环境里执行的权限,并让它上报特定的结果,而不是汇报每一个步骤。

Share this post: 分享这篇文章:

Comments 评论