![]() |
| https://www.pexels.com/photo/person-sitting-on-brown-box-1320737/ |
Recently, I have blogged about the different features of Microsoft Agent Framework (MAF). You can find the posts below:
- Microsoft Agent Framework: function as tool, agent as tool
- Microsoft Agent Framework: Middleware
- Microsoft Agent Framework: Sequential Flow
- Microsoft Agent Framework: Concurrent Agent Executors
- Microsoft Agent Framework: Fan In and Fan Out
- Microsoft Agent Framework: Custom Context Provider
- Microsoft Agent Framework: Multi-Turn Conversation
- Microsoft Agent Framework: Workflow (Intent Detection)
You can also find the sample code in the maf-workflow GitHub repository
These posts explore how MAF helps implement practical patterns that appear in agent-based systems. MAF was designed for flexibility, so each blog shows how to assemble the building blocks without a lot of ceremony.
The patterns can be combined to deliver more capable solutions. A workflow can invoke tools directly; fan-out agents can be conditionally triggered inside a sequential flow; middleware can add logging or authorization to concurrent executors; and custom context providers can enrich multi-turn conversations.
Frameworks accelerate delivery, but production systems still need attention to scalability, security, reliability, and maintainability. With a solid framework, these concerns are easier to tackle. I hope the walkthroughs are useful when you explore MAF.
The tougher challenges often involve clarifying business outcomes, identifying usable data, and shaping the AI problem statement. I cover that approach here
Microsoft Agent Framework: function as tool, agent as tool
In this post, I show how MAF supports the "function as tool, agent as tool" pattern. Agents can call functions as tools for precise operations, and they can call other agents as tools when delegation makes more sense. This provides an approachable way to modularize logic and build richer agents.
Function as Tool
To implement the "function as tool" pattern, define a function that performs a clear task. Annotations on the function and its parameters make it simple to register the function as a tool, no longer relying on doc strings for the signature.
Agent as Tool
To implement the "agent as tool" pattern, define an agent that owns a specific responsibility. The as_tool helper wraps the agent so other agents can call it directly. That wrapper includes parameters such as name and description to describe the tool and guide how higher-level agents delegate work.
Microsoft Agent Framework: Middleware
In this post, I demonstrate how MAF streamlines middleware. Middleware sits between the agent and the runtime, intercepting and modifying messages sent to or returned by the agent. That interception enables concise add-ons such as logging, authentication, or caching.
Essentially, middleware exposes two methods: invoking runs before the agent to shape the input context, and invoked runs afterward to refine the output context.
This approach lets us add capabilities without touching the agent code. Create a middleware class, plug it into the middleware parameter, and the framework handles the orchestration.
Microsoft Agent Framework: Sequential Flow
In this post, I cover how MAF implements sequential flow. Sequential flow runs a series of agents in a defined order to reach a goal state. It works well when a large task can be decomposed into smaller responsibilities so each agent stays focused, improving performance and maintainability.
Microsoft Agent Framework: Concurrent Agent Executors
In this post, I demonstrate how MAF enables concurrent agent executors. Multiple agents can execute simultaneously, which improves throughput and responsiveness when tasks are independent.
Why is this important? Real-world systems frequently juggle parallel work. A customer service application, for example, can route separate conversations to different agents at once. Concurrent executors keep each task moving while an aggregate function combines the results into a single response.
Why not use MAF's workflow pattern? When a scenario simply needs parallel execution and aggregation, concurrent executors are the lighter option. Workflow shines when you must define branching paths or stateful steps.
Microsoft Agent Framework: Fan In and Fan Out.
In this post, I demonstrate how MAF supports the fan-in and fan-out pattern. It distributes work to multiple agents, then reassembles their outputs. The pattern is helpful when tasks can be parallelized for speed or scale. The sample does not yet show conditional fan-out, but MAF supports it to dynamically choose which agents to invoke.
Microsoft Agent Framework: Custom Context Provider
Most of the time, an agent does not begin with an empty context. Useful background data already exists, and the more relevant the context, the better the results. Context also shifts over time. MAF offers custom context providers to pull in that information. Implement the ContextProvider interface to fetch data from databases, APIs, or services, and MAF aggregates the provider outputs before the agent runs.
Microsoft Agent Framework: Multi-Turn Conversation
Multi-turn conversation is everywhere in production systems. In this post, I demonstrate how MAF manages those exchanges. Conversation state and context persist across turns, and you can plug in a custom chat message store if the default in-memory store is not enough. Starting a conversation `thread` returns a thread_id, making it easy to continue the same dialog later or to resume persisted conversations.
Microsoft Agent Framework: Workflow (Intent Detection)
I should have given the blog post a better title. In this post, I demonstrate how MAF implements a workflow pattern with intent detection. A workflow defines the sequence of steps an agent follows to satisfy a goal. Each step can delegate to an agent that owns a task, and the workflow coordinates data passing and progression so the system stays manageable.
Essentially, we can add condition(s) to edges in the workflow and having these conditions to determine the execution path.
Conclusion
Microsoft Agent Framework (MAF) provides building blocks to implement common patterns in agent-based systems. The framework's flexibility allows developers to assemble these patterns in various ways to create robust solutions. By combining these patterns, developers can build more capable and efficient systems that meet complex business needs.
There are many sample codes on MAF in Microsoft's official website and GitHub repositories. I am expecting to see more advanced patterns and best practices emerge as the community adopts MAF for real-world applications.
It is a fun time to test out MAF, and understand how it works. You should find it easy to get started if you have experience with AutoGen framework. Happy coding!

Comments
Post a Comment