Training: Instruction to develop new skills.
Yes. For the current Microsoft Agent Framework SDK in .NET, I would start with the Sequential orchestration first, since it is the closest equivalent to the Python exercise you referenced.
One important note: the AI-generated answer above appears to use an older orchestration API surface. The current Agent Framework C# documentation uses AgentWorkflowBuilder and InProcessExecution.
Basic setup
using Azure.AI.Projects;
using Azure.Identity;
using Microsoft.Agents.AI;
using Microsoft.Agents.AI.Workflows;
using Microsoft.Extensions.AI;
var endpoint =
Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")
?? throw new InvalidOperationException(
"Set AZURE_OPENAI_ENDPOINT");
var deploymentName =
Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME")
?? "gpt-4o-mini";
AIProjectClient projectClient =
new(new Uri(endpoint), new DefaultAzureCredential());
AIAgent writerAgent = projectClient.AsAIAgent(
model: deploymentName,
name: "Writer",
instructions: "Create a concise first draft.");
AIAgent reviewerAgent = projectClient.AsAIAgent(
model: deploymentName,
name: "Reviewer",
instructions: "Review the previous response and improve it.");
Sequential orchestration
Workflow workflow =
AgentWorkflowBuilder.BuildSequential(
[writerAgent, reviewerAgent]);
In this pattern, the output flows in order:
User Input
↓
Writer Agent
↓
Reviewer Agent
↓
Final Output
Then run the workflow using the current in-process execution API:
var messages = new List<ChatMessage>
{
new(
ChatRole.User,
"Create a short launch message for a new product.")
};
await using StreamingRun run =
await InProcessExecution.RunStreamingAsync(
workflow,
messages);
await run.TrySendMessageAsync(
new TurnToken(emitEvents: true));
await foreach (
WorkflowEvent evt in run.WatchStreamAsync())
{
if (evt is AgentResponseUpdateEvent update)
{
Console.Write(update.Update.Text);
}
}
So if your immediate goal is to reproduce the Microsoft Learn sequential Python exercise in C#, AgentWorkflowBuilder.BuildSequential() is the place I would start.
Once you confirm that this version is working in your project, I can also share the equivalent C# pattern for Concurrent, Handoff, Group Chat, or Magentic orchestration separately.
I validated this against the current Microsoft Agent Framework Sequential Orchestration and Get Started documentation.
AI assistance disclosure: I used ChatGPT to help structure this response, and I reviewed and validated the code and guidance against the current Microsoft Agent Framework documentation before posting.
References:
- Microsoft Agent Framework — Sequential orchestration https://learn.microsoft.com/en-us/agent-framework/workflows/orchestrations/sequential
- Microsoft Agent Framework — Get started https://learn.microsoft.com/en-us/agent-framework/get-started/
- Microsoft Agent Framework — Workflow orchestrations overview https://learn.microsoft.com/en-us/agent-framework/workflows/orchestrations/