Decoding AI’s Open-Source Course Maps Three Ways to Run an Agent Loop and the Provider Economics Behind Each

2026年8月22日 13:43
站內 AI 整理稿

Most teams treat ‘which model’ as the important decision.The harness engineering literature keeps pointing somewhere else.In LangChain’s Terminal-Bench experiment, changing only the harness—same model throughout—moved a coding agent from roughly 30th place into the top 5.

That result reframes the question.If the harness decides quality, then how you run the loop becomes an architecture decision, not a deployment detail.Paul Iusztin’s open-source course Building a Coding Agent From Scratch builds a Python agent called Decode.

Published through Decoding AI, it separates three run modes.Each mode has a different latency profile.Each one therefore wants a different inference provider.One headless core, three shapes The center of the system is a headless harness with no interface of its own.

Inside it runs the agent loop every harness shares: the LLM picks an action, a tool executes, the observation feeds back.Everything reads from and writes to the context window.The agent itself is small.In Decode it is a ~20-line Pydantic AI definition composing a model, tools, and an output type.

In Claude Code’s leaked source, the core loop is roughly 150 lines.Everything else—memory, skills, sandbox, permissions, LSP feedback, compaction—is harness.Interfaces then plug into that core.

That is where the three modes appear: Mode 1: Interactive, online A terminal UI is wired to one live session, in memory, in the same process.Events stream back through async generators as tokens arrive.The hard problem here is steering.

If you type while a tool call is in flight, injecting the message immediately corrupts the turn.Decode’s answer is a steering queue plus a priority gate.Input is buffered on arrival and injected only at a safe boundary.

The loop exposes two: MODELREQUEST, before the next model call, and WOULDSTOP, when the turn would end.Three input modes map onto that.Plain Enter steers within the turn.Alt+Enter queues a follow-up until the turn stops.

Esc triggers a cooperative abort at the next boundary, clearing both queues so history stays intact.A human is reading every token.This mode is latency-bound, which is why it belongs on a low-latency hosted API.

Mode 2: Remote, offline Remote mode keeps the harness headless and runs it on a server through an agent runtime.Decode uses Kitaru, ZenML’s agent runtime, deployed to GCP, with the agents themselves executing on Modal.Nobody is watching.

A backlog of tickets fans out to N harnesses in parallel, each producing its own PR.Because the runtime records progress step by step, a sandbox that dies mid-task resumes from its last recorded step instead of restarting.

A run that pauses for human input freezes and consumes no compute while it waits.Tools execute inside Modal Sandboxes remotely, Docker locally.The metric that matters is throughput per dollar, not time-to-first-token.Mode 3: Async, online The third shape sits between the two.

A live session hands work to a job queue and returns immediately.Background workflows fan out LLM calls and post results back later.The user is online but not watching each step.The queue owns the work, so the run outlives the client that started it.

This is the pattern behind Slack-triggered agents and background PR review, and it bills like batch, not like chat.The interactive explainer (function(){ var f=document.getElementById("mtp-agentloop-frame"); window.addEventListener("message",function(e){ if(!e.data||typeof e.data!

=="object")return; var h=e.data.mtpAgentLoopHeight; if(h&&h>200&&h<6000)f.style.height=h+"px"; }); })(); Why the provider changes with the mode The cost model follows the latency requirement, and the gap is large.

Take 1,000 documents at 30,000 input tokens each, roughly 500 output tokens per document.At frontier API rates of $3 per million input and $15 per million output, the lesson's arithmetic lands near $97.Prompt caching does not rescue it, because every document is a different prefix.

Batched on a serverless GPU at around 3,000 tokens per second, the same work is under three hours of GPU time—roughly $13.The reverse case is just as sharp.Decode's default test model, Qwen3.6 35B, runs on a single H200.Modal's published pricing lists H200 SXM at $0.001261 per second, or about $4.

54 per hour.Leave an interactive agent idle overnight waiting on a y confirmation, and ten idle hours add roughly $45 to the bill.That is the whole argument.Interactive work pays per token because a human is waiting.

Offline and async work pays per GPU-hour because throughput is the objective and idle time is the enemy.There is a second axis: serverless versus reserved capacity.Modal's pricing analysis reduces it to one comparison.

