AI News AI资讯 6h ago Updated 53m ago 更新于 53分钟前 48

Decoding AI's Open-Source Course Maps Three Ways to Run an Agent Loop and the Provider Economics Behind Each Decoding AI开源课程解析运行Agent循环的三种方式及其背后的提供商经济

Harness engineering matters more than model selection: swapping only the agent harness moved a coding agent from ~30th to top 5 on Terminal-Bench while keeping the same model throughout Paul Iusztin's Decode agent separates a headless core loop (~20 lines via Pydantic AI) from three distinct run modes: interactive online, remote offline, and async online Interactive mode is latency-bound and requires low-latency hosted APIs with a steering queue that drains at MODEL_REQUEST and WOULD_STOP bounda Harness工程比模型选择更重要:LangChain Terminal-Bench实验显示,仅更换harness(同一模型)即可让编码agent排名从第30跃升至前5 提出三种agent运行模式:交互式在线(延迟敏感)、远程离线(吞吐敏感)、异步在线(队列驱动),每种模式对应不同的延迟特性和成本模型 Headless核心架构设计:agent核心仅约20行Pydantic AI代码,记忆、技能、沙箱、权限等均由harness实现,关注点分离清晰 成本优化显著:1000文档批量处理,API调用成本约$97,而serverless GPU批处理仅需约$13,差距达7倍 Serverless vs

68
Hot 热度
72
Quality 质量
65
Impact 影响力

Analysis 深度分析

TL;DR

  • Harness engineering matters more than model selection: swapping only the agent harness moved a coding agent from ~30th to top 5 on Terminal-Bench while keeping the same model throughout
  • Paul Iusztin's Decode agent separates a headless core loop (~20 lines via Pydantic AI) from three distinct run modes: interactive online, remote offline, and async online
  • Interactive mode is latency-bound and requires low-latency hosted APIs with a steering queue that drains at MODEL_REQUEST and WOULD_STOP boundaries to prevent input corruption
  • Remote and async modes are throughput-bound, making GPU-hour billing significantly cheaper than per-token API pricing (e.g., 1,000 documents cost ~$97 on frontier APIs vs ~$13 on batched serverless GPU)
  • Serverless GPU capacity wins over reserved instances when peak-to-average demand ratios (typically 5–10×) exceed reservation discounts (typically 2–5×), with industry utilization often below 30%

Why It Matters

This article reframes a critical design decision for AI practitioners: the agent harness architecture—not the underlying model—can be the dominant factor in agent performance, as demonstrated by the Terminal-Bench results. For teams building production coding agents, understanding which of the three run modes fits a use case directly impacts both latency characteristics and cost structure, with potential savings of 7× or more by matching the billing model to the workload.

