← 返回日报
精读 预计 2 分钟

Tau: An Educational Coding Agent

摘要

Tau 是一款小型 Python 编码代理项目,展示从模型流到工具调用、会话管理,再到终端 UI 的完整架构。文章展示 3 层结构:提供商适配器、代理循环、编码环境,强调事件流作为层间合约,分离脑、环境与界面。列出实用技能,如耐用会话(~/.tau/sessions)、可扩展技能、文本用户界面适配器,并提供安装命令和 GitHub 链接。

荐读理由

Tau 的 3 层结构(provider-neutral 模型流、agent loop + reusable harness + coding app UI 适配)可直接照搬到项目中:stream 模型输出、tool calls、durable JSONL 会话、slash commands,终端 UI 隔离开不影响核心 harness

原文

An educational coding-agent project

Learn how coding agents are built.

Tau is a small Python coding agent you read like a textbook. Watch it stream model output, call tools, manage sessions, and grow into a terminal UI — one readable layer at a time.

No hidden machinery. Every moving part is on the page.

$ uv tool install tau-ai Start with the architecture →

Star Tau on GitHub

θ sweeps 0 → τ θ = 0.00

learnagent architecture

readsmall Python layers

runa real terminal agent

3-layers

A coding agent as a curriculum

Ⅰ tau_ai

Models become streams

Provider adapters turn model responses into provider-neutral events the rest of the agent consumes.

Ⅱ tau_agent

The agent loop

The reusable harness: messages, tools, transcript state, cancellation, queued prompts, sessions.

Ⅲ tau_coding

It becomes useful

The coding environment: files, shell, durable sessions, skills, slash commands, and a Textual TUI.

no black boxes

Every moving part is visible.

Tau answers the questions tutorials skip: What is an agent loop? Where do tool calls come from? How does the transcript grow? How do sessions survive the process exiting?

model streamtokens, tool requests, thinking deltas

event streamthe contract between layers

agent loopdecide, call tools, update transcript

sessioninspectable JSONL history

frontendprint, Rich, or TUI

the boundary

Separate the brain, the environment, and the face.

The whole lesson is the boundary. A reusable harness must not depend on the terminal, file paths, or Rich rendering. Those wrap the harness — they never live inside it.

tau — design split

AgentHarness = reusable agent brain
AgentSession = coding-agent environment
TUI          = one possible frontend

dependency direction
tau_coding → tau_agent → tau_ai

the skills

What you can learn from Tau

Provider-neutral streaming interfaces

Agent loops that request and execute tools

Typed local tools for read, write, edit, and bash

Durable sessions under ~/.tau/sessions

Session resume, branching, JSONL export, and HTML export

Project instructions, skills, and prompt templates

Slash commands and model/provider selection

Context accounting, compaction, and thinking controls

How to keep Textual behind a UI adapter boundary

how we think

Educational principles

Small layers beat magic

One job per package. Study the provider layer, harness, and coding app on their own.

Events make agents teachable

The agent emits a stream you can render, test, and export — not control flow buried in callbacks.

Real enough to matter

Educational, not a toy. Run it as a real terminal agent while reading the code behind it.

Docs follow implementation

Built phase by phase, each with notes on what was added, why, and how it fits.

the origin

Inspired by Pi, written as a Python learning path.

Pi is the minimalist coding-agent harness this project borrows its architectural lesson from — keep the harness, the environment, and the UI apart. Tau isn't a line-by-line port; it's an educational Python take on the same core ideas.

Visit pi.dev →

tau — session

τ › explain the agent loop

  stream   model events
  request  tool call
  execute  read / edit / bash
  append   transcript entries
  render   print mode or TUI

τ

A map for building your own agent: start with events, add a loop, wrap it in a harness, then give it tools and a UI.

$ uv tool install tau-ai Get started → Follow the roadmap →

Lobsters · 1 赞 · 0 评 讨论 → 阅读原文 →

这条对你有帮助吗?