Build Your First Agent ✍ rico🕐 2026-05-08📦 7.2 KB 🟢 已读 𝕏 文章列表 文章旨在通过简洁易懂的语言,帮助初学者在一下午的时间内构建第一个 AI Agent。作者指出 Agent 本质上是一个包含模型、工具集和循环的简单程序,并提出了“四步构建法”:定义目标、列出工具、选择运行时、编写系统提示。此外,文章还分享了五条实用规则(如展示工作过程、使用计划模式等)以避免常见陷阱,并列举了适合初学者的实践项目,强调构建 Agent 的核心在于理解其循环逻辑。 AI Agent入门教程LLM工具调用自动化系统提示PythonJavaScriptClaudeGPT # Build Your First Agent **作者**: rico **日期**: 2026-05-07T13:52:36.000Z **来源**: [https://x.com/_heyrico/status/2052386115488002524](https://x.com/_heyrico/status/2052386115488002524) ---  The word "agent" sounds bigger than it is. An agent is a small program that uses an AI model to make decisions. It reads what you want. It picks an action. It runs the action. It looks at the result. It picks the next action. The loop runs until the work is done. That is the whole idea. Every framework, every term, every demo, sits on top of that loop. Most articles about agents skip past this and land in the deep end. This one does the opposite. It explains the parts in plain English, walks through a build a beginner can finish in an afternoon, and lists the small mistakes that waste a weekend. ## What an agent actually is Picture an assistant who can read, type, click, and make calls. You give them a goal. They figure out the steps. They do each step. They check whether it worked. They keep going until the goal is met or they hit a wall. An AI agent is the same idea, except the assistant is a model (Claude, GPT, Gemini, or an open-source one) and the steps are calls to small tools that you provide. Three pieces sit underneath every agent. 1. A model. This is the brain. It reads, decides, and writes. Any modern LLM that supports "tool calling" works. Tool calling just means the model can fill in a small form to ask your code to do something for it. 2. A small set of tools. Each tool is one specific thing the agent can do. Read a file. Send an email. Search the web. Each tool comes back with a clean result the model can read. 3. A loop. A bit of code that asks the model "what do you want to do next?", runs whatever the model picks, hands back the result, and asks again. That is the entire shape. If you understand those three pieces, every agent tutorial gets easier to follow. The frameworks (Claude Agent SDK, OpenAI Agents, LangChain, CrewAI) are shortcuts that wrap the loop for you. An "SDK" is just a kit of pre-written code that handles the boring parts so you can write the interesting parts. Pick one when you are ready. It does not have to be the first decision. ## The four-step build Same shape every time. Step 1. Write the goal in one paragraph. Open a notes app. Answer three questions in three sentences. 1. What does this agent do? 2. Who is it for? 3. What does success look like? Five minutes. Skip this and the agent will do something close to your goal but not quite right. Write it down and the rest of the build gets much easier. Step 2. List the tools the agent needs. A "tool" sounds technical. It is not. A tool is a small piece of code that does one thing and gives back a tidy answer. Read your goal. Make a short list. Four tools is comfortable. Ten is too many. The first version of any agent works better with three reliable tools than ten that overlap. If you do not know how to build a tool, the model can write the basic version for you. Ask it. The work is in choosing which tools belong on the list, not in coding each one from scratch. Step 3. Pick the runtime. "Runtime" just means the program that runs your agent. Two real choices. The first option is a code-first kit. You write a small Python or JavaScript file. The kit handles the loop, retries, and memory for you. Pick this if you are comfortable in a terminal and want full control. The second option is a markdown-first runtime. You describe the agent in plain English in a markdown file, point it at the tools you already have, and let it run. No coding required. Pick this if writing code feels like a hurdle. Either works. The shape underneath is the same. Step 4. Write the system prompt and run it once. The "system prompt" sounds fancy. It is just a long note to the model that explains the role. A useful structure for the note: 1. The first part explains what the agent is doing, in plain language. 2. The second part lists the tools and when to use which one. 3. The third part covers what to do when something goes wrong (a tool fails, the input is empty, the goal is unclear). Run the agent on one small example first. Watch what it does. Read where it stumbles. Fix the prompt. Run again. After three or four passes, the loop runs cleanly. Most of the time on a first build is here. Almost none of it is in the code. ## Five quiet rules worth knowing before they bite 1. Make the agent show its work. Every tool should give back a short summary of what happened plus the actual result. Without this, the model loses track of what it just did and starts repeating itself. 2. Use plan mode. Before the agent acts, ask it to lay out the steps. Read the plan. Approve it. Then let it execute. Most "weird agent behavior" goes away once the plan is visible. 3. Build a real stop button. A way to pull the plug at any time, plus a notification on every run. If something goes wrong at 3am, you want to know by 3:01. 4. Keep the tool list small. Four tools, comfortable. Ten, the model picks the wrong one. If the agent really needs ten, build two agents instead. 5. Log everything. Every run writes a short record of what was tried, what happened, and what came back. When something breaks, the log is the only thing that helps. ## What your first agent might actually do Pick something small enough to ship in an afternoon. The point is not the agent. The point is to feel the loop close once. The second build always takes a fraction of the time. Common first builds: 1. A research helper. Reads a list of topics. Drafts a one-page brief on each. 2. A triage helper. Skims a busy inbox or channel. Writes a short digest of what needs attention. 3. A housekeeping helper. Closes stale tickets, tags untagged ones, writes a short weekly summary. 4. A drafting helper. Takes a few raw notes and turns them into a structured first draft. 5. A reading helper. Pulls sources for a topic into one document with a short summary at the top. Pick the one that gives back the most quiet hours per week, not the one that looks the most impressive. ## What changes after the first build The first agent is a small unlock. Once you have watched a model read a goal, pick a tool, react to the result, and produce something useful, the way you look at your week shifts. The repetitive parts start to look different. The boring tasks become candidates for a Saturday morning build. The judgment work gets clearer because the production work is no longer in the way. That is the real outcome. Not a finished agent. A clearer view of which parts of the work are worth a person, and which parts are worth a small loop running quietly in the background. Most of the build is the thinking. Most of the value shows up on the second build, and the third, after the loop has stopped feeling new. ## 相关链接 - [rico](https://x.com/_heyrico) - [@_heyrico](https://x.com/_heyrico) - [4.3K](https://x.com/_heyrico/status/2052386115488002524/analytics) - [Upgrade to Premium](https://x.com/i/premium_sign_up) - [9:52 PM · May 7, 2026](https://x.com/_heyrico/status/2052386115488002524) - [4,379 Views](https://x.com/_heyrico/status/2052386115488002524/analytics) --- *导出时间: 2026/5/8 13:33:01* --- ## 中文翻译 # 构建你的第一个智能体 **作者**: rico **日期**: 2026-05-07T13:52:36.000Z **来源**: [https://x.com/_heyrico/status/2052386115488002524](https://x.com/_heyrico/status/2052386115488002524) ---  “智能体”这个词听起来比实际要宏大得多。 智能体是一个利用 AI 模型做决策的小程序。它读取你的需求。它选择一个行动。它执行该行动。它观察结果。它选择下一个行动。这个循环一直运行,直到工作完成。 这就是核心理念。所有的框架、所有的术语、所有的演示,都建立在这个循环之上。 大多数关于智能体的文章都会跳过这一点,直接切入高深的内容。而这篇文章恰恰相反。它用通俗易懂的英语解释各个部分,演示一个初学者在一个下午就能完成的构建过程,并列出那些会浪费你整个周末的小错误。 ## 智能体到底是什么 想象一个能阅读、打字、点击和拨打电话的助手。你给它一个目标。它弄清楚步骤。它执行每一步。它检查是否奏效。它持续进行,直到目标达成或遇到阻碍。 AI 智能体也是同样的概念,只不过助手是一个模型(Claude、GPT、Gemini 或一个开源模型),而步骤是对你提供的小工具的调用。 每个智能体底层都有三个组成部分。 1. 一个模型。这是大脑。它阅读、决策和书写。任何支持“工具调用”的现代大语言模型(LLM)都可以。工具调用仅仅意味着模型可以填写一个小表单,请求你的代码为它做点什么。 2. 一小套工具。每个工具是智能体能做的一件具体的事情。读取文件。发送邮件。搜索网络。每个工具都会返回一个模型可以读取的清晰结果。 3. 一个循环。一段代码,询问模型“你想接下来做什么?”,运行模型选择的任何内容,交回结果,然后再次询问。 这就是整个结构。如果你理解了这三个部分,每一个智能体教程都会变得更容易跟上。 这些框架(Claude Agent SDK、OpenAI Agents、LangChain、CrewAI)是帮你封装好循环的捷径。“SDK”就是一套预写代码的工具包,用来处理枯燥的部分,这样你就可以编写有趣的部分。当你准备好后选一个就行。这不一定是首选决策。 ## 四步构建法 每次都是一样的结构。 第 1 步。用一段话写下目标。 打开一个笔记应用。用三个句子回答三个问题。 1. 这个智能体是做什么的? 2. 它是给谁用的? 3. 成功是什么样的? 五分钟。跳过这一步,智能体可能会做出接近你的目标但不完全正确的事情。把它写下来,剩下的构建过程会变得容易得多。 第 2 步。列出智能体需要的工具。 “工具”听起来很技术化。其实不然。工具是一小段代码,做一件事并返回一个整洁的答案。 阅读你的目标。列一个简短的清单。四个工具就很舒服。十个就太多了。任何智能体的第一个版本,如果有三个可靠工具,会比十个功能重叠的工具运行得更好。 如果你不知道如何构建工具,模型可以为你编写基础版本。问它就行。工作在于选择哪些工具应该列入清单,而不是从头开始编写每一个工具。 第 3 步。选择运行环境。 “运行环境”仅仅指运行你的智能体的程序。有两个真正的选择。 第一个选项是代码优先的工具包。你编写一个小型的 Python 或 JavaScript 文件。该工具包为你处理循环、重试和记忆。如果你习惯使用终端并且想要完全控制,选这个。 第二个选项是 Markdown 优先的运行环境。你在 Markdown 文件中用通俗的语言描述智能体,将它指向你已经拥有的工具,然后让它运行。不需要编码。如果写代码感觉像是一个障碍,选这个。 无论哪个都行。底层结构是一样的。 第 4 步。编写系统提示词并运行一次。 “系统提示词”听起来很花哨。它只是一张给模型的长条子,解释了它的角色。 这个条子一个有用的结构: 1. 第一部分用通俗语言解释智能体在做什么。 2. 第二部分列出工具以及何时使用哪一个。 3. 第三部分涵盖当出现问题时(工具失败、输入为空、目标不明确)该怎么办。 首先在一个小例子上运行智能体。观察它做了什么。阅读它在哪里绊倒了。修改提示词。再次运行。经过三四轮后,循环就会顺畅运行。 第一次构建的大部分时间都花在这里。几乎没有任何时间花在代码上。 ## 五条值得在出问题前了解的静默规则 1. 让智能体展示它的工作。每个工具都应该返回关于发生了什么的简短摘要以及实际结果。没有这个,模型会忘记它刚才做了什么,并开始重复自己。 2. 使用计划模式。在智能体行动之前,让它列出步骤。阅读计划。批准它。然后让它执行。一旦计划可见,大多数“奇怪的智能体行为”都会消失。 3. 构建一个真正的停止按钮。一种随时可以拔掉电源的方法,加上每次运行时的通知。如果在凌晨 3 点出了问题,你希望能在 3 点 01 分得知。 4. 保持工具列表简短。四个工具,很舒服。十个,模型就会选错。如果智能体真的需要十个,那就构建两个智能体。 5. 记录一切。每次运行都要写一份简短的记录,说明尝试了什么、发生了什么以及返回了什么。当出现问题时,日志是唯一有用的东西。 ## 你的第一个智能体实际上可能做什么 选一些足够小、一个下午就能发布的东西。重点不在于智能体本身。重点在于感受一次循环的闭合。第二次构建总是只需要一小部分时间。 常见的第一次构建: 1. 研究助手。阅读主题列表。为每个主题起草一页的简报。 2. 分类助手。浏览繁忙的收件箱或频道。写一份简短的摘要,列出需要注意的事项。 3. 整理助手。关闭过期的工单,标记未标记的工单,写一份简短的每周总结。 4. 起草助手。获取一些原始笔记并将它们转化为结构化的初稿。 5. 阅读助手。将某个主题的来源汇总到一个文档中,并在顶部附上简短摘要。 选择那个每周能为你节省最多安静时间的,而不是那个看起来最令人印象深刻的。 ## 第一次构建后会发生什么改变 第一个智能体是一个小小的解锁。 一旦你看着一个模型读取目标、选择工具、对结果做出反应并产生有用的东西,你看待一周的方式就会发生转变。重复的部分开始看起来有所不同。枯燥的任务成为周六早上构建的候选对象。判断工作变得更清晰,因为生产工作不再碍事。 这才是真正的结果。不是一个完成的智能体。而是一个更清晰的视角,让你明白工作的哪些部分值得一个人去做,哪些部分值得一个安静在后台运行的小循环去处理。 构建的大部分工作都在思考。大部分价值出现在第二次和第三次构建中,在循环不再让人感到新奇之后。 ## 相关链接 - [rico](https://x.com/_heyrico) - [@_heyrico](https://x.com/_heyrico) - [4.3K](https://x.com/_heyrico/status/2052386115488002524/analytics) - [Upgrade to Premium](https://x.com/i/premium_sign_up) - [9:52 PM · May 7, 2026](https://x.com/_heyrico/status/2052386115488002524) - [4,379 Views](https://x.com/_heyrico/status/2052386115488002524/analytics) --- *导出时间: 2026/5/8 13:33:01*
浪 浪费20亿Token之后,我做了一个帮自己定义目标的Skill 作者分享了一个名为Leader.skill的开源工具,旨在解决Agent交互中目标定义模糊的问题。该工具基于“目标七问”方法论,将模糊需求转化为清晰的目标任务书,支持多模型组合(如Claude规划、GPT执行),显著提升长程任务的完成率与Token利用率。 技术 › Skill ✍ 数字生命卡兹克🕐 2026-07-27 AgentGoal Engineering目标定义自动化开源LLM效率工具方法论ClaudeGPT
H Hermes Agent 完全指南:从零到自进化的 AI 员工 这是一份 Hermes Agent 的深度实操指南,涵盖了安装、模型选择、平台配置及最佳实践。文章对比了 Hermes 与 OpenClaw、Claude Code 的差异,强调了其本地化记忆、自我改进能力和多平台支持优势。核心内容涉及通过 Cron 和 /goal 命令实现全天候自主任务执行,助你打造一个能持续进化的 AI 员工。 技术 › Agent ✍ YanXbt🕐 2026-05-28 HermesAI AgentLLM自动化自我进化OpenClawClaude教程模型选择DevOps
如 如何构建在你睡觉时管理整个业务的 Claude Agent 文章详细介绍了如何构建一个基于 Claude 的全自动业务管理 Agent,用于在用户休息时自动处理邮件、生成报告、追踪项目和客户线索。核心架构由 Claude(智能层)、CLAUDE.md(业务上下文层)、MCP Servers(连接层)和 N8N(自动化层)组成。教程包含了具体的上下文配置模板(CLAUDE.md)、MCP 服务器配置(Gmail, Notion, Calendar 等)以及六个核心自动化工作流的实施步骤,旨在将业务运营从个人依赖转变为系统化智能运行。 技术 › Agent ✍ CyrilXBT🕐 2026-05-18 ClaudeAI Agent自动化业务管理MCPN8N工作流LLM生产力工具
如 如何构建一个每月20美元完成5人工作的AI智能体(完整教程) 文章介绍了一套完整的多Agent系统架构,旨在通过构建5个专业化AI智能体(研究、内容、客服、运营、分析),替代初级到中级员工的工作流程。文章详细阐述了每个Agent的Prompt设计、N8N工作流自动化配置及Voice Profile(语音档案)提取方法,强调以专业化分工替代通用AI,实现高效、低成本的业务自动化。 技术 › Agent ✍ CyrilXBT🕐 2026-05-08 AI AgentClaudePrompt Engineering自动化工作流N8NLLM效率工具系统架构多Agent
如 如何构建价值万美元的定制 MCP 服务器:完整课程 本文是一份关于如何从零开始构建并销售定制 MCP(模型上下文协议)服务器的完整指南。文章指出,当前市场对能解决实际业务问题的 MCP 服务器需求巨大,自由职业者单次开发收入可达 5000 至 15000 美元。内容分为三个月的学习路径:首月掌握协议并搭建首个服务器;次月聚焦解决企业内部工具、数据管道等痛点;第三月通过自由职业、产品化销售或企业合同实现变现。文章强调这不仅是技术开发,更是高价值的商业解决方案。 技术 › Agent ✍ Khairallah AL-Awady🕐 2026-05-06 MCPClaudeAI Agent商业模式副业PythonTypeScriptAnthropicAPI自动化
如 如何构建替代首批 3 名员工的 AI 智能体团队 本文为独立创业者提供了一份详细的实操指南,介绍如何利用 Claude、MCP 服务器和智能工作流构建三个 AI 智能体(研究、内容、运营),以低成本替代早期企业所需的全职员工,从而解决人力资源瓶颈并提升效率。 技术 › Agent ✍ Khairallah AL-Awady🕐 2026-05-06 AI AgentClaudeMCP创业自动化工作流提示工程LLM效率工具商业应用
揭 揭秘 Polymarket 百万美元收益机器人的 28 个底层工具 本文深度解析了一个在 Polymarket 上获利超过 100 万美元的自动交易机器人“Coinman2”的技术栈。文章详细介绍了利用 Claude (Anthropic) 等 AI 模型进行交易逻辑推理,并通过六个层级(大脑、编排、数据等)的 28 个工具构建完整系统的过程。核心策略在于捕捉 Polymarket 与 Binance 之间的价格滞后(套利机会),通过高频交易和严格的风控(如凯利公式)获利。 技术 › Agent ✍ cvxv666🕐 2026-05-01 Polymarket量化交易套利ClaudeLLM交易机器人PythonAI Agent加密货币风控
A AI Agent 从零开发指南:构建你的第一个智能体 本文是一篇从零开始构建 AI Agent 的实战教程。作者整合了 Anthropic 和 OpenAI 等资源,详细介绍了 Agent 的工作原理(核心循环)、五种核心工作流模式(如提示链、路由、并行化等),并提供了从构思、设计工具与记忆机制到落地的完整步骤。文章还探讨了如何利用 LLM 自身辅助设计 Agent,帮助开发者快速构建实用型的自动化智能体。 技术 › Agent ✍ hoeem🕐 2026-04-28 AI AgentLLM开发教程AnthropicOpenAI提示工程工作流自动化LangChainClaude
安 安卓手机运行 Hermes Agent 教程 本文详细介绍了如何在安卓手机上通过 Termux 安装并运行 Hermes Agent。文章提供了 F-Droid 下载链接及一键安装与手动安装两种方式,涵盖了环境配置、API Key 设置及常见报错解决方案。同时分析了手机端支持的图片语音交互、文件读写等核心功能,并指出了暂不支持 Docker 和后台持久化等限制。 技术 › Hermes ✍ 一🕐 2026-04-21 安卓TermuxAI Agent移动端安装教程代码自动化LLM工具与效率Python
我 我今天想构建一个人工智能代理(完整课程) 本文是一篇关于从零开始构建AI智能体的完整指南。作者基于Anthropic和OpenAI的最佳实践,整理了一套适合初学者的课程。文章详细介绍了代理的核心工作循环、五种核心工作流模式(如提示链、路由、并行化等),以及如何通过定义角色、目标、工具和规则来打造第一个代理。此外,还深入探讨了工具的高效使用、短期与长期记忆的赋予方法,并对比了使用Claude与OpenAI SDK构建代理的不同路径,强调了从简单工作流入手,逐步迭代至复杂代理的重要性。 技术 › Agent ✍ hoeem🕐 2026-03-28 AI AgentLLMOpenAIAnthropic教程工作流提示工程Claude智能体设计工具调用
教 教育博主爆款文章自动化创作 — 多 Agent 架构规划 文章详细规划了一套利用多 Agent 架构自动化创作教育领域爆款文章的解决方案。该体系包含总指挥 Orchestrator 及爆款雷达、深度分析、选题策略、素材猎手、初稿写手五个子 Agent,涵盖从数据爬取、规律分析、选题打分到素材收集和文案生成的全流程。 技术 › Agent 🕐 2026-03-25 AI Agent自动化工作流内容创作LLM架构设计PythonSEO数据分析
H How to master graph engineering 本课程教授如何构建 AI 智能体图,涵盖图的基本概念、关键模式(如菱形模式)、停止规则及人工审批环节。包含三个实战案例:深度研究台、SEO 内容生成器和市场推广套件,旨在提升业务效率并控制成本。 技术 › Agent ✍ Machina🕐 2026-07-23 AgentGraphLLMClaudeWorkflow工程化自动化架构设计效率实战