首页›Ahead of AI›文章

Components of A Coding Agent

Sebastian Raschka, PhD · 2026年4月4日

AI 摘要 AI 生成,可能有误

本文阐述了编码智能体(coding agent)以及诸如 Claude Code 和 Codex CLI 这类智能体框架(agent harness)的设计,厘清了大语言模型(LLM)、推理模型与智能体之间的关系:大语言模型是引擎,推理模型是强化版的引擎,而智能体框架则是添加了工具、记忆和环境反馈的控制循环。作者认为,模型外围的框架往往与模型本身同样重要,并将编码智能体拆解为六个核心组件:实时仓库上下文、提示词形态与缓存复用、带有校验和权限控制的结构化工具、上下文精简与输出管理、带有记忆和恢复功能的会话记录,以及对有边界子智能体的委派。这些概念通过他用纯 Python 从零实现的最小化 Mini Coding Agent(迷你编码智能体)加以演示。

In this article, I want to cover the overall design of coding agents and agent harnesses: what they are, how they work, and how the different pieces fit together in practice. Readers of my Build a Large Language Model (From Scratch) and Build a Large Reasoning Model (From Scratch) books often ask about agents, so I thought it would be useful to write a reference I can point to.

More generally, agents have become an important topic because much of the recent progress in practical LLM systems is not just about better models, but about how we use them. In many real-world applications, the surrounding system, such as tool use, context management, and memory, plays as much of a role as the model itself. This also helps explain why systems like Claude Code or Codex can feel significantly more capable than the same models used in a plain chat interface.

In this article, I lay out six of the main building blocks of a coding agent.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Ahead of AI

Understanding Positional Embeddings in Modern LLMs

AI 摘要This article is a detailed tutorial on how LLMs encode token position information, explaining why explicit positional signals are needed (beyond the implicit order given by causal attention masks) and walking through methods like GPT-2's learned absolute position embeddings, the original transformer's fixed sinusoidal encodings, and RoPE, illustrated with visuals, math, and PyTorch code. The author also previews which positional encoding approaches are used in 2026 open-weight model architectures. The article serves as a standalone foundational reference, motivated by reader requests for a RoPE tutorial and as preparation for an upcoming analysis of modern LLM architecture trends.

Building Reasoning Models from the Ground Up: A Full Video Course

AI 摘要The author announces an 11-hour, eight-video course that builds a reasoning model from scratch in Python and PyTorch, starting from a pre-trained Qwen3 model and covering evaluation with a math verifier, inference-time scaling techniques like sampling, self-consistency, and self-refinement, and reinforcement learning with verifiable rewards using GRPO. The videos accompany his book 'Build a Reasoning Model (From Scratch)' and require comfort with Python and PyTorch, with a GPU recommended for the training-focused later videos. He also explains that reasoning models act as the 'engine' inside agent harnesses, making them essential for understanding modern LLM-based agents.

Language Models for Text Classification: From Bag-of-Words to Jev

AI 摘要This article analyzes the newly released Jev AI model, positioning it as a fast and inexpensive text classifier that bridges the gap between general-purpose LLMs and narrow task-specific classifiers. To demystify the hype, the author traces the history of language models for text classification, from bag-of-words representations with classic methods like naive Bayes and logistic regression, through word embeddings and recurrent neural networks such as LSTMs, up to transformer-era approaches. The author concludes that while Jev is essentially a text classifier, it is more general and capable than its simple predecessors, which explains its recent popularity.

GPT-6 Astra, Looped Transformers, and Hidden Reasoning

AI 摘要The article reviews OpenAI's newly released GPT-6 Astra, describing it as the best model the author has used, with standout performance in 3D rendering, animation, and computer-use tasks, and explaining how computer-use skills are trained via reinforcement learning in macOS environments. It then explains 'looped transformers' (recurrent depth), an architecture in which intermediate representations pass through the same transformer blocks multiple times with shared weights, an idea dating back to Universal Transformers (2018). Finally, it examines whether this looped design relates to rumors that Astra conceals its chain-of-thought reasoning trace.

How Claude Watermarks AI-Generated Text

AI 摘要The author expands on a popular social media post by creating a detailed 48-minute video lecture (with over 50 slides and a transcript) explaining how Anthropic's new watermarking for Claude-generated text works. The lecture first covers how LLM text generation functions under the hood—tokenization, score distributions, and next-token sampling—to show that watermarking is a minor tweak within the normal generation process. The goal is to help readers understand how the invisible watermark is embedded, why it can fail or be removed, and its pros and cons.