Zero Labs
Industry News / AI

How I Built a Real Sequential Workflow in Microsoft Agent Framework with Azure AI Foundry

Source · Towards AI By Gaurav Bhardwaj

From the publisher’s feed, collected in the ZeroLabs newsroom.

Image generated with ChatGPTMost enterprise workflows do not fail because people lack effort.They fail because information moves in stages, and every stage depends on the quality of the one before it.A support ticket lands in a shared inbox.An incident report gets escalated.A compliance request needs a second review before anyone takes action.That handoff is where things usually get messy.I kept thinking about that while looking at enterprise workflows in Azure AI Foundry. In most real teams, one person does not handle everything from start to finish. One person interprets the request, another validates it, and someone else decides what happens next. That is not just a people problem. It is a workflow design problem.That is exactly why sequential orchestration in the Microsoft Agent Framework stood out to me.Instead of forcing one giant agent to do everything, I built a workflow where each agent handled one stage of the process in order. Each step added context for the next one. The result felt much closer to how actual enterprise operations work.In this article, I’ll walk through how I built a real sequential workflow in Azure AI Foundry, why this pattern matters, and how to think about it beyond toy examples.Why sequential orchestration mattersSequential orchestration is the simplest agent pattern to understand, and that is part of its strength.In a sequential workflow:Agent 1 handles the first stepAgent 2 receives the original input plus Agent 1’s outputAgent 3 receives the full conversation history and continues from thereThis is ideal when the workflow is naturally linear.A few examples where sequential orchestration makes sense:Security operations: classify → investigate → recommend responseClaims processing: intake → review → decision summaryDocument workflows: draft → review → approveCustomer support: summarize request → identify action → prepare responseThe important detail is this: each downstream agent sees the full conversation history. That means the next agent is not starting from scratch. It sees the original request and every prior response.That is what makes sequential orchestration useful for layered reasoning.The real use case I choseInstead of using a loan approval example, I wanted something that felt closer to the kinds of operational workflows teams actually run every day.So I used a security incident triage workflow.Here is the business scenario:A security mailbox receives an incident report from an employee or monitoring system. That report is usually incomplete, inconsistent, and written in natural language. Before a human analyst takes action, the organization wants a structured review.The flow looks like this:Security Alert Email → Incident Analyst → Response Reviewer → Final RecommendationWhy this is a good sequential workflowBecause the second step depends heavily on the first.The Incident Analyst extracts what happened, identifies severity, impacted asset, and suspected issue.Then the Response Reviewer looks at both:the original incident reportthe analyst’s findingsThat second reviewer should not re-do everything from scratch. It should build on the first stage and produce a clearer recommendation.That is exactly the kind of workflow sequential orchestration handles well.What I built in Azure AI FoundryI built this using:Azure AI Foundry for the project and model deploymentMicrosoft Agent Framework for orchestrationAzure CLI credential for authenticationPython for the workflow definitionThe setup starts with the AzureOpenAIResponsesClient, which connects the workflow to the model deployed in Foundry.import osfrom agent_framework.azure import AzureOpenAIResponsesClientfrom azure.identity import AzureCliCredentialchat_client = AzureOpenAIResponsesClient(project_endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],deployment_name=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],credential=AzureCliCredential(),)This is the part where Azure AI Foundry becomes the runtime foundation for the workflow.Once the model is deployed in Foundry and the project endpoint is available, I can define agents with clear responsibilities.Step 1: Creating the agentsI created two agents.The first agent acts like an Incident Analyst.Its job is to read the incoming report and turn it into a structured security summary.The second agent acts like a Response Reviewer.Its job is to review the analyst’s output and decide what the team should do next.incident_analyst = chat_client.as_agent( instructions=( "You are a Security Incident Analyst. Review the user's incident report and " "produce a structured assessment with these sections:\n" "1. Incident Summary\n" "2. Affected User or Asset\n" "3. Suspected Threat Type\n" "4. Severity: Low, Medium, or High\n" "5. Missing Information\n" "6. Recommended Immediate Containment Steps\n" "Be concise, practical, and enterprise-focused." ), name="incident_analyst",)response_reviewer = chat_client.as_agent( instructions=( "You are a Security Response Reviewer. Review the full conversation, including " "the original incident report and the analyst's findings.\n" "Your task is to:\n" "1. Validate whether the severity looks reasonable\n" "2. Identify escalation urgency\n" "3. Recommend next action: Monitor, Investigate, Contain, or Escalate\n" "4. Provide a final short response suitable for a SOC queue or ticketing system\n" "Keep the output crisp and operational." ), name="response_reviewer",)What I like here is that the responsibilities are very clear.The first agent interprets.The second agent validates and decides.That separation matters. It keeps each agent focused and makes the workflow easier to tune later.Step 2: Wiring the sequential pipelineOnce the agents are ready, the workflow itself is surprisingly small.from agent_framework.orchestrations import SequentialBuilderworkflow = SequentialBuilder(participants=[incident_analyst, response_reviewer]).build()That single line is the orchestration layer. The order is explicit:analyst firstreviewer secondAnd because this is sequential orchestration, the reviewer sees everything that came before it.That mirrors a real security review process much better than a one-shot prompt ever could.Step 3: Running the workflow on a real incidentFor testing, I used an incident that sounds like something a security team might actually receive.from typing import castfrom agent_framework import Messageincident_report = """We received multiple failed login attempts on a finance manager's account overnight,followed by a successful login from an unfamiliar IP address in another country.A few minutes later, mailbox forwarding rules were created and several password resetemails were deleted. The user says they were asleep at the time and did not approve any sign-in."""outputs: list[list[Message]] = []async for event in workflow.run(incident_report, stream=True): if event.type == "output": outputs.append(cast(list[Message], event.data))if outputs: print("===== Final Conversation =====") messages = outputs[-1] for i, msg in enumerate(messages, start=1): name = msg.author_name or ("assistant" if msg.role == "assistant" else "user") print(f"{'-' * 60}\n{i:02d} [{name}]\n{msg.text}")What the output looks likeA typical result would look something like this:01 [user]We received multiple failed login attempts on a finance manager's account overnight...02 [incident_analyst]Incident Summary:Possible account compromise involving suspicious sign-in activity and post-login mailbox manipulation.Affected User or Asset:Finance manager mailbox and associated identity account.Suspected Threat Type:Account takeover / business email compromise.Severity:HighMissing Information:Whether MFA was enabled, whether other accounts were affected, and whether token theft is suspected.Recommended Immediate Containment Steps:Disable sign-in, revoke active sessions, reset password, remove forwarding rules, review inbox rules, and preserve audit logs.03 [response_reviewer]Severity is appropriate based on suspicious login, mailbox rule creation, and deletion of password reset emails.Final Recommendation: EscalateUrgency: ImmediateSOC Queue Note: High-confidence account compromise. Contain immediately, preserve evidence, and initiate broader tenant investigation.This is where sequential orchestration really shows its value.The reviewer did not just repeat the original prompt.It built on the analyst’s work and turned it into a final operational recommendation.That is the difference between a chatbot response and a workflow response.Why I chose sequential instead of other patternsMicrosoft Agent Framework supports other orchestration models too, and they all have their place.But for this scenario, sequential was the right fit.Security incident triage is usually not random. It follows a predictable order.First, understand the issue.Then, review the assessment.Then decide on action.That makes sequential orchestration the cleanest pattern for the job.More real examples of sequential workflowsOnce I built this, it became easy to see how many enterprise workflows follow the same structure.1. Access request processingUser Request → Intake Agent → Policy Review Agent → Approval SummaryThe first agent extracts user, role, system, and justification.The second agent checks whether the request meets policy expectations.2. Insurance claims intakeClaim Narrative → Intake Agent → Risk Review Agent → Claims SummaryThe first agent structures the incident details.The second agent reviews potential fraud indicators or missing evidence.3. Contract reviewDraft Contract → Clause Extraction Agent → Legal Review Agent → Executive SummaryThe first agent identifies important clauses. The second agent flags risk and required edits.4. Customer escalation handlingCustomer Complaint → Summary Agent → Resolution Agent → Response DraftThe first agent distills the issue.The second proposes action and a customer-facing reply.This is why sequential orchestration is so practical.It maps naturally to how teams already work.How I think about agents in FoundryOne thing I’ve learned quickly is that not every step should be an agent.Agents are best when I need:interpretationreasoninglanguage generationcontextual decision supportBut if the step is deterministic, I prefer code.That is where custom executors fit nicely into the workflow.For example, after the response reviewer finishes, I could add a deterministic executor that formats the final response into a ticket schema:TitleSeverityAssigned TeamNext ActionEscalation RequireThat gives me a workflow where:agents handle reasoningcode handles structure and enforcementThat balance is often what makes enterprise workflows usable in practice.What stood out after building thisA few things became obvious once I ran this pattern end to end.1. The conversation becomes the workflow recordEvery step is preserved in order. That creates a natural audit trail.2. Specialization improves clarityThe analyst and reviewer do different jobs. That makes the outputs more focused.3. The orchestration stays simpleEven though the workflow behaves like a multi-stage enterprise process, the actual orchestration code stays small.4. Foundry gives the workflow a clean runtime modelI define the project, connect to the deployment, create agents, and then focus on business logic instead of plumbing.Final takeawayWhat I like most about sequential orchestration in Microsoft Agent Framework is that it feels grounded.It does not ask me to invent an exotic multi-agent swarm for every use case.It lets me model the workflows organizations already run every day.That is why this pattern matters.In real enterprise work, one step often depends on the last:an analyst reviewsa reviewer validatesa decision gets recordedthe process moves forwardThat is sequential work.And with Azure AI Foundry plus the Microsoft Agent Framework, I can model that pattern in a way that is simple, explainable, and actually useful.I did not need one giant agent with a huge prompt. I built a workflow. And for most enterprise scenarios, that is the more important design choice.How I Built a Real Sequential Workflow in Microsoft Agent Framework with Azure AI Foundry was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.