Technical Details

  • Headless core architecture: The Decode agent uses a minimal ~20-line Pydantic AI definition for the core loop (LLM picks action → tool executes → observation feeds back), while everything else—memory, skills, sandbox, permissions, LSP feedback, compaction—constitutes the harness. For comparison, Claude Code's leaked source shows a ~150-line core loop.
  • Interactive mode (Mode 1): Terminal UI wired to a live session in-process with async token streaming. Solves the steering problem via a steering queue with priority gates at MODEL_REQUEST (before next model call) and WOULD_STOP (when turn ends). Three input modes: Plain Enter steers within turn, Alt+Enter queues follow-up, Esc triggers cooperative abort clearing both queues.
  • Remote mode (Mode 2): Headless harness runs on Kitaru (ZenML's agent runtime) deployed to GCP with agents executing on Modal. Features step-by-step progress recording for sandbox resume capability and pause-on-human-input without compute consumption. Tools execute in Modal Sandboxes remotely, Docker locally. Metric is throughput per dollar.
  • Async mode (Mode 3): Live session hands work to a job queue and returns immediately. Background workflows fan out LLM calls and post results later. Run outlives the client that started it. Pattern suits Slack-triggered agents and background PR review.
  • Cost analysis: Frontier API rates ($3M input, $15M output) yield ~$97 for 1,000 documents at 30K input tokens each vs ~$13 for batched serverless GPU (3K tokens/sec, ~3 hours). Interactive idle time is expensive: Qwen3.6 35B on H200 at $4.54/hour means 10 idle hours costs ~$45.

Industry Insight

  • Teams should prioritize harness engineering investment over model procurement decisions, as the same model with a better harness can dramatically outperform competitors—this is an architecture decision, not a deployment detail.
  • Organizations building agent systems should match their billing model to the interaction pattern: per-token APIs for latency-sensitive interactive workflows, and serverless GPU-hour pricing for throughput-oriented batch or async workloads, with serverless typically outperforming reservations given the 5–10× peak-to-average ratios common in agentic work.
  • The three-mode taxonomy (interactive, remote, async) provides a practical framework for agent architecture decisions, with each mode requiring different infrastructure choices and having distinct cost profiles that can differ by an order of magnitude at scale.

TL;DR

  • Harness工程比模型选择更重要:LangChain Terminal-Bench实验显示,仅更换harness(同一模型)即可让编码agent排名从第30跃升至前5
  • 提出三种agent运行模式:交互式在线(延迟敏感)、远程离线(吞吐敏感)、异步在线(队列驱动),每种模式对应不同的延迟特性和成本模型
  • Headless核心架构设计:agent核心仅约20行Pydantic AI代码,记忆、技能、沙箱、权限等均由harness实现,关注点分离清晰
  • 成本优化显著:1000文档批量处理,API调用成本约$97,而serverless GPU批处理仅需约$13,差距达7倍
  • Serverless vs Reserved决策:当峰值/平均需求比(5-10×)超过预留折扣(2-5×)时,serverless更经济,行业预留利用率普遍低于30%

为什么值得看

这篇文章为AI agent开发者提供了从架构层面优化性能的实用框架,揭示了harness工程这一被忽视的关键维度。三种运行模式的分类和详细的成本分析,帮助团队根据业务场景选择最合适的部署策略和计费模式。

技术解析

  • Headless Core + 插件化接口:系统中心是一个无界面的headless harness,内部运行标准agent loop(LLM选动作→工具执行→观察反馈)。agent本身极小(Decode约20行Pydantic AI定义,Claude Code泄露源码约150行),所有附加功能(记忆、技能、沙箱、权限、LSP反馈、上下文压缩)均由harness层实现。
  • 交互式在线模式(Mode 1):终端UI绑定单一实时会话,事件通过async generators流式返回。核心挑战是输入 steering——工具调用期间用户输入会破坏当前turn。解决方案是steering queue + priority gate,在MODEL_REQUEST(下次模型调用前)和WOULD_STOP(turn即将结束时)两个安全边界注入。支持三种输入模式:Plain Enter(当前turn内 steering)、Alt+Enter(排队至turn结束)、Esc(协作中止,清空队列但保留历史)。
  • 远程离线模式(Mode 2):harness无头运行于服务器(Kitaru运行时部署GCP,agent执行于Modal),无人实时监控。任务队列并行分发至N个harness,各自生成PR。运行时逐步记录进度,沙箱中途失败可从最后步骤恢复而非重启;等待人类输入时冻结且不消耗计算资源。工具在Modal沙箱远程执行,Docker本地执行。核心指标是每美元吞吐量。
  • 异步在线模式(Mode 3):介于前两者之间,实时会话将工作提交至任务队列后立即返回,后台工作流扇出LLM调用并稍后返回结果。用户在线但不监控每一步,队列拥有工作生命周期,适用于Slack触发agent和后台PR review场景,计费模式类似batch而非chat。
  • 成本模型与基础设施选择:交互式场景因人类等待而按token计费(适合低延迟托管API);离线/异步场景以吞吐为目标按GPU小时计费。示例:1000文档×30K输入token + 500输出token,API成本约$97,serverless GPU批处理(3000 tokens/sec)约3小时GPU时间,成本仅$13。反向案例:Qwen3.6 35B运行于单H200,Modal定价$4.54/小时,交互agent空闲10小时等待确认即增加$45成本。Serverless vs Reserved决策:预留按峰值费率收费,serverless跟随需求曲线;当峰值/平均比(5-10×)超过预留折扣(2-5×)时serverless更优,行业预留利用率普遍低于30%。

行业启示

  • 架构优先于模型选型:团队应将资源和注意力从"选择哪个模型"转向"如何构建harness",harness工程是提升agent性能和质量的关键杠杆,而非部署细节。
  • 按场景匹配成本模型:实时交互型agent应选用低延迟托管API并按token计费;批量/异步型agent应选用serverless GPU并按小时计费,避免为闲置时间付费。
  • Serverless GPU成为主流选择:对于波动性负载和agent开发场景,serverless在成本上优于预留实例,建议优先采用serverless架构并关注峰值/平均需求比指标以优化成本。

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Agent Agent Open Source 开源 Code Generation 代码生成 LLM 大模型 Evaluation 评测