Bumuo ng mga local-first AI agents na tumatakbo nang buong-buo sa isang developer workstation gamit ang Microsoft Foundry Local at Qwen function-calling models. Saklaw nito ang Small Language Models (SLMs), ang OpenAI-compatible na lokal na endpoint, sandboxed local tools, lokal na RAG gamit ang Chroma, lokal na MCP servers, hybrid cloud/local routing, at ang privacy/cost/offline trade-offs. Batay nang lokal, offline agent, on-device agent, Foundry Local, Qwen function calling, local tool calling, lokal na RAG, Chroma vector database, lokal na MCP server, privacy-preserving agent, hybrid local at cloud agent, small language model agent, engineering assistant (gamitin ang deploying-scalable-agents / Lesson 16), paggawa ng iyong unang agent concept (Lesson 01), Foundry (cloud) hosted agents, GPU cluster / server-side inference provisioning.'
npx skills add https://github.com/microsoft/ai-agents-for-beginners --skill local-ai-agents
> 與 第17課 – 創建本地 AI 代理 配套的技能。
> 用於幫助學習者構建一個能夠推理、調用工具並在他們自己的機器上完全獨立搜尋文檔的代理 — 無需雲端推論。所有建議均基於課程內容和可運行的筆記本。
>
學習者希望在以下情況下啟動此技能:
SLM 在範圍上做出取捨,換取隱私、成本和離線操作。取勝的策略是:讓 SLM 進行編排,工具來做重工作。 模型不需要<em>了解</em>代碼庫 — 它只需知道何時調用 read_file 和 search_docs。這發揮了 SLM 的優勢(有限決策如工具選擇),避開了它的弱點(廣泛知識,長距多跳推理)。
base_url(並使用本地占位 API 鍵)。它還會自動選擇機器上最佳的構建(CPU/GPU/NPU)。stdio 本地運行。foundry model run qwen2.5-7b-instruct
foundry service status
from foundry_local import FoundryLocalManager
from openai import OpenAI
manager = FoundryLocalManager("qwen2.5-7b-instruct")
client = OpenAI(base_url=manager.endpoint, api_key=manager.api_key) # 本地佔位符
~8 GB RAM 是現實可行的最低要求;GPU/NPU 有助於性能,但非必需。
引導學習者參考筆記本
17-local-agent-foundry-local.ipynb:
search_docs 回傳 top-k 區塊。stdio 連接本地服務器;限定專案目錄範圍並驗證其輸出。| 情況 | 運行位置 |
|-----------|---------------|
| 敏感資料/離線 | 本地 SLM |
| 簡單、有限任務 | 本地 SLM(便宜、快速) |
| 非敏感資料的複雜多跳推理 | 雲端模型 |
| 雲端故障 | 本地 SLM(優雅降級) |
這與第16課中的模型路由思路相呼應,工作站作為其中一條路由。設計優先考慮回退到本地,讓代理表現下降而非徹底失效。
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
免責聲明:
本文件使用 AI 翻譯服務 Co-op Translator 進行翻譯。雖然我們力求準確,但請注意,自動翻譯可能包含錯誤或不準確之處。原始文件的母語版本應被視為權威來源。對於重要資訊,建議尋求專業人工翻譯。我們不對因使用本翻譯而引起的任何誤解或曲解承擔責任。
<!-- CO-OP TRANSLATOR DISCLAIMER END -->
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
Access NCBI GEO for gene expression/genomics data. Search/download microarray and RNA-seq datasets (GSE, GSM, GPL), retrieve SOFT/Matrix files, for transcriptomics and expression analysis.
Bayesian modeling with PyMC. Build hierarchical models, MCMC (NUTS), variational inference, LOO/WAIC comparison, posterior checks, for probabilistic programming and inference.
Multi-objective optimization framework. NSGA-II, NSGA-III, MOEA/D, Pareto fronts, constraint handling, benchmarks (ZDT, DTLZ), for engineering design and optimization problems.
Statistical modeling toolkit. OLS, GLM, logistic, ARIMA, time series, hypothesis tests, diagnostics, AIC/BIC, for rigorous statistical inference and econometric analysis.
Add unsigned integer (uint) type support to PyTorch operators by updating AT_DISPATCH macros. Use when adding support for uint16, uint32, uint64 types to operators, kernels, or when user mentions enabling unsigned types, barebones unsigned types, or uint support.
Convert PyTorch AT_DISPATCH macros to AT_DISPATCH_V2 format in ATen C++ code. Use when porting AT_DISPATCH_ALL_TYPES_AND*, AT_DISPATCH_FLOATING_TYPES*, or other dispatch macros to the new v2 API. For ATen kernel files, CUDA kernels, and native operator implementations.
Write docstrings for PyTorch functions and methods following PyTorch conventions. Use when writing or updating docstrings in PyTorch code.
Take microsoft/ai-agents-for-beginners-.agents-local-ai-agents from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.