<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Topics on Hao · AI Agent 学习记录</title><link>https://haokw.github.io/topics/</link><description>Recent content in Topics on Hao · AI Agent 学习记录</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Sat, 01 Aug 2026 00:00:00 +0800</lastBuildDate><atom:link href="https://haokw.github.io/topics/index.xml" rel="self" type="application/rss+xml"/><item><title>准备：环境准备（Codex + DeepSeek）</title><link>https://haokw.github.io/topics/prepare/</link><pubDate>Sat, 01 Aug 2026 00:00:00 +0800</pubDate><guid>https://haokw.github.io/topics/prepare/</guid><description>&lt;p&gt;本节汇总环境准备阶段的笔记与成果：Codex + DeepSeek 环境配置、Agent 使用日志模板。&lt;/p&gt;
&lt;h2 id="1-codex-cli-安装"&gt;1. Codex CLI 安装&lt;a href="#1-codex-cli-%e5%ae%89%e8%a3%85" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;"&gt;&lt;tr&gt;&lt;td style="vertical-align:top;padding:0;margin:0;border:0;"&gt;
&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt;1
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt;2
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%"&gt;
&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;npm install -g @openai/codex
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;codex --version
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;codex login &lt;span style="color:#75715e"&gt;# 登录 OpenAI 账号&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id="2-deepseek-api-配置"&gt;2. DeepSeek API 配置&lt;a href="#2-deepseek-api-%e9%85%8d%e7%bd%ae" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;在 &lt;a
 href="https://platform.deepseek.com"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;platform.deepseek.com&lt;/a&gt; 创建 API Key，然后设置环境变量：&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;"&gt;&lt;tr&gt;&lt;td style="vertical-align:top;padding:0;margin:0;border:0;"&gt;
