Microsoft Agent Framework: Concurrent Agent Executors

https://www.pexels.com/photo/multi-cultural-people-3184419/
https://www.pexels.com/photo/multi-cultural-people-3184419/

Building Efficient Concurrent Workflows with MAF

Introduction

Modern AI applications demand both speed and quality. When building intelligent systems, we often face a trade-off: do we optimize for response time or output quality? With the Multi-Agent Framework (MAF), you don't have to choose.

In this blog post, we'll explore how to leverage MAF's concurrent agent execution pattern to create workflows that are both fast and intelligent. By allowing multiple specialized agents to work in parallel, we can dramatically reduce latency while maintaining—or even improving—output quality.

The Concurrent Agent Pattern

The beauty of this pattern lies in its simplicity. At its core, you need just two components:

  • Two or more specialized agents - Each agent focuses on a specific task or domain
  • A consolidator - Combines the agents' outputs into a unified response

An Example: Poem & Facts Generator

Let's build an example that demonstrates this workflow. We'll create a workflow that responds to user queries with both creative and factual content:

  • Poem Agent: Generates creative, engaging poetry based on the user's query
  • Fact Agent: Provides accurate, relevant factual information about the topic
  • Consolidator Agent: Intelligently weaves together the creative and factual outputs into a coherent, engaging response

By running the Poem and Fact agents concurrently, we cut execution time in half compared to running them sequentially—all while delivering a richer, more comprehensive response to the user.

Demo

The source is at https://github.com/dennisseah/maf-workflow/blob/main/samples/concurrent_agent_calls.py

Please watch the video with fullscreen mode and there are no audio. We stepped through the code to see how the agents are defined and how the workflow is constructed using MAF's API.



 

Comments