Reservations charge the peak rate for the whole contract; serverless follows the demand curve.When the peak-to-average ratio exceeds the reservation discount, serverless is cheaper.

Modal reports typical discounts of 2–5× against peak-to-average ratios of 5–10× for inference, training, and agentic development.Industry surveys it cites put reservation utilization below 30%, often under 10%.

Key Takeaways Harness beats model: swapping only the harness moved an agent from ~30th to top 5 on Terminal-Bench.Interactive mode is latency-bound and steers via a queue draining at MODELREQUEST and WOULDSTOP boundaries.

Remote and async modes are throughput-bound, so GPU-hour billing beats per-token billing at volume.1,000 documents cost ~$97 on frontier API rates versus ~$13 of batched GPU time.Serverless wins whenever peak-to-average demand exceeds the reservation discount, typically 5–10× against 2–5×.

Sources: Building a Coding Agent From Scratch (Lesson 1) The Bare-Bones Coding Agent Loop (Lesson 2) From a Raw Shell to a Sandboxed Coding Agent (Lesson 3) Course repository · Modal pricing How to price serverless GPUs LangChain: The anatomy of an agent harness The post Decoding AI’s Open-Source Course Maps Three Ways to Run an Agent Loop and the Provider Economics Behind Each appeared first on MarkTechPost.

Related

相關文章

IT之家AI Agent

消息稱 NVIDIA 考慮向 Perplexity AI 投資“數十億美元”

作者:溯波(實習) 責編:溯波 評論: 8 月 24 日消息,外媒 The Information 稍早前報道稱,NVIDIA(英偉達)考慮在 Perplexity AI 的最新融資輪中向這家人工智能初創企業投資“數十億美元”。雙方正就該交易展開磋商,還可能達成技術授權協議。

剛剛
AIBaseAI Agent

Guidelight評估五大AI實驗室,OpenAI遏制能力排名第一

該評估覆蓋Anthropic、Google、OpenAI、Meta和xAI,僅依據公開信息考察其是否建立監控、異常行為處置、第三方審計及失控模型關閉等機制。在滿分5分的評估中,OpenAI以3分排名最高,Anthropic和Meta得分最低。

7 小時前7400
何夕2077AI Agent

τ_0-VLA長程操控

τ₀-VLA是一種層次化機器人基礎模型,透過世界模型引導的測試時計算來改善長程操控任務。高層策略在決策不確定時會額外分配計算資源,搜尋替代子任務並預測其視覺結果,而低層策略則在40,115小時的異質真實世界數據上訓練。在包含13到25個步驟的真實長程任務中,封閉迴路成功率從27.5%提升至45.0%。

8 小時前
何夕2077AI Agent

智能體技能合集

VoltAgent 的智能體技能庫近期持續擴充,目前收錄的技能規模已突破千項,相關倉庫在開發社群中獲得約 31.3k 的星標關注。這個持續成長的技能庫,正逐步成為開發者快速組合與部署智能體工作流程的重要資源。 該技能庫涵蓋多種類型的 CLI 工作流程,這些流程具備高度可複用性,讓開發者不必從零開始建構每個環節,而是能直接引用既有技能來加速專案進度。隨著技能項目不斷增加,VoltAgent 生態系的應用範圍也隨之擴大,從自動化任務到複雜的指令處理,都能找到對應的現成模組。

8 小時前
何夕2077AI Agent

ruflo蜂群代理

近期在AI資訊日報中受到矚目的「ruflo蜂群代理」,是一款以多智能體框架為核心的代理管理工具。其設計重點在於讓開發者能夠有效管理複雜的代理流,透過系統化的方式協調多個AI代理協同運作,而非僅是單一任務的自動化處理。這種架構特別適合需要分工、接力或平行處理的應用場景,讓整個執行流程更為清晰且可控。 值得注意的是,ruflo導入RAG(檢索增強生成)記憶機制,讓代理在運作過程中能將經驗與知識「沉澱」下來。也就是說,代理不只是每次從頭開始執行,而是可以從過往的互動或任務中提取相關資訊,作為後續決策的參考依據。

8 小時前