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

Three lessons for building reliable agent harnesses

AI summary

An author recounts building an agent harness with the OpenAI SDK and finding that it became slower as context expanded. The article presents three problems and corresponding remedies: context growth, addressed by separating message types, summarizing older turns and truncating tool output by default; repeated tool failures, addressed by limiting retries and distinguishing retryable from non-retryable errors; and failure recovery, addressed by saving snapshots of messages, tool-call records and intermediate state so a long-running task can be resumed. The author says these changes reduced latency and token use, but provides pseudocode rather than a complete implementation or controlled benchmarks, so the performance claims remain informal observations.

In-depth insight

The report offers concrete patterns and pseudocode for context management, bounded tool retries, error classification, state persistence and resuming long-running agent tasks.

前阵子在写自己的agent harness,跑着跑着发现一个问题:上下文越跑越慢。

一开始以为是模型本身的问题,后来排查发现是harness工程上几个坑没填好。

今天把这几个坑写出来,给同样在写LLM应用的同学参考。

坑一:上下文膨胀——把所有历史都塞回去

一开始我写harness的时候,每次调模型都把全部历史对话塞进去。

短任务还好,跑个几十轮之后,上下文长度直接爆。模型处理变长的prompt,延迟指数上升,token成本也翻倍。

#OpenAI SDK#Codex

Original · 3 min readRead the original
Group chat

No comments yet. Start the conversation.