mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET Workflows - Add "CustomerSupport" sample (#2102)
This commit is contained in:
@@ -1,64 +0,0 @@
|
||||
#
|
||||
# This workflow demonstrates how to use the Question action
|
||||
# to request user input and confirm it matches the original input.
|
||||
#
|
||||
# Note: This workflow doesn't make use of any agents.
|
||||
#
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: workflow_demo
|
||||
actions:
|
||||
|
||||
# Capture original input
|
||||
- kind: SetVariable
|
||||
id: set_project
|
||||
variable: Local.OriginalInput
|
||||
value: =System.LastMessage.Text
|
||||
|
||||
# Request input from user
|
||||
- kind: Question
|
||||
id: question_confirm
|
||||
alwaysPrompt: false
|
||||
autoSend: false
|
||||
property: Local.ConfirmedInput
|
||||
prompt:
|
||||
kind: Message
|
||||
text:
|
||||
- "CONFIRM:"
|
||||
entity:
|
||||
kind: StringPrebuiltEntity
|
||||
|
||||
# Confirm input
|
||||
- kind: ConditionGroup
|
||||
id: check_completion
|
||||
conditions:
|
||||
|
||||
# Didn't match
|
||||
- condition: =Local.OriginalInput <> Local.ConfirmedInput
|
||||
id: check_confirm
|
||||
actions:
|
||||
|
||||
- kind: SendActivity
|
||||
id: sendActivity_mismatch
|
||||
activity: |-
|
||||
"{Local.ConfirmedInput}" does not match the original input of "{Local.OriginalInput}". Please try again.
|
||||
|
||||
- kind: GotoAction
|
||||
id: goto_again
|
||||
actionId: question_confirm
|
||||
|
||||
# Confirmed
|
||||
elseActions:
|
||||
- kind: SendActivity
|
||||
id: sendActivity_confirmed
|
||||
activity: |-
|
||||
You entered:
|
||||
{Local.OriginalInput}
|
||||
|
||||
Confirmed input:
|
||||
{Local.ConfirmedInput}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
#
|
||||
# This workflow demonstrates using multiple agents to provide automated
|
||||
# troubleshooting steps to resolve common issues with escalation options.
|
||||
#
|
||||
# Example input:
|
||||
# My PC keeps rebooting and I can't use it.
|
||||
#
|
||||
kind: Workflow
|
||||
trigger:
|
||||
|
||||
kind: OnConversationStart
|
||||
id: workflow_demo
|
||||
actions:
|
||||
|
||||
# Interact with user until the issue has been resolved or
|
||||
# a determination is made that a ticket is required.
|
||||
- kind: InvokeAzureAgent
|
||||
id: service_agent
|
||||
conversationId: =System.ConversationId
|
||||
agent:
|
||||
name: SelfServiceAgent
|
||||
input:
|
||||
externalLoop:
|
||||
when: |-
|
||||
=Not(Local.ServiceParameters.IsResolved)
|
||||
And
|
||||
Not(Local.ServiceParameters.NeedsTicket)
|
||||
output:
|
||||
responseObject: Local.ServiceParameters
|
||||
|
||||
# All done if issue is resolved.
|
||||
- kind: ConditionGroup
|
||||
id: check_if_resolved
|
||||
conditions:
|
||||
|
||||
- condition: =Local.ServiceParameters.IsResolved
|
||||
id: test_if_resolved
|
||||
actions:
|
||||
- kind: GotoAction
|
||||
id: end_when_resolved
|
||||
actionId: all_done
|
||||
|
||||
# Create the ticket.
|
||||
- kind: InvokeAzureAgent
|
||||
id: ticket_agent
|
||||
agent:
|
||||
name: TicketingAgent
|
||||
input:
|
||||
arguments:
|
||||
IssueDescription: =Local.ServiceParameters.IssueDescription
|
||||
AttemptedResolutionSteps: =Local.ServiceParameters.AttemptedResolutionSteps
|
||||
output:
|
||||
responseObject: Local.TicketParameters
|
||||
|
||||
# Capture the attempted resolution steps.
|
||||
- kind: SetVariable
|
||||
id: capture_attempted_resolution
|
||||
variable: Local.ResolutionSteps
|
||||
value: =Local.ServiceParameters.AttemptedResolutionSteps
|
||||
|
||||
# Notify user of ticket identifier.
|
||||
- kind: SendActivity
|
||||
id: log_ticket
|
||||
activity: "Created ticket #{Local.TicketParameters.TicketId}"
|
||||
|
||||
# Determine which team for which route the ticket.
|
||||
- kind: InvokeAzureAgent
|
||||
id: routing_agent
|
||||
agent:
|
||||
name: TicketRoutingAgent
|
||||
input:
|
||||
messages: =UserMessage(Local.ServiceParameters.IssueDescription)
|
||||
output:
|
||||
responseObject: Local.RoutingParameters
|
||||
|
||||
# Notify user of routing decision.
|
||||
- kind: SendActivity
|
||||
id: log_route
|
||||
activity: Routing to {Local.RoutingParameters.TeamName}
|
||||
|
||||
- kind: ConditionGroup
|
||||
id: check_routing
|
||||
conditions:
|
||||
|
||||
- condition: =Local.RoutingParameters.TeamName = "Windows Support"
|
||||
id: route_to_support
|
||||
actions:
|
||||
|
||||
# Invoke the support agent to attempt to resolve the issue.
|
||||
- kind: CreateConversation
|
||||
id: conversation_support
|
||||
conversationId: Local.SupportConversationId
|
||||
|
||||
- kind: InvokeAzureAgent
|
||||
id: support_agent
|
||||
conversationId: =Local.SupportConversationId
|
||||
agent:
|
||||
name: WindowsSupportAgent
|
||||
input:
|
||||
arguments:
|
||||
IssueDescription: =Local.ServiceParameters.IssueDescription
|
||||
AttemptedResolutionSteps: =Local.ServiceParameters.AttemptedResolutionSteps
|
||||
externalLoop:
|
||||
when: |-
|
||||
=Not(Local.SupportParameters.IsResolved)
|
||||
And
|
||||
Not(Local.SupportParameters.NeedsEscalation)
|
||||
output:
|
||||
autoSend: true
|
||||
responseObject: Local.SupportParameters
|
||||
|
||||
# Capture the attempted resolution steps.
|
||||
- kind: SetVariable
|
||||
id: capture_support_resolution
|
||||
variable: Local.ResolutionSteps
|
||||
value: =Local.SupportParameters.ResolutionSummary
|
||||
|
||||
# Check if the issue was resolved by support.
|
||||
- kind: ConditionGroup
|
||||
id: check_resolved
|
||||
conditions:
|
||||
|
||||
# Resolve ticket
|
||||
- condition: =Local.SupportParameters.IsResolved
|
||||
id: handle_if_resolved
|
||||
actions:
|
||||
|
||||
- kind: InvokeAzureAgent
|
||||
id: resolution_agent
|
||||
agent:
|
||||
name: TicketResolutionAgent
|
||||
input:
|
||||
arguments:
|
||||
TicketId: =Local.TicketParameters.TicketId
|
||||
ResolutionSummary: =Local.SupportParameters.ResolutionSummary
|
||||
|
||||
- kind: GotoAction
|
||||
id: end_when_solved
|
||||
actionId: all_done
|
||||
|
||||
# Escalate the ticket by sending an email notification.
|
||||
- kind: CreateConversation
|
||||
id: conversation_escalate
|
||||
conversationId: Local.EscalationConversationId
|
||||
|
||||
- kind: InvokeAzureAgent
|
||||
id: escalate_agent
|
||||
conversationId: =Local.EscalationConversationId
|
||||
agent:
|
||||
name: TicketEscalationAgent
|
||||
input:
|
||||
arguments:
|
||||
TicketId: =Local.TicketParameters.TicketId
|
||||
IssueDescription: =Local.ServiceParameters.IssueDescription
|
||||
ResolutionSummary: =Local.ResolutionSteps
|
||||
externalLoop:
|
||||
when: =Not(Local.EscalationParameters.IsComplete)
|
||||
output:
|
||||
autoSend: true
|
||||
responseObject: Local.EscalationParameters
|
||||
|
||||
# All done
|
||||
- kind: EndWorkflow
|
||||
id: all_done
|
||||
Reference in New Issue
Block a user