type
Post
status
Published
date
Mar 29, 2026
slug
learn-claude-code-walkthrough
summary
研学learn-claude-code项目理解Agent工作原理
tags
开发
category
技术分享
titleIcon
password
icon
insider
🐑
研学learn-claude-code项目理解Agent工作原理
Agent 的核心 While 循环 + 工具回调

C01 - 核心loop

  • 外循环:用户初始输入 → 进循环agent_loop
  • 内循环:api调用 → 存下assistant结果 → 无工具调用返回 | 循环工具调用,拼接至用户输入 → 下一轮api调用
notion image
notion image
notion image
notion image
notion image
notion image
notion image
  • 原本的输出掺杂在一块,patch一下分开打印工具调用结果跟最终总内容
notion image
notion image

C02 - 工具调用

  • 简易沙箱与包装后工具(参数校验与“沙箱”包一层)
notion image
notion image
notion image
notion image
notion image
  • ai回答为什么写TOOLS定义传参可以得到结构化的返回
notion image
  • 自封装的工具可以沙箱拦一下,但如何拦住bash?(比如python与nodejs直接命令行跑脚本,或者落一个sh脚本跑)
notion image
notion image

TODO

杂项

神秘的PR消失
notion image
 
[2026.3.27]待进一步考察实用价值的AI前沿技术[2026.2.10]CachyOS调校历程
Loading...
2024-2026CamelliaV.

CamelliaV | Java;前端;AI;ACGN;