&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%"&gt;
&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;export DEEPSEEK_API_KEY&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;sk-...&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;DeepSeek 提供 OpenAI 兼容接口，base URL 为 &lt;code&gt;https://api.deepseek.com&lt;/code&gt;，
可用 curl 快速验证：&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;"&gt;&lt;tr&gt;&lt;td style="vertical-align:top;padding:0;margin:0;border:0;"&gt;
&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt;1
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt;2
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt;3
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt;4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%"&gt;
&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl https://api.deepseek.com/chat/completions &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; -H &lt;span style="color:#e6db74"&gt;&amp;#34;Content-Type: application/json&amp;#34;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; -H &lt;span style="color:#e6db74"&gt;&amp;#34;Authorization: Bearer &lt;/span&gt;$DEEPSEEK_API_KEY&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; -d &lt;span style="color:#e6db74"&gt;&amp;#39;{&amp;#34;model&amp;#34;:&amp;#34;deepseek-chat&amp;#34;,&amp;#34;messages&amp;#34;:[{&amp;#34;role&amp;#34;:&amp;#34;user&amp;#34;,&amp;#34;content&amp;#34;:&amp;#34;hello&amp;#34;}]}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id="3-codex-接入-deepseek官方一键脚本"&gt;3. Codex 接入 DeepSeek（官方一键脚本）&lt;a href="#3-codex-%e6%8e%a5%e5%85%a5-deepseek%e5%ae%98%e6%96%b9%e4%b8%80%e9%94%ae%e8%84%9a%e6%9c%ac" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;DeepSeek-V4-Flash 原生支持 Responses API 格式，官方针对 Codex 做了适配，并提供一键配置脚本（推荐方式）。&lt;/p&gt;</description></item><item><title>收尾：作品集、简历与面试准备</title><link>https://haokw.github.io/topics/final/</link><pubDate>Sat, 01 Aug 2026 00:00:00 +0800</pubDate><guid>https://haokw.github.io/topics/final/</guid><description>&lt;p&gt;本节汇总收尾阶段的成果：Portfolio README、简历、模拟面试记录与全部文章发布。&lt;/p&gt;</description></item><item><title>相关资源收集</title><link>https://haokw.github.io/topics/resources/</link><pubDate>Sat, 01 Aug 2026 00:00:00 +0800</pubDate><guid>https://haokw.github.io/topics/resources/</guid><description>&lt;p&gt;实战过程中持续收集的资料，按类别整理，随进度扩充。&lt;/p&gt;
&lt;h2 id="书籍"&gt;书籍&lt;a href="#%e4%b9%a6%e7%b1%8d" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;AI Agents in Action（第 2 版）&lt;/strong&gt;——从工程角度讲 Agent 架构、工具编排与生产实践，与实战路线对照学习
&lt;ul&gt;
&lt;li&gt;英文原版（Manning）：&lt;a
 href="https://www.manning.com/books/ai-agents-in-action-second-edition"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://www.manning.com/books/ai-agents-in-action-second-edition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;中文翻译（GitHub）：&lt;a
 href="https://github.com/yixiangshijie/ai-agents-in-action-2nd-edition-cn"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://github.com/yixiangshijie/ai-agents-in-action-2nd-edition-cn&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="官方文档按章节对应"&gt;官方文档（按章节对应）&lt;a href="#%e5%ae%98%e6%96%b9%e6%96%87%e6%a1%a3%e6%8c%89%e7%ab%a0%e8%8a%82%e5%af%b9%e5%ba%94" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;DeepSeek API Docs：&lt;a
 href="https://api-docs.deepseek.com/"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://api-docs.deepseek.com/&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;接入 Codex：&lt;a
 href="https://api-docs.deepseek.com/zh-cn/quick_start/agent_integrations/codex/"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://api-docs.deepseek.com/zh-cn/quick_start/agent_integrations/codex/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;OpenAI API Docs：&lt;a
 href="https://developers.openai.com/"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://developers.openai.com/&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;OpenAI Cookbook：&lt;a
 href="https://cookbook.openai.com/"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://cookbook.openai.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Agents SDK：&lt;a
 href="https://openai.github.io/openai-agents-python/"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://openai.github.io/openai-agents-python/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Anthropic Docs：&lt;a
 href="https://docs.anthropic.com/"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://docs.anthropic.com/&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Engineering Blog：&lt;a
 href="https://www.anthropic.com/engineering"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://www.anthropic.com/engineering&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MCP（Model Context Protocol）：&lt;a
 href="https://modelcontextprotocol.io/"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://modelcontextprotocol.io/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;LangGraph：&lt;a
 href="https://langchain-ai.github.io/langgraph/"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://langchain-ai.github.io/langgraph/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;FastAPI：&lt;a
 href="https://fastapi.tiangolo.com/"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://fastapi.tiangolo.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Hugging Face 文档与模型库：&lt;a
 href="https://huggingface.co/"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://huggingface.co/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="论文"&gt;论文&lt;a href="#%e8%ae%ba%e6%96%87" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;ReAct：&lt;a
 href="https://arxiv.org/abs/2210.03629"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://arxiv.org/abs/2210.03629&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Chain-of-Thought：&lt;a
 href="https://arxiv.org/abs/2201.11903"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://arxiv.org/abs/2201.11903&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Toolformer：&lt;a
 href="https://arxiv.org/abs/2302.04761"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://arxiv.org/abs/2302.04761&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;G-Eval（LLM-as-Judge）：&lt;a
 href="https://arxiv.org/abs/2303.16634"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://arxiv.org/abs/2303.16634&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="开源项目与工具"&gt;开源项目与工具&lt;a href="#%e5%bc%80%e6%ba%90%e9%a1%b9%e7%9b%ae%e4%b8%8e%e5%b7%a5%e5%85%b7" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;DeerFlow（Agent Harness 架构精读对象）：&lt;a
 href="https://github.com/bytedance/deer-flow"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://github.com/bytedance/deer-flow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Langfuse（Trace / 可观测性）：&lt;a
 href="https://github.com/langfuse/langfuse"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://github.com/langfuse/langfuse&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DeepEval（评测框架）：&lt;a
 href="https://github.com/confident-ai/deepeval"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://github.com/confident-ai/deepeval&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Ragas（RAG 评测）：&lt;a
 href="https://github.com/explodinggradients/ragas"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://github.com/explodinggradients/ragas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;promptfoo（评测 / 回归）：&lt;a
 href="https://github.com/promptfoo/promptfoo"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://github.com/promptfoo/promptfoo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;向量库：Chroma &lt;a
 href="https://github.com/chroma-core/chroma"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://github.com/chroma-core/chroma&lt;/a&gt;、FAISS &lt;a
 href="https://github.com/facebookresearch/faiss"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://github.com/facebookresearch/faiss&lt;/a&gt;、Milvus &lt;a
 href="https://github.com/milvus-io/milvus"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://github.com/milvus-io/milvus&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="路线图与免费课程"&gt;路线图与免费课程&lt;a href="#%e8%b7%af%e7%ba%bf%e5%9b%be%e4%b8%8e%e5%85%8d%e8%b4%b9%e8%af%be%e7%a8%8b" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;agentic-engineering-handbook（学习路线图）：&lt;a
 href="https://github.com/keyuchen21/agentic-engineering-handbook"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://github.com/keyuchen21/agentic-engineering-handbook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;W&amp;amp;B AI Engineering: Agents（免费课程）：&lt;a
 href="https://site.wandb.ai/courses/agents/"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://site.wandb.ai/courses/agents/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="社区"&gt;社区&lt;a href="#%e7%a4%be%e5%8c%ba" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;掘金（AI 工程实战文章）：&lt;a
 href="https://juejin.cn/"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://juejin.cn/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Hugging Face 论坛：&lt;a
 href="https://discuss.huggingface.co/"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://discuss.huggingface.co/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;本项目 GitHub：&lt;a
 href="https://github.com/haokw"
 
 
 class="link--external" target="_blank" rel="noreferrer"
 
