[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M699CZP34NXNF5KTP5J4ZN63":3,"skill-same:01M699CZP34NXNF5KTP5J4ZN63":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":26,"publishedAt":36,"linkOnly":37,"markdownContent":38,"markdownBody":39,"frontMatter":40,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":44,"repositoryHtmlUrl":45,"repositoryHomepageUrl":46,"ownerHtmlUrl":47,"ownerBlogUrl":48,"ownerDescription":49,"updatedAt":50,"install":51,"resources":64},"01M699CZP34NXNF5KTP5J4ZN63","local-ai-agents",null,"Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud\u002Flocal routing, and the privacy\u002Fcost\u002Foffline trade-offs. Based on Lesson 17 of AI Agents for Beginners. USE FOR: run an agent locally, offline agent, on-device agent, Foundry Local, Qwen function calling, local tool calling, local RAG, Chroma vector database, local MCP server, privacy-preserving agent, hybrid local and cloud agent, small language model agent, engineering assistant on my machine. DO NOT USE FOR: deploying agents to the cloud at scale (use deploying-scalable-agents \u002F Lesson 16), building your first agent concept (Lesson 01), Foundry (cloud) hosted agents, GPU cluster \u002F server-side inference provisioning.","microsoft\u002Fai-agents-for-beginners","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M6998ZK2275KMJE6Y5SEA2X2",79423,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fai-agents-for-beginners\u002Fblob\u002Fmain\u002Ftranslations\u002Fen\u002F.agents\u002Fskills\u002Flocal-ai-agents\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[27,28,29,30,31,32,9,33,34,35],"ai agents","local ai agents","MCP","assistant","inference","mcp server","foundry","foundry local","microsoft foundry","2026-11-10 10:12:30",false,"---\nname: local-ai-agents\nlicense: MIT\ndescription: 'Build local-first AI agents that run entirely on a developer workstation\n  with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language\n  Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local\n  RAG with Chroma, local MCP servers, hybrid cloud\u002Flocal routing, and the privacy\u002Fcost\u002Foffline\n  trade-offs. Based on Lesson 17 of AI Agents for Beginners. USE FOR: run an agent\n  locally, offline agent, on-device agent, Foundry Local, Qwen function calling, local\n  tool calling, local RAG, Chroma vector database, local MCP server, privacy-preserving\n  agent, hybrid local and cloud agent, small language model agent, engineering assistant\n  on my machine. DO NOT USE FOR: deploying agents to the cloud at scale (use deploying-scalable-agents\n  \u002F Lesson 16), building your first agent concept (Lesson 01), Foundry (cloud) hosted\n  agents, GPU cluster \u002F server-side inference provisioning.'\n---\n# Creating Local AI Agents with Foundry Local and Qwen\n\n> Companion skill for [Lesson 17 – Creating Local AI Agents](..\u002F..\u002F..\u002F17-creating-local-ai-agents\u002FREADME.md).\n> Use it to help a learner build an agent that reasons, calls tools, and searches\n> documentation entirely on their own machine — no cloud inference. Ground every\n> recommendation in the lesson content and the runnable notebook.\n\n## Triggers\n\nActivate this skill when a learner wants to:\n- Run an agent **fully on-device** for privacy, cost, or offline reasons.\n- Serve a model locally with **Foundry Local** and connect via the OpenAI-compatible endpoint.\n- Use a **Qwen function-calling** model to drive reliable local tool calls.\n- Add **local RAG** (Chroma) or a **local MCP server**.\n- Design a **hybrid** local\u002Fcloud routing strategy.\n\n## Core mental model\n\nAn SLM trades breadth for privacy, cost, and offline operation. The winning\nstrategy: **let the SLM orchestrate and let tools do the heavy lifting.** The\nmodel does not need to *know* the codebase — it needs to know when to call\n`read_file` and `search_docs`. That plays to an SLM's strength (bounded decisions\nlike tool selection) and away from its weakness (broad knowledge, long multi-hop\nreasoning).\n\n## Why these specific pieces\n\n- **Foundry Local** exposes an **OpenAI-compatible HTTP endpoint**, so cloud agent code transfers by changing only `base_url` (and using a local placeholder API key). It also auto-selects the best build (CPU\u002FGPU\u002FNPU) for the machine.\n- **Qwen** models are trained for function calling and emit well-formed tool calls consistently — this is what turns a local *chat* model into a local *agent*.\n- **Chroma** runs in-process and stores vectors on disk, so the whole RAG pipeline (embed → store → retrieve → reason) stays local.\n- **MCP** is a transport, not a cloud service: an MCP server can run locally over `stdio`.\n\n## Setup essentials\n\n```bash\nfoundry model run qwen2.5-7b-instruct\nfoundry service status\n```\n\n```python\nfrom foundry_local import FoundryLocalManager\nfrom openai import OpenAI\n\nmanager = FoundryLocalManager(\"qwen2.5-7b-instruct\")\nclient = OpenAI(base_url=manager.endpoint, api_key=manager.api_key)  # local placeholder\n```\n\n~8 GB RAM is a realistic minimum; a GPU\u002FNPU helps but is not required.\n\n## Key patterns to reproduce\n\nPoint the learner at the notebook\n[`17-local-agent-foundry-local.ipynb`](..\u002F..\u002F..\u002F17-creating-local-ai-agents\u002Fcode_samples\u002F17-local-agent-foundry-local.ipynb):\n\n- **Sandboxed tools**: every file tool resolves paths and rejects anything outside a single project root — even locally, a tool runs with the user's permissions.\n- **Tool-calling loop**: register tools with the OpenAI tools schema, execute requested tools locally, feed results back, repeat until a final answer.\n- **Local RAG**: upsert docs into a Chroma collection; `search_docs` returns top-k chunks.\n- **Local MCP**: connect to a local server over `stdio`; scope it to a project directory and validate its outputs.\n\n## Hybrid routing (local as one of the models)\n\n| Situation | Where it runs |\n|-----------|---------------|\n| Sensitive data \u002F offline | Local SLM |\n| Simple, bounded task | Local SLM (cheap, fast) |\n| Hard multi-hop reasoning on non-sensitive data | Cloud model |\n| Cloud outage | Local SLM (graceful degradation) |\n\nThis mirrors the model-routing idea from Lesson 16, with the workstation as one\nof the routes. Prefer designs that fall back to local so the agent degrades in\nquality rather than failing outright.\n\n## Guardrails for the assistant\n\n- Keep every file\u002Ftool operation scoped to a sandboxed project directory.\n- Do not send code or data to the cloud when the learner's stated goal is privacy\u002Foffline — keep the whole pipeline local.\n- Set realistic expectations for SLM quality; lean on tools and RAG rather than the model's memorised knowledge.\n- Note that Lesson 17 has **no** Foundry Responses endpoint, so the cloud smoke-test action does not apply — validate by running the notebook locally.\n\n---\n\n\u003C!-- CO-OP TRANSLATOR DISCLAIMER START -->\n**Disclaimer**:\nThis document has been translated using AI translation service [Co-op Translator](https:\u002F\u002Fgithub.com\u002FAzure\u002Fco-op-translator). While we strive for accuracy, please be aware that automated translations may contain errors or inaccuracies. The original document in its native language should be considered the authoritative source. For critical information, professional human translation is recommended. We are not liable for any misunderstandings or misinterpretations arising from the use of this translation.\n\u003C!-- CO-OP TRANSLATOR DISCLAIMER END -->","# Creating Local AI Agents with Foundry Local and Qwen\n\n> Companion skill for [Lesson 17 – Creating Local AI Agents](..\u002F..\u002F..\u002F17-creating-local-ai-agents\u002FREADME.md).\n> Use it to help a learner build an agent that reasons, calls tools, and searches\n> documentation entirely on their own machine — no cloud inference. Ground every\n> recommendation in the lesson content and the runnable notebook.\n\n## Triggers\n\nActivate this skill when a learner wants to:\n- Run an agent **fully on-device** for privacy, cost, or offline reasons.\n- Serve a model locally with **Foundry Local** and connect via the OpenAI-compatible endpoint.\n- Use a **Qwen function-calling** model to drive reliable local tool calls.\n- Add **local RAG** (Chroma) or a **local MCP server**.\n- Design a **hybrid** local\u002Fcloud routing strategy.\n\n## Core mental model\n\nAn SLM trades breadth for privacy, cost, and offline operation. The winning\nstrategy: **let the SLM orchestrate and let tools do the heavy lifting.** The\nmodel does not need to *know* the codebase — it needs to know when to call\n`read_file` and `search_docs`. That plays to an SLM's strength (bounded decisions\nlike tool selection) and away from its weakness (broad knowledge, long multi-hop\nreasoning).\n\n## Why these specific pieces\n\n- **Foundry Local** exposes an **OpenAI-compatible HTTP endpoint**, so cloud agent code transfers by changing only `base_url` (and using a local placeholder API key). It also auto-selects the best build (CPU\u002FGPU\u002FNPU) for the machine.\n- **Qwen** models are trained for function calling and emit well-formed tool calls consistently — this is what turns a local *chat* model into a local *agent*.\n- **Chroma** runs in-process and stores vectors on disk, so the whole RAG pipeline (embed → store → retrieve → reason) stays local.\n- **MCP** is a transport, not a cloud service: an MCP server can run locally over `stdio`.\n\n## Setup essentials\n\n```bash\nfoundry model run qwen2.5-7b-instruct\nfoundry service status\n```\n\n```python\nfrom foundry_local import FoundryLocalManager\nfrom openai import OpenAI\n\nmanager = FoundryLocalManager(\"qwen2.5-7b-instruct\")\nclient = OpenAI(base_url=manager.endpoint, api_key=manager.api_key)  # local placeholder\n```\n\n~8 GB RAM is a realistic minimum; a GPU\u002FNPU helps but is not required.\n\n## Key patterns to reproduce\n\nPoint the learner at the notebook\n[`17-local-agent-foundry-local.ipynb`](..\u002F..\u002F..\u002F17-creating-local-ai-agents\u002Fcode_samples\u002F17-local-agent-foundry-local.ipynb):\n\n- **Sandboxed tools**: every file tool resolves paths and rejects anything outside a single project root — even locally, a tool runs with the user's permissions.\n- **Tool-calling loop**: register tools with the OpenAI tools schema, execute requested tools locally, feed results back, repeat until a final answer.\n- **Local RAG**: upsert docs into a Chroma collection; `search_docs` returns top-k chunks.\n- **Local MCP**: connect to a local server over `stdio`; scope it to a project directory and validate its outputs.\n\n## Hybrid routing (local as one of the models)\n\n| Situation | Where it runs |\n|-----------|---------------|\n| Sensitive data \u002F offline | Local SLM |\n| Simple, bounded task | Local SLM (cheap, fast) |\n| Hard multi-hop reasoning on non-sensitive data | Cloud model |\n| Cloud outage | Local SLM (graceful degradation) |\n\nThis mirrors the model-routing idea from Lesson 16, with the workstation as one\nof the routes. Prefer designs that fall back to local so the agent degrades in\nquality rather than failing outright.\n\n## Guardrails for the assistant\n\n- Keep every file\u002Ftool operation scoped to a sandboxed project directory.\n- Do not send code or data to the cloud when the learner's stated goal is privacy\u002Foffline — keep the whole pipeline local.\n- Set realistic expectations for SLM quality; lean on tools and RAG rather than the model's memorised knowledge.\n- Note that Lesson 17 has **no** Foundry Responses endpoint, so the cloud smoke-test action does not apply — validate by running the notebook locally.\n\n---\n\n\u003C!-- CO-OP TRANSLATOR DISCLAIMER START -->\n**Disclaimer**:\nThis document has been translated using AI translation service [Co-op Translator](https:\u002F\u002Fgithub.com\u002FAzure\u002Fco-op-translator). While we strive for accuracy, please be aware that automated translations may contain errors or inaccuracies. The original document in its native language should be considered the authoritative source. For critical information, professional human translation is recommended. We are not liable for any misunderstandings or misinterpretations arising from the use of this translation.\n\u003C!-- CO-OP TRANSLATOR DISCLAIMER END -->",{"name":5,"license":15,"description":7},"main","f09e94ffe170f8af6d3db7c42987bbe4db227723","translations\u002Fen\u002F.agents\u002Fskills\u002Flocal-ai-agents",26019,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fai-agents-for-beginners","https:\u002F\u002Faka.ms\u002Fai-agents-beginners","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-07 12:51:12",{"source":8,"skillName":5,"commands":52,"prompt":62,"zipAvailable":63},[53,56,59],{"tool":54,"command":55},"npx","npx skills add microsoft\u002Fai-agents-for-beginners --skill local-ai-agents",{"tool":57,"command":58},"bunx","bunx skills add microsoft\u002Fai-agents-for-beginners --skill local-ai-agents",{"tool":60,"command":61},"pnpm","pnpm dlx skills add microsoft\u002Fai-agents-for-beginners --skill local-ai-agents","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fai-agents-for-beginners\u002Fblob\u002Fmain\u002Ftranslations\u002Fen\u002F.agents\u002Fskills\u002Flocal-ai-agents\u002FSKILL.md",true,[65,71],{"path":66,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":69,"sourceHtmlUrl":70},"checklist.md","REFERENCE","参考文档",1496,"https:\u002F\u002Fgithub.com\u002Fsherryswift1019-gif\u002FAI-DZHT\u002Fblob\u002Fmain\u002F_bmad\u002Fbmm\u002F4-implementation\u002Fbmad-qa-test-strategy\u002Fchecklist.md",{"path":72,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":73,"sourceHtmlUrl":74},"workflow.md",5168,"https:\u002F\u002Fgithub.com\u002Fsherryswift1019-gif\u002FAI-DZHT\u002Fblob\u002Fmain\u002F_bmad\u002Fbmm\u002F4-implementation\u002Fbmad-qa-test-strategy\u002Fworkflow.md",[76,92,101,106,114,121],{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":89,"publishedAt":36},"01M69A206TRZ8KK0CW0HYJF5V5","testing-course-samples","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fai-agents-for-beginners\u002Fblob\u002Fmain\u002Ftranslations\u002Fzh-TW\u002F.agents\u002Fskills\u002Ftesting-course-samples\u002FSKILL.md",[81,84],{"categoryNo":82,"categoryName":83,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":85,"categoryName":86,"taxonomyType":87,"taxonomyTypeDesc":88},"01JBSEEDCAT000000000000039","教师与教育","PROFESSION","适用职业",[90,91],"testing","testing course samples",{"skillNo":93,"name":94,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":98,"publishedAt":36},"01M69A1XRB2SFHYRMEH0K08EKZ","microsoft-docs","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fai-agents-for-beginners\u002Fblob\u002Fmain\u002Ftranslations\u002Fzh-TW\u002F.agents\u002Fskills\u002Fmicrosoft-docs\u002FSKILL.md",[97],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[99,9,100],"docs","microsoft docs",{"skillNo":102,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":36},"01M69A1VPZFJQ1HNGTZQ5P3WSC","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fai-agents-for-beginners\u002Fblob\u002Fmain\u002Ftranslations\u002Fzh-TW\u002F.agents\u002Fskills\u002Flocal-ai-agents\u002FSKILL.md",[],[27,28],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":36},"01M69A1S947N7MM6V9JF85S2E7","jupyter-notebook","當使用者要求建立、搭建或編輯 Jupyter 筆記本（`.ipynb`）用於實驗、探索或教學時使用；優先使用隨附範本並執行輔助腳本 `new_notebook.py` 來產生一個乾淨的起始筆記本。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fai-agents-for-beginners\u002Fblob\u002Fmain\u002Ftranslations\u002Fzh-TW\u002F.agents\u002Fskills\u002Fjupyter-notebook\u002FSKILL.md",[],[113],"jupyter notebook",{"skillNo":115,"name":116,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":36},"01M69A1Q8EXPWKZSQK69V6WF22","deploying-scalable-agents","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fai-agents-for-beginners\u002Fblob\u002Fmain\u002Ftranslations\u002Fzh-TW\u002F.agents\u002Fskills\u002Fdeploying-scalable-agents\u002FSKILL.md",[],[120],"deploying scalable agents",{"skillNo":122,"name":123,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":36},"01M69A1MHZTH3RH9N8VYSYG74X","azure-openai-to-responses","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fai-agents-for-beginners\u002Fblob\u002Fmain\u002Ftranslations\u002Fzh-TW\u002F.agents\u002Fskills\u002Fazure-openai-to-responses\u002FSKILL.md",[],[127],"azure openai to responses"]