local-ai-agents

Créez des agents IA local-first qui s'exécutent entièrement sur une station de travail de développeur avec Microsoft Foundry Local et les modèles d'appel de fonctions Qwen. Couvre les petits modèles de langage…

npx skills add https://github.com/microsoft/ai-agents-for-beginners --skill local-ai-agents

Creating Local AI Agents with Foundry Local and Qwen

Companion skill for Lesson 17 – Creating Local AI Agents. Use it to help a learner build an agent that reasons, calls tools, and searches documentation entirely on their own machine — no cloud inference. Ground every recommendation in the lesson content and the runnable notebook.

Triggers

Activate this skill when a learner wants to:

  • Run an agent fully on-device for privacy, cost, or offline reasons.
  • Serve a model locally with Foundry Local and connect via the OpenAI-compatible endpoint.
  • Use a Qwen function-calling model to drive reliable local tool calls.
  • Add local RAG (Chroma) or a local MCP server.
  • Design a hybrid local/cloud routing strategy.

Core mental model

An SLM trades breadth for privacy, cost, and offline operation. The winning strategy: let the SLM orchestrate and let tools do the heavy lifting. The model does not need to know the codebase — it needs to know when to call read_file and search_docs. That plays to an SLM's strength (bounded decisions like tool selection) and away from its weakness (broad knowledge, long multi-hop reasoning).

Why these specific pieces

  • 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/GPU/NPU) for the machine.
  • 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.
  • Chroma runs in-process and stores vectors on disk, so the whole RAG pipeline (embed → store → retrieve → reason) stays local.
  • MCP is a transport, not a cloud service: an MCP server can run locally over stdio.

Setup essentials

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)  # local placeholder

~8 GB RAM is a realistic minimum; a GPU/NPU helps but is not required.

Key patterns to reproduce

Point the learner at the notebook 17-local-agent-foundry-local.ipynb:

  • 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.
  • Tool-calling loop: register tools with the OpenAI tools schema, execute requested tools locally, feed results back, repeat until a final answer.
  • Local RAG: upsert docs into a Chroma collection; search_docs returns top-k chunks.
  • Local MCP: connect to a local server over stdio; scope it to a project directory and validate its outputs.

Hybrid routing (local as one of the models)

SituationWhere it runs
Sensitive data / offlineLocal SLM
Simple, bounded taskLocal SLM (cheap, fast)
Hard multi-hop reasoning on non-sensitive dataCloud model
Cloud outageLocal SLM (graceful degradation)

This mirrors the model-routing idea from Lesson 16, with the workstation as one of the routes. Prefer designs that fall back to local so the agent degrades in quality rather than failing outright.

Guardrails for the assistant

  • Keep every file/tool operation scoped to a sandboxed project directory.
  • Do not send code or data to the cloud when the learner's stated goal is privacy/offline — keep the whole pipeline local.
  • Set realistic expectations for SLM quality; lean on tools and RAG rather than the model's memorised knowledge.
  • Note that Lesson 17 has no Foundry Responses endpoint, so the cloud smoke-test action does not apply — validate by running the notebook locally.

Plus de skills de microsoft

oss-growth
microsoft
Persona de growth hacker OSS
agent-framework-azure-ai-py
microsoft
Créez des agents Azure AI Foundry à l’aide du SDK Python Microsoft Agent Framework (agent-framework-azure-ai). À utiliser lors de la création d’agents persistants avec AzureAIAgentsProvider, de l’utilisation d’outils hébergés (interpréteur de code, recherche de fichiers, recherche web), de l’intégration de serveurs MCP, de la gestion de fils de conversation ou de l’implémentation de réponses en streaming. Couvre les outils de fonction, les sorties structurées et les agents multi-outils.
development
airunway-aks-setup
microsoft
Configurez AI Runway sur AKS — du cluster nu au modèle en cours d'exécution. Couvre la vérification du cluster, l'installation du contrôleur, l'évaluation GPU, la configuration du fournisseur et le premier déploiement. QUAND : « configurer AI Runway », « intégrer un cluster AKS », « installer AI Runway », « configuration airunway », « déployer un modèle sur AKS », « inférence GPU sur AKS », « configuration KAITO sur AKS », « exécuter LLM sur AKS », « vLLM sur AKS », « configurer le service de modèles sur AKS », « contrôleur AI Runway ».
devops
appinsights-instrumentation
microsoft
Guidance for instrumenting webapps with Azure Application Insights. Provides telemetry patterns, SDK setup, and configuration references. WHEN: how to instrument app, App Insights SDK, telemetry patterns, what is App Insights, Application Insights guidance, instrumentation examples, APM best practices.
devops
applicationinsights-web-ts
microsoft
Instrumentez les applications navigateur/web avec le SDK JavaScript Application Insights (@microsoft/applicationinsights-web). Utilisez-le pour la surveillance des utilisateurs réels (RUM) — vues de page, clics, dépendances AJAX/fetch, exceptions, événements personnalisés et traces d’agents GenAI côté navigateur corrélées aux traces OpenTelemetry backend. Couvre le script de chargement du SDK et la configuration npm, les extensions de framework (React, React Native, Angular), Click Analytics, les initialiseurs de télémétrie et les conventions sémantiques OTel GenAI pour les spans d’agents/outils/modèles émises depuis le navigateur.
devops
azure-ai-anomalydetector-java
microsoft
Créez des applications de détection d'anomalies avec le SDK Azure AI Anomaly Detector pour Java. Utilisez-le lors de l'implémentation de la détection d'anomalies univariées/multivariées, de l'analyse de séries temporelles ou de la surveillance basée sur l'IA.
development
azure-ai-language-conversations-py
microsoft
Implémentez la compréhension du langage conversationnel (CLU) à l’aide du SDK Python azure-ai-language-conversations. Utilisez-le lorsque vous travaillez avec ConversationAnalysisClient pour analyser l’intention et les entités d’une conversation, créer des fonctionnalités de NLP ou intégrer la compréhension du langage dans des applications.
development
azure-ai-ml-py
microsoft
SDK v2 d’Azure Machine Learning pour Python. Utiliser pour les espaces de travail ML, les tâches, les modèles, les jeux de données, le calcul et les pipelines. Déclencheurs : « azure-ai-ml », « MLClient », « espace de travail », « registre de modèles », « tâches d’entraînement », « jeux de données ».
development