&gt;https://github.com/haokw&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;链接会随学习进度持续扩充，欢迎通过 Issue 或评论区补充。&lt;/p&gt;</description></item><item><title>第 1 章：LLM API、Prompt、结构化输出 + LLM Gateway</title><link>https://haokw.github.io/topics/ch1/</link><pubDate>Sat, 01 Aug 2026 00:00:00 +0800</pubDate><guid>https://haokw.github.io/topics/ch1/</guid><description>&lt;p&gt;本章笔记与讲义：模型调用、Streaming、Structured Output、Prompt 工程与项目① LLM Gateway。&lt;/p&gt;
&lt;h2 id="课程讲义"&gt;课程讲义&lt;a href="#%e8%af%be%e7%a8%8b%e8%ae%b2%e4%b9%89" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id="1-llm-api-与模型调用基础"&gt;1. LLM API 与模型调用基础&lt;a href="#1-llm-api-%e4%b8%8e%e6%a8%a1%e5%9e%8b%e8%b0%83%e7%94%a8%e5%9f%ba%e7%a1%80" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Chat Completions / Responses API：请求结构（model、messages、temperature 等）、返回结构（choices、usage）&lt;/li&gt;
&lt;li&gt;模型参数：&lt;code&gt;temperature&lt;/code&gt;、&lt;code&gt;top_p&lt;/code&gt;、&lt;code&gt;max_tokens&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Token 与 Context Window：输入 + 输出都计费；超窗会报错或截断&lt;/li&gt;
&lt;li&gt;错误处理：超时、限流（429）、格式错误，需要重试与降级策略&lt;/li&gt;
&lt;li&gt;多模型调用：统一封装，屏蔽厂商差异&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;"&gt;&lt;tr&gt;&lt;td style="vertical-align:top;padding:0;margin:0;border:0;"&gt;
&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt; 1
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt; 2
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt; 3
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt; 4
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt; 5
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt; 6
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt; 7
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt; 8
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt; 9
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt;10
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt;11
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt;12
&lt;/span&gt;&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"&gt;13
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%"&gt;
&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;from&lt;/span&gt; openai &lt;span style="color:#f92672"&gt;import&lt;/span&gt; OpenAI
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;import&lt;/span&gt; os
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;client &lt;span style="color:#f92672"&gt;=&lt;/span&gt; OpenAI(
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; api_key&lt;span style="color:#f92672"&gt;=&lt;/span&gt;os&lt;span style="color:#f92672"&gt;.&lt;/span&gt;environ[&lt;span style="color:#e6db74"&gt;&amp;#34;DEEPSEEK_API_KEY&amp;#34;&lt;/span&gt;],
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; base_url&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://api.deepseek.com&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;resp &lt;span style="color:#f92672"&gt;=&lt;/span&gt; client&lt;span style="color:#f92672"&gt;.&lt;/span&gt;chat&lt;span style="color:#f92672"&gt;.&lt;/span&gt;completions&lt;span style="color:#f92672"&gt;.&lt;/span&gt;create(
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; model&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;deepseek-chat&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; messages&lt;span style="color:#f92672"&gt;=&lt;/span&gt;[{&lt;span style="color:#e6db74"&gt;&amp;#34;role&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;user&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;content&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;hello&amp;#34;&lt;/span&gt;}],
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;print(resp&lt;span style="color:#f92672"&gt;.&lt;/span&gt;choices[&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;]&lt;span style="color:#f92672"&gt;.&lt;/span&gt;message&lt;span style="color:#f92672"&gt;.&lt;/span&gt;content)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h3 id="2-prompt-engineering"&gt;2. Prompt Engineering&lt;a href="#2-prompt-engineering" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;System Prompt：设定全局行为（相当于岗位说明书）&lt;/li&gt;
&lt;li&gt;角色定义与行为约束：代码审查助手 / 分析师等&lt;/li&gt;
&lt;li&gt;输出风格控制：详细程度、语气、结构&lt;/li&gt;
&lt;li&gt;Few-shot：给 2~3 个「输入 → 输出」范例，格式敏感任务更有效&lt;/li&gt;
&lt;li&gt;任务拆解：复杂任务拆多步，降低幻觉率&lt;/li&gt;
&lt;li&gt;Prompt 模板：变量嵌入固定模板，可复用、可版本管理&lt;/li&gt;
&lt;li&gt;Prompt 注入风险：用户输入篡改指令的防护&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="3-structured-output结构化输出"&gt;3. Structured Output（结构化输出）&lt;a href="#3-structured-output%e7%bb%93%e6%9e%84%e5%8c%96%e8%be%93%e5%87%ba" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;为什么不能依赖自然语言解析：解析脆弱、无法校验&lt;/li&gt;
&lt;li&gt;JSON Schema：定义字段名、类型、必填&lt;/li&gt;
&lt;li&gt;Pydantic Model：定义结构 + 校验 + 反序列化&lt;/li&gt;
&lt;li&gt;模型原生结构化输出：API 层传 Schema，模型保证合规&lt;/li&gt;
&lt;li&gt;校验失败处理：错误反喂模型重试，多次失败降级回退&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="4-streaming流式输出"&gt;4. Streaming（流式输出）&lt;a href="#4-streaming%e6%b5%81%e5%bc%8f%e8%be%93%e5%87%ba" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;为什么需要：模型延迟高，串行等待体验差&lt;/li&gt;
&lt;li&gt;SSE：基于 HTTP 长连接的流式协议，实现打字机效果&lt;/li&gt;
&lt;li&gt;FastAPI &lt;code&gt;StreamingResponse&lt;/code&gt; 保持低延迟转发&lt;/li&gt;
&lt;li&gt;CLI/前端消费：逐块读取；用户可随时取消&lt;/li&gt;
&lt;li&gt;长文本断点：超出 Context Window 或断线时持久化状态&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="5-llm-gateway"&gt;5. LLM Gateway&lt;a href="#5-llm-gateway" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;统一 HTTP 入口，各组件无需各自维护 API Key&lt;/li&gt;
&lt;li&gt;OpenAI Compatible 协议，统一多厂商格式差异&lt;/li&gt;
&lt;li&gt;Streaming 代理、Structured Output 透传、Prompt 模板库&lt;/li&gt;
&lt;li&gt;错误重试与 fallback、Token/Cost/Latency 日志&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="6-阶段一项目llm-统一模型调用服务"&gt;6. 阶段一项目：LLM 统一模型调用服务&lt;a href="#6-%e9%98%b6%e6%ae%b5%e4%b8%80%e9%a1%b9%e7%9b%aellm-%e7%bb%9f%e4%b8%80%e6%a8%a1%e5%9e%8b%e8%b0%83%e7%94%a8%e6%9c%8d%e5%8a%a1" class="post-heading__anchor" aria-hidden="true"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;OpenAI Compatible API 接口&lt;/li&gt;
&lt;li&gt;多模型调用与模型路由&lt;/li&gt;
&lt;li&gt;Streaming 流式输出&lt;/li&gt;
&lt;li&gt;Structured Output 结构化输出&lt;/li&gt;
&lt;li&gt;Prompt 模板管理&lt;/li&gt;
&lt;li&gt;Token / Cost / Latency 记录&lt;/li&gt;
&lt;li&gt;基础错误处理、重试与限流&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>第 2 章：Function Calling、Tool Runtime、MCP</title><link>https://haokw.github.io/topics/ch2/</link><pubDate>Sat, 01 Aug 2026 00:00:00 +0800</pubDate><guid>https://haokw.github.io/topics/ch2/</guid><description>&lt;p&gt;本章的笔记与成果将在此汇总：Tool Registry、权限与审计、MCP 接入与项目① Tool Runtime。&lt;/p&gt;</description></item><item><title>第 3 章：Agent Loop、状态机、Codebase Agent</title><link>https://haokw.github.io/topics/ch3/</link><pubDate>Sat, 01 Aug 2026 00:00:00 +0800</pubDate><guid>https://haokw.github.io/topics/ch3/</guid><description>&lt;p&gt;本章的笔记与成果将在此汇总：Loop、Planning、Checkpoint、Sandbox、Harness 与项目② Codebase Agent。&lt;/p&gt;</description></item><item><title>第 4 章：Context Engineering、Memory、Codebase RAG</title><link>https://haokw.github.io/topics/ch4/</link><pubDate>Sat, 01 Aug 2026 00:00:00 +0800</pubDate><guid>https://haokw.github.io/topics/ch4/</guid><description>&lt;p&gt;本章的笔记与成果将在此汇总：Context 管理、记忆体系、混合检索 RAG 与项目② RAG &amp;amp; Memory。&lt;/p&gt;</description></item><item><title>第 5 章：Multi-Agent、Skill、Agent Eval</title><link>https://haokw.github.io/topics/ch5/</link><pubDate>Sat, 01 Aug 2026 00:00:00 +0800</pubDate><guid>https://haokw.github.io/topics/ch5/</guid><description>&lt;p&gt;本章的笔记与成果将在此汇总：多 Agent 协作、Skill 系统、Eval 平台与项目③ Eval。&lt;/p&gt;</description></item><item><title>第 6 章：工程化、生产部署、可观测性</title><link>https://haokw.github.io/topics/ch6/</link><pubDate>Sat, 01 Aug 2026 00:00:00 +0800</pubDate><guid>https://haokw.github.io/topics/ch6/</guid><description>&lt;p&gt;本章的笔记与成果将在此汇总：Docker Compose、Trace、灰度、成本治理与项目③ Production Ready。&lt;/p&gt;</description></item><item><title>第 7 章：DeerFlow 源码解析 + 深度研究平台</title><link>https://haokw.github.io/topics/ch7/</link><pubDate>Sat, 01 Aug 2026 00:00:00 +0800</pubDate><guid>https://haokw.github.io/topics/ch7/</guid><description>&lt;p&gt;本章的笔记与成果将在此汇总：DeerFlow 九条架构线精读、深度研究平台/软件工厂、开源 PR。&lt;/p&gt;</description></item></channel></rss>