Run Microsoft Agent Framework Locally with Docker Model Runner
A hands-on example that runs fully offline: no API keys, no Azure login, just your machine and Docker Model Runner.
Five days ago, Microsoft released Microsoft Agent Framework (MAF), an SDK and runtime for building AI agents and multi-agent workflows in Python and .NET. It’s the successor to Semantic Kernel and AutoGen, merging their best ideas under a single, open-source framework.
I had to try it to see whether it could become Sentra Brain’s runtime, in the same way I’ve tested other contenders like Google’s ADK or Docker Model Runner. And honestly, despite many edge cases and untested features, it’s the most promising option I’ve seen so far. MAF runs locally, which aligns perfectly with Sentra’s principles of privacy, security, and compliance.
Here’s my first hands-on impression with a working example.
First Experiment: The Awakening
Here’s a minimal but complete agent built with MAF, connected to a local model served by Docker Model Runner.
Leaving aside cosmetic details, you only need this code:
.NET version:
// Default local config (DMR / vLLM style)
var baseUrl = config["OPENAI_API_BASE"] ?? "http://localhost:12434/engines/llama.cpp/v1";
var apiKey = config["OPENAI_API_KEY"] ?? "none";
var modelId = config["MODEL_ID"] ?? "ai/gpt-oss:latest";
Echo.System($"Endpoint: {baseUrl}");
Echo.System($"Model: {modelId}");
var options = new OpenAIClientOptions { Endpoint = new Uri(baseUrl) };
var credential = new ApiKeyCredential(apiKey);
var client = new OpenAIClient(credential, options);
var chatClient = client.GetChatClient(modelId);
var agent = chatClient.CreateAIAgent(
"You are a friendly local assistant running fully offline.",
"LocalAssistant");
// --- Synchronous Run ---
var userPrompt = "Explain in one line what a local AI agent is.";
Echo.User(userPrompt);
var result = await agent.RunAsync(userPrompt);
Echo.Agent(result.Text);
// --- Streaming Run ---
userPrompt = "Now explain it in a poetic way, with a sonnet, celebrating local intelligence.";
Echo.User(userPrompt);
await Echo.StreamAgentAsync(agent.RunStreamingAsync(userPrompt));
Note:
[Echo](http://labs/dotnet/Labs.Shared.Utils/Echo.cs)is an utility class I created to have an output like this one:

Python version:
async def main():
# Pull config from environment (defaults are for local DMR)
base_url = os.getenv("OPENAI_API_BASE", "http://localhost:12434/engines/llama.cpp/v1")
api_key = os.getenv("OPENAI_API_KEY", "none")
model_id = os.getenv("MODEL_ID", "ai/gpt-oss:latest")
print(f"🧠 Using Microsoft Agent Framework with local model: {model_id}")
print(f"📡 Endpoint: {base_url}")
async with ChatAgent(
chat_client=OpenAIChatClient(
base_url=base_url,
api_key=api_key,
model_id=model_id,
),
instructions="You are a friendly local assistant running using Docker Model Runner.",
) as agent:
# Interact
user_prompt = "Explain in one line what a local AI agent is."
# Run the agent synchronously:
result = await agent.run(user_prompt)
print("\n💬 User:", user_prompt)
print("🤖 Agent (sync answer):", result.text)
# Run the agent asynchronously (streaming):
user_prompt = "Now explain it in a poetic way, with a sonnet, considering the beauty of running it locally instead of relying on the cloud."
print("\n💬 User:", user_prompt)
print("🤖 Agent (streaming): \n", end="")
async for chunk in agent.run_stream(user_prompt):
if chunk.text:
print(chunk.text, end="")
print("")
Navigating the trade-offs
There’s no shortage of “agent orchestration” frameworks claiming declarative simplicity or tool abstraction. I’ve tried many of them and none found the balance between versatility, robustness, observability, and privacy I am seeking for. To combine all those traits in a single SDK is hard, especially in a field as young as the “agentic” one. Still, MAF stands out for a few practical reasons:
-
It’s the first agent framework from a major vendor supporting Python and .NET equally.
-
It’s open source and runs fully offline.
-
It supports MCP for tool invocation and graph-based workflows for orchestration.
-
It’s the natural evolution of two promissing SDK’s, Microsoft’s own Semantic Kernel + AutoGen efforts, now unified.
For me, MAF isn’t just another SDK. It’s a genuine runtime candidate for Sentra Brain, the private AI platform for SMEs I am building in my “free time”. Think of it as RAG, local copilots, and custom agents with visual workflow editors.
The Repository
You can reproduce these examples yourself, as well as the research and PoCs that are about to come, here:
https://github.com/juangcarmona/ms-agent-framework-playground
References & Further Reading
-
Microsoft Agent Framework (MAF): unified SDK and runtime for building AI agents and multi-agent workflows with Python and .NET.
-
Semantic Kernel: Microsoft’s open-source SDK for connecting LLMs with memory, skills, and planning.
-
AutoGen (Microsoft Research): framework for multi-agent coordination and conversational task automation.
-
Docker cagent: declarative framework to define and run AI agents in YAML.
-
Docker Model Runner (DMR): local LLM runtime supporting OpenAI-compatible APIs and GPU acceleration.
-
What is Docker cagent? A First Look at Declarative AI Agents: introduction to YAML-defined agents.
-
AI Agents in a Nutshell: conceptual overview of reasoning, memory, and goal-driven loops.
-
Teaching Agents to Remember: Memory in Docker cagent: enabling persistence and context recall.
-
Teaching Agents to Act: Tools in Docker cagent: extending agents with external tool execution.
-
Running Models Locally with Docker Model Runner: fully local GPU-backed model execution walk-through.