🤖
理解 Agent 本质
AI Agent = LLM + 工具 + 循环。理解这个公式,你就理解了 Agent 的核心。
gemini-cli 是 Google 开源的终端 AI Agent,它展示了:
概念 → API → 工具 → 循环 → 源码 → 实战如果你想快速了解 Agent 是什么:
// AI Agent 的本质就是这个循环
while (true) {
const response = await llm.chat(messages)
if (response.hasToolCall()) {
const result = await executeTool(response.toolCall)
messages.push({ role: 'tool', content: result })
} else {
return response.text() // 完成
}
}想了解更多?开始学习 →