[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6999BV7RTRQX8PDA2P1ZE4J":3,"skill-same:01M6999BV7RTRQX8PDA2P1ZE4J":79},{"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},"01M6999BV7RTRQX8PDA2P1ZE4J","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",79626,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fai-agents-for-beginners\u002Fblob\u002Fmain\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\ndescription: >-\n  Build local-first AI agents that run entirely on a developer workstation with\n  Microsoft Foundry Local and Qwen function-calling models. Covers Small Language\n  Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools,\n  local RAG with Chroma, local MCP servers, hybrid cloud\u002Flocal routing, and the\n  privacy\u002Fcost\u002Foffline trade-offs. Based on Lesson 17 of AI Agents for Beginners.\n  USE FOR: run an agent locally, offline agent, on-device agent, Foundry Local,\n  Qwen function calling, local tool calling, local RAG, Chroma vector database,\n  local MCP server, privacy-preserving agent, hybrid local and cloud agent,\n  small language model agent, engineering assistant on my machine.\n  DO NOT USE FOR: deploying agents to the cloud at scale (use deploying-scalable-agents \u002F\n  Lesson 16), building your first agent concept (Lesson 01), Foundry (cloud) hosted\n  agents, GPU cluster \u002F server-side inference provisioning.\nlicense: MIT\n---\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","# 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",{"name":5,"license":15,"description":7},"main","f09e94ffe170f8af6d3db7c42987bbe4db227723",".agents\u002Fskills\u002Flocal-ai-agents",26075,"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\u002F.agents\u002Fskills\u002Flocal-ai-agents\u002FSKILL.md",true,[65,71,75],{"path":66,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":69,"sourceHtmlUrl":70},"agents\u002Fopenai.yaml","REFERENCE","参考文档",272,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fopc-methodology\u002Fskills\u002Fopc-conversion-loop\u002Fagents\u002Fopenai.yaml",{"path":72,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Fchannel-playbook.md",174,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fopc-methodology\u002Fskills\u002Fopc-conversion-loop\u002Freferences\u002Fchannel-playbook.md",{"path":76,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002Fconversion-patterns.md",213,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fopc-methodology\u002Fskills\u002Fopc-conversion-loop\u002Freferences\u002Fconversion-patterns.md",[80,96,105,110,118,125],{"skillNo":81,"name":82,"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":83,"categories":84,"keywords":93,"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",[85,88],{"categoryNo":86,"categoryName":87,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":89,"categoryName":90,"taxonomyType":91,"taxonomyTypeDesc":92},"01JBSEEDCAT000000000000039","教师与教育","PROFESSION","适用职业",[94,95],"testing","testing course samples",{"skillNo":97,"name":98,"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":99,"categories":100,"keywords":102,"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",[101],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[103,9,104],"docs","microsoft docs",{"skillNo":106,"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":107,"categories":108,"keywords":109,"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":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"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",[],[117],"jupyter notebook",{"skillNo":119,"name":120,"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":121,"categories":122,"keywords":123,"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",[],[124],"deploying scalable agents",{"skillNo":126,"name":127,"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":128,"categories":129,"keywords":130,"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",[],[131],"azure openai to responses"]