Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I built a coding agent from scratch to see what's inside

说明与用途

作者构建了一个565行Python代理,展示了编码代理的内部循环:模型发送提示,执行本地工具,直到模型给出直接答案。

问题

The author could not explain what coding agents do between the prompt and the file edit, so they built one to understand the internal loop.

结果

The author discovered that coding agents operate by sending the conversation to a model, executing tools requested by the model, and looping until the model provides a direct answer. The model never edits files; the local machine performs all file operations.

工作流

  • 1. Define tools (Read, Write, Bash) and give them to the model.
  • 2. Run the agent loop: send conversation to model, execute requested tools, return results, repeat until model answers directly.
  • 3. Validate tool calls with Pydantic.
  • 4. Implement skills, slash commands, and arguments.
  • 5. Create Skill tool and subagents with their own conversations.
  • 6. Test each stage with tagged commits and a command that proves it works (e.g., just stage 4 cd .stages/04 just run "How many carrots does the rabbit eat per day, according to rabbit.py?").

证据

Claude Code, Cursor and Codex all run the same loop: send the conversation to a model, run the tools it asks for, send back the results, repeat until the model just answers.

来源

The model never touches your files. It only asks, and your machine does the work.

来源

petite is that loop, written from scratch in 565 lines of Python.

来源

Every stage is a tagged commit that runs on its own. The site gives you a task for each one, keeps the solution folded until you want it, and has a command that proves it works:

来源

  • 记录日期: 2026-10-04T23:56:02.440Z