A progressive series of .NET console applications demonstrating key concepts of the Microsoft Agent Framework. Each demo builds on the previous one, introducing new capabilities step-by-step.
- Setting up AI agents with streaming responses
- Managing conversation sessions
- Adding function calling (tools) to extend agent capabilities
- Implementing middleware for content filtering
- Building multi-agent workflows
- .NET 10 SDK
- An Azure OpenAI resource (for demos 2 & 3) OR GitHub Models API access (for demo 1)
- Azure CLI (for authentication):
az login
agent-framework-demos/
├── source/
│ ├── 1-HelloAgent/ # Basic agent with streaming
│ ├── 2-Extending/ # Tools + middleware
│ └── 3-Workflow/ # Multi-agent workflows
└── agent-framework-demos.sln # Solution file
Concepts: Agent setup, streaming responses, session management, interactive REPL
A frozen yogurt recommendation chatbot that demonstrates:
- Creating an AI agent with custom instructions
- Streaming responses token-by-token
- Maintaining conversation context with
AgentSession - Building a simple command-line interface
Configuration: Uses GitHub Models (OpenAI) by default
Concepts: Function calling, middleware pipeline, content filtering
Extends the froyo agent with:
- Tools (Function Calling): Calls a
ListFlavors()function to get real-time inventory - Middleware: Filters forbidden words from input/output using a custom pipeline
- Local functions for helper logic
Configuration: Uses Azure OpenAI with Azure CLI authentication
Concepts: Agentic workflows, agent composition, order processing pipeline
A multi-step order processing system with:
- Order Intake Agent: Validates orders against business rules
- Froyo Recommender Agent: Product recommendations
- Demonstrates how agents can work together in a workflow
Configuration: Uses Azure OpenAI with Azure CLI authentication
git clone https://github.com/mcollier/agent-framework-demos.git
cd agent-framework-demosEach demo has an appsettings.json file. Copy it to appsettings.Development.json and add your credentials:
{
"OpenAI": {
"Endpoint": "https://models.github.ai/inference",
"DeploymentName": "openai/gpt-5-chat",
"Key": "YOUR_GITHUB_PAT_HERE"
}
}{
"AzureOpenAI": {
"Endpoint": "https://YOUR_RESOURCE.openai.azure.com/",
"DeploymentName": "gpt-4o-mini"
}
}Note:
appsettings.Development.jsonis git-ignored to keep secrets out of source control.
az loginThe demos use AzureCliCredential for passwordless authentication.
Navigate to each demo folder and run:
cd source/1-HelloAgent
dotnet run
# Then try the others
cd ../2-Extending
dotnet run
cd ../3-Workflow
dotnet runType exit or press Enter on an empty line to quit.
An AI Agent combines an LLM with instructions, tools, and state management to perform tasks autonomously.
AIAgent agent = chatClient
.AsAIAgent(
instructions: "You're a helpful assistant...",
name: "MyAgent",
tools: [...]);AgentSession maintains conversation history across multiple turns:
AgentSession session = await agent.CreateSessionAsync();
await agent.RunAsync("What's the weather?", session);
await agent.RunAsync("How about tomorrow?", session); // Remembers contextTools let agents call .NET functions to access external data:
AIFunctionFactory.Create(ListFlavorsTool.ListFlavors)The agent decides when to call functions based on the conversation.
Middleware intercepts messages before/after the agent runs:
var agentWithMiddleware = agent
.AsBuilder()
.Use(runFunc: FilterContentMiddleware)
.Build();Orchestrate multiple agents to handle complex, multi-step tasks (see Demo 3).
- Add your own tools: Extend agents with custom functions
- Experiment with prompts: Modify instructions to change agent behavior
- Deploy to production: Package as a web API or Azure Function
- Explore Microsoft Foundry: Deploy and evaluate agents at scale
This project is licensed under the MIT License - see the LICENSE file for details.