Support teams receive hundreds or thousands of tickets every day. These tickets can be related to login problems, payment failures, account access, technical issues, feature requests, and general questions. Before a support team can resolve them, someone needs to read each ticket, understand the problem, assign a category, and send it to the right department.
This process is often handled manually or through AI-powered chat models. However, not every classification problem requires a large language model. If the ticket categories and classification rules are already known, a rule-based approach can be faster, easier to control, and more predictable.
Microsoft Agent Framework provides a workflow-based approach that allows developers to build processing pipelines using executors and connected steps. These workflows can execute ordinary C# logic without connecting to an LLM or configuring a chat model.
In this article, we will build a support ticket classification system using C# and the Microsoft Agent Framework. The application will accept an unstructured support ticket, identify important keywords, assign a category, determine its priority, and return a structured classification result.
Why Build a Support Ticket Classifier Without a Chat Model?
A common approach to building an AI-powered ticket classifier is to send ticket descriptions to a chat model and ask it to identify the category.
For example, an application might send the following message:
"Unable to complete my payment. The transaction failed, but the amount was deducted from my bank account."
A chat model can understand the context and classify the ticket as a payment issue. However, this approach introduces additional dependencies, including model credentials, network connectivity, token consumption, and model response handling.
For a predefined set of support categories, developers can implement classification rules directly in C#.
Consider the following requirements:
- Identify payment-related problems.
- Detect login and authentication issues.
- Recognize technical errors.
- Identify feature requests.
- Assign priority based on predefined keywords.
- Return a structured result that another application component can consume.
These requirements can be implemented using deterministic business logic.
Microsoft Agent Framework workflows provide a way to organize this processing into separate executors. Each executor performs a specific operation, and the workflow controls how data moves between them.
The important distinction is that we are using the workflow capabilities of Microsoft Agent Framework, not a model-backed conversational agent.
Understanding Microsoft Agent Framework Workflows
Microsoft Agent Framework provides building blocks for creating AI agents and orchestrating workflows. Although agents commonly use language models, workflows can also coordinate ordinary application logic.
A workflow consists of three important components.
Executors
An executor is an individual processing unit inside a workflow. It receives input, performs an operation, and can send a result to another executor or produce a workflow output.
For example, a support ticket application can contain the following executors:
- Ticket validation executor
- Ticket classification executor
- Priority detection executor
- Result formatting executor
Each executor has a clearly defined responsibility.
Edges
Edges connect executors and determine how information moves through the workflow.
For example, after validating a support ticket, the workflow can pass it to the classification executor. The classification result can then be passed to another executor for priority detection.
WorkflowBuilder
WorkflowBuilder is used to construct the workflow by connecting executors.
It defines the starting executor, the connections between processing steps, and the executors whose results should be exposed as workflow outputs.
The following architecture represents our application.
Support Ticket
|
v
Ticket Validation
|
v
Ticket Classification
|
v
Priority Detection
|
v
Result Formatting
|
v
Structured ResultEvery step uses C# logic. There is no chat completion request or external AI inference service involved.
Setting Up the .NET Project
First, create a console application.
dotnet new console -n SupportTicketClassifier
cd SupportTicketClassifierInstall the Microsoft Agent Framework Workflows package.
dotnet add package Microsoft.Agents.AI.WorkflowsThe workflow package provides the executor and workflow-building functionality required for this implementation.
Use a currently supported .NET SDK and check package compatibility when configuring your project.
The project uses the following namespace:
using Microsoft.Agents.AI.Workflows;Our implementation will use strongly typed C# records to represent support tickets and classification results.
Defining the Support Ticket Models
Before creating executors, we need to define the data that will move through the workflow.
Create a file named SupportTicket.cs.
public sealed record SupportTicket(
int TicketId,
string Subject,
string Description,
string CustomerEmail
);This model contains the basic information required to process a support request.
Next, create a model for the classification result.
public sealed record TicketClassification(
int TicketId,
string Category,
string Priority,
string AssignedTeam,
string Reason,
bool RequiresHumanReview
);The classification result contains more than just a category. It also includes priority, the responsible team, the reason for classification, and an indicator for human review.
Using strongly typed models makes the workflow easier to maintain because each processing step works with a clearly defined data structure.
Creating the Ticket Validation Executor
The first step is to validate the incoming support ticket.
A ticket should not continue through the classification process if its required fields are missing.
Create a file named TicketValidationExecutor.cs.
using Microsoft.Agents.AI.Workflows;
public sealed class TicketValidationExecutor()
: Executor<SupportTicket, SupportTicket>(
"TicketValidationExecutor")
{
public override ValueTask<SupportTicket> HandleAsync(
SupportTicket ticket,
IWorkflowContext context,
CancellationToken cancellationToken = default)
{
if (ticket.TicketId <= 0)
{
throw new ArgumentException(
"Invalid ticket ID.");
}
if (string.IsNullOrWhiteSpace(ticket.Subject))
{
throw new ArgumentException(
"Ticket subject is required.");
}
if (string.IsNullOrWhiteSpace(ticket.Description))
{
throw new ArgumentException(
"Ticket description is required.");
}
return ValueTask.FromResult(ticket);
}
}The executor checks whether the ticket contains the minimum information required for classification.
If validation succeeds, the original ticket is returned and passed to the next connected executor.
This separation is useful because validation rules can change without modifying the classification logic.
In a production application, additional checks can include maximum description length, customer identification, duplicate ticket detection, and input normalization.
Building the Ticket Classification Logic
Now we can implement the main classification functionality.
The classifier will examine the ticket subject and description to identify relevant keywords.
For this example, we will support five categories:
- Payment
- Authentication
- Technical
- Feature Request
- General Support
Create TicketClassificationExecutor.cs.
using Microsoft.Agents.AI.Workflows;
public sealed class TicketClassificationExecutor()
: Executor<SupportTicket, TicketClassification>(
"TicketClassificationExecutor")
{
public override ValueTask<TicketClassification> HandleAsync(
SupportTicket ticket,
IWorkflowContext context,
CancellationToken cancellationToken = default)
{
string text =
$"{ticket.Subject} {ticket.Description}"
.ToLowerInvariant();
string category;
string assignedTeam;
string reason;
if (ContainsAny(text,
"payment", "transaction", "refund",
"billing", "charged"))
{
category = "Payment";
assignedTeam = "Billing Team";
reason = "Payment-related keywords detected.";
}
else if (ContainsAny(text,
"login", "password", "authentication",
"account access", "sign in"))
{
category = "Authentication";
assignedTeam = "Identity Support";
reason = "Authentication-related keywords detected.";
}
else if (ContainsAny(text,
"exception", "crash", "error",
"not working", "failed"))
{
category = "Technical";
assignedTeam = "Technical Support";
reason = "Technical error keywords detected.";
}
else if (ContainsAny(text,
"feature request", "new feature",
"enhancement", "suggestion"))
{
category = "Feature Request";
assignedTeam = "Product Team";
reason = "Feature request keywords detected.";
}
else
{
category = "General Support";
assignedTeam = "Customer Support";
reason = "No specific category matched.";
}
string priority = DeterminePriority(text);
bool requiresHumanReview =
category == "General Support" ||
priority == "Critical";
var result = new TicketClassification(
ticket.TicketId,
category,
priority,
assignedTeam,
reason,
requiresHumanReview
);
return ValueTask.FromResult(result);
}
private static bool ContainsAny(
string text,
params string[] keywords)
{
return keywords.Any(text.Contains);
}
private static string DeterminePriority(string text)
{
if (ContainsAny(text,
"urgent", "critical", "production down",
"service unavailable", "security breach"))
{
return "Critical";
}
if (ContainsAny(text,
"cannot access", "payment failed",
"system failure", "blocked"))
{
return "High";
}
if (ContainsAny(text,
"slow", "intermittent", "delayed"))
{
return "Medium";
}
return "Low";
}
}This executor performs two operations: category detection and priority detection.
The ContainsAny method avoids repeating keyword comparison logic throughout the application. Whenever a matching keyword is found, the corresponding category and support team are selected.
The DeterminePriority method applies a separate set of rules to identify the urgency of the ticket.
For example, a production outage should receive a higher priority than a general question about an application feature.
One important detail is that this implementation uses predefined keyword rules. It does not understand language in the same way as an LLM. A ticket that describes a problem using unexpected words may receive an incorrect category.
That limitation is acceptable for a controlled demonstration, but production systems should use carefully maintained rules and provide a human review path for uncertain cases.
Creating the Result Formatting Executor
The classification result is already structured. However, a separate formatting executor allows us to prepare a consistent response for the application.
Create TicketResultExecutor.cs.
using Microsoft.Agents.AI.Workflows;
public sealed class TicketResultExecutor()
: Executor<TicketClassification>(
"TicketResultExecutor")
{
[MessageHandler]
private ValueTask<string> HandleAsync(
TicketClassification result,
IWorkflowContext context)
{
string output =
$"""
Ticket Classification
---------------------
Ticket ID: {result.TicketId}
Category: {result.Category}
Priority: {result.Priority}
Assigned Team: {result.AssignedTeam}
Reason: {result.Reason}
Human Review: {result.RequiresHumanReview}
""";
return ValueTask.FromResult(output);
}
}This executor receives the classification result and creates a readable representation.
The MessageHandler attribute registers the method as a message handler. The class is derived from Executor and uses a strongly typed input.
The output returned by the handler is automatically sent to connected executors and can be exposed as a workflow result.
In a real application, you can replace this formatting operation with database persistence, an API call, or a notification service.
Connecting the Executors With WorkflowBuilder
We now have all the processing components.
The next step is to connect them using WorkflowBuilder.
Create a file named SupportTicketWorkflow.cs.
Join the conversation! Your thoughts help the community grow.