Microsoft Agent Framework with Foundry Local: A Practical Guide to Building AI Agents Locally

[AI Readability Summary] Microsoft Agent Framework (MAF) orchestrates agent logic, while Foundry Local runs and serves models locally. Together, they solve a common problem: validating Microsoft’s agent stack without requiring an Azure environment. Keywords: Microsoft Agent Framework, Foundry Local, AI agent development.

The technical specification snapshot provides a quick overview

Parameter Description
Core framework Microsoft Agent Framework
Runtime mode Local execution + Python SDK
Primary languages Python, Shell
Model access protocol Local model service calls
Supported platform macOS (examples in this article)
Example model qwen3-0.6b
Core dependencies agent-framework, agent-framework-foundry-local
Source attribution Reconstructed from a CNBlogs post by aspnetx

This setup is well suited for quickly validating the Microsoft agent development workflow

MAF is Microsoft’s development framework for agent scenarios. It defines the agent name, instructions, message handling, and runtime flow. Foundry acts more like the platform layer that hosts models and operational capabilities. Together, they form a closed loop of development and execution.

The key value of this approach is that it does not depend on an Azure cloud environment. Instead, it uses Foundry Local to start the model directly on your machine. That makes it possible to validate Microsoft’s AI agent stack at low cost and compare it side by side with frameworks such as LangChain.

The commands for installing Foundry Local are straightforward

brew tap microsoft/foundrylocal
brew install foundrylocal

# Verify that the installation succeeded
foundry --version

# List available models
foundry model list

# List locally cached models
foundry cache list

These commands install Foundry Local, verify the version, and enumerate available models. They are the basic preparation steps before running an agent locally.

Foundry Local compresses model management and runtime into a local command workflow

From the user experience perspective, Foundry Local is similar to Ollama in some ways. Both emphasize bringing up local models, using command-line operations, and enabling fast experimentation. Microsoft’s advantage is that it sits naturally closer to its own agent development framework, which makes later integration with enterprise capabilities smoother.

If your goal is only to create a minimal runnable validation, starting a lightweight model is enough. The original article uses qwen3-0.6b for practical reasons: it is small, starts quickly, and works well for local demos.

# Download and run a lightweight model
foundry model run qwen3-0.6b

This command starts the local model service directly so the MAF client can connect to it later.

After installing the MAF dependencies, you can move into Python agent development

The MAF installation process is simple. The core package provides the Agent abstraction, and the Foundry Local integration package connects the local model service to the agent runtime pipeline. If you are not using OpenAI, you do not need any extra extensions here.

pip3 install agent-framework
pip3 install agent-framework-foundry-local

# Optional: OpenAI integration
pip3 install agent-framework-openai

These commands install the required dependencies for the Python development environment and provide the runtime foundation for creating your first agent.

The core structure of the first agent is very clear

The minimal MAF example has only three steps: create a model client, create an agent, and send a request to get a response. Its overall abstraction is close to mainstream LLM application frameworks, so developers with LangChain experience should find it easy to pick up.

from agent_framework import Agent
from agent_framework_foundry_local import FoundryLocalClient
import asyncio

# Create a local model client and connect to the model running in Foundry Local
client = FoundryLocalClient(
    model="qwen3-0.6b"  # Specify the model name to call
)

# Create the agent and set system-level instructions
agent = Agent(
    name="my-first-agent",
    client=client,
    instructions="You are a helpful assistant. Keep answers concise and accurate."  # Define the behavioral boundary of the agent
)

async def main():
    # Send a user request to the agent
    response = await agent.run("Write a Tang poem.")
    # Print the text returned by the model
    print("Agent reply:", response.text)

# Start the asynchronous main program
asyncio.run(main())

This code completes a minimal end-to-end agent loop: connect to a local model, define a role, execute one conversation, and return the text result.

The value of MAF lies in using a more stable abstraction to organize agent development workflows

From an engineering perspective, the point of MAF is not to create yet another chat interface. Instead, it structures the agent’s role, context, execution entry point, and model integration method. That makes the codebase clearer when you later expand into Tools, Skills, or multi-agent collaboration.

The original article also makes it clear that MAF is not conceptually far from LangChain. The differences are more about naming and how each framework connects to its official ecosystem. For teams already aligned with the Microsoft stack, that native consistency is often more attractive.

A typical runtime pipeline can be summarized as follows

Foundry Local starts the model
        ↓
FoundryLocalClient connects to the local model service
        ↓
Agent injects instructions and name
        ↓
agent.run() receives the user message
        ↓
response.text returns the result

This pipeline shows that Foundry Local is responsible for model availability, while MAF is responsible for agent orchestration.

The image content is decorative rather than a core technical diagram

WeChat share prompt

AI Visual Insight: This image is a blog page sharing prompt rather than a technical illustration. It does not show framework architecture, call flow, or model deployment details.

A local-first approach significantly lowers the learning and validation threshold

The most valuable aspect of this article is not that it demonstrates complex agent capabilities. It proves that Microsoft’s agent stack can already run a minimal working example locally. For individual developers, prototype validation, and technology evaluation, that is often more useful than high-level platform messaging.

If you are already familiar with Python asynchronous programming and the basics of LLMs, the entry cost for MAF is low. Your next areas of focus should be Tools, Skills, multi-turn context management, and deployment handoff to cloud-based Foundry.

FAQ

Q1: Can I still try Microsoft Agent Framework without an Azure account?

Yes. The example in the original article runs the model locally with Foundry Local and then calls it through MAF, so Azure is not required to get started.

Q2: How should I understand the relationship between MAF and LangChain?

Both provide abstractions for building LLM applications. MAF is closer to the Microsoft ecosystem, while LangChain has a more mature community. At the beginner level, their concepts and code organization patterns are clearly similar.

Q3: Why does the example use qwen3-0.6b?

Because it is relatively small and starts quickly, which makes it suitable for fast local validation of the installation pipeline, client connectivity, and basic agent invocation.

Core Summary: This article reconstructs the local development workflow for Microsoft Agent Framework and Foundry Local, covering macOS installation, model startup, Python agent creation, and runtime logic. It helps developers quickly validate Microsoft’s agent development approach without requiring an Azure environment.