working e2e orchestration completion.

This commit is contained in:
Shyju Krishnankutty
2026-01-14 16:18:21 -08:00
parent 7f22a87a24
commit defb533b95
7 changed files with 47 additions and 66 deletions
@@ -26,7 +26,8 @@ AzureOpenAIClient client = !string.IsNullOrEmpty(azureOpenAiKey)
// Set up an AI agent following the standard Microsoft Agent Framework pattern.
const string JokerName = "Joker";
const string JokerInstructions = "You are good at telling jokes.";
const string AnalysisInstructions = @"You are a Customer Feedback Analyzer. Your task is to analyze customer survey responses and categorize them accurately.
const string AnalysisInstructions = """
You are a Customer Feedback Analyzer. Your task is to analyze customer survey responses and categorize them accurately.
INPUT: You will receive customer feedback text that may include a rating and comments.
@@ -37,40 +38,37 @@ OUTPUT: Return ONLY ONE category from this list:
- Support Incident Status
CATEGORIZATION RULES:
- ""Bug Report"": Technical issues, errors, crashes, features not working as expected
- ""General Feedback"": Suggestions, compliments, general comments about the product or service
- ""Billing Question"": Payment issues, subscription inquiries, pricing questions, refund requests
- ""Support Incident Status"": Follow-ups on existing tickets, status inquiries about previous issues
- "Bug Report": Technical issues, errors, crashes, features not working as expected
- "General Feedback": Suggestions, compliments, general comments about the product or service
- "Billing Question": Payment issues, subscription inquiries, pricing questions, refund requests
- "Support Incident Status": Follow-ups on existing tickets, status inquiries about previous issues
RESPONSE FORMAT: Return only the category name exactly as shown above, with no additional text or explanation.
Examples:
- ""The app crashes when I try to export"" → Bug Report
- ""Love the new design! Great work"" → General Feedback
- ""Why was I charged twice this month?"" → Billing Question
- ""What's the status of ticket #12345?"" → Support Incident Status";
- "The app crashes when I try to export" Bug Report
- "Love the new design! Great work" General Feedback
- "Why was I charged twice this month?" Billing Question
- "What's the status of ticket #12345?" Support Incident Status
""";
AIAgent agent = client.GetChatClient(deploymentName).CreateAIAgent(JokerInstructions, JokerName);
AIAgent agent2 = client.GetChatClient(deploymentName).CreateAIAgent(AnalysisInstructions, "FeedbackAnalysisBot");
AIAgent surveyFeedbackAgent = client.GetChatClient(deploymentName).CreateAIAgent(AnalysisInstructions, "FeedbackAnalysisBot");
SurveyResponseParserExecutor surveyResponseParserExecutor = new();
ResponseRouterExecutor responseRouterExecutor = new();
WorkflowBuilder builder = new(surveyResponseParserExecutor);
builder.AddEdge(surveyResponseParserExecutor, agent2);
builder.AddEdge(agent2, responseRouterExecutor).WithOutputFrom(responseRouterExecutor);
builder.AddEdge(surveyResponseParserExecutor, surveyFeedbackAgent);
builder.AddEdge(surveyFeedbackAgent, responseRouterExecutor).WithOutputFrom(responseRouterExecutor);
var workflow = builder.WithName("HandleSurveyResponse").Build();
// Configure the function app to host AI agents and workflows in a unified way.
// This will automatically generate HTTP API endpoints for agents and workflows.
using IHost app = FunctionsApplication
.CreateBuilder(args)
.ConfigureFunctionsWebApplication()
//.ConfigureDurableAgents(op => op.AddAIAgent(agent, timeToLive: TimeSpan.FromHours(1)))
.ConfigureDurableOptions(options =>
{
// Configure workflows
options.Workflows.AddWorkflow(workflow);
})
.Build();
app.Run();
var functionBuilder = FunctionsApplication.CreateBuilder(args);
functionBuilder.ConfigureFunctionsWebApplication().ConfigureDurableOptions(options =>
{
// Configure workflows
options.Workflows.AddWorkflow(workflow);
});
functionBuilder.Build().Run();
@@ -5,4 +5,4 @@
POST {{authority}}/api/workflows/HandleSurveyResponse/run
Content-Type: text/plain
Rating: 5. Why was I charged $99 when my plan should be $49? I need a refund for the overcharge
Rating: 10. Why was I charged $99 when my plan should be $49? I need a refund for the overcharge