Create

Sign in to ReadmeX

or

How we handle your data: Privacy Policy

ReadmeX

Your AI reading companion

What would you like to catch up on?

Pick a briefing, or ask your own question.

Your community and people briefings stay personal to you.

Story

Adding Observability and Replay to an AI Agent Harness

AI summary

In a first-person engineering account, the author describes rebuilding an AI agent harness’s observability after a ticket-processing agent created 43 duplicate tickets for one customer while leaving only a “task finished” log. The runnable Python examples cover trace IDs, structured step records, tool-argument validation, budgets, per-step token attribution, replay, and daily metrics. The harness handles scheduling, tools, state, and retries, while business code defines the task goal. The author attributes the incident, operational percentages, and debugging-time reductions to their own experience; these claims are not independently verified in the supplied material.

In-depth insight

The account provides a concrete implementation pattern for diagnosing production agent runs, recording failures and budget stops, and replaying individual steps. Its reported incident and performance figures remain the author’s own measurements and are not independently verified.

把 Agent 的可观测性做进 Harness:一次从「日志里只有 task finished」到全链路回放的改造

去年我们上线了一个工单自动整理 Agent,第一周就出了事故:同一个客户被创建了 43 条重复工单。事后复盘,最尴尬的不是 bug 本身,而是我们的日志里只有一行 task finished——没有输入、没有工具调用记录、没有中间决策,连它为什么不停下来都查不出来。

这件事之后我把 Harness 层的观测能力重做了一遍。这篇文章记录改造过程中的设计取舍和踩过的坑,偏工程视角,代码用 Python 写,可以直接跑。如果你正在把 Agent 往生产环境推,这篇大概能帮你少走一段弯路。

为什么观测要放在 Harness 层,而不是塞进业务代码

先说一个我早期犯的错:一开始我把日志、埋点、错误处理都写在业务逻辑里,每个 Agent 任务都复制一遍。结果三个任务之后代码就没法维护了,而且不同任务的日志格式还不一样,没法统一分析。

#Python

Original · 7 min readRead the original
Group chat

No comments yet. Start the conversation.