-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathworkflow.yaml
More file actions
98 lines (89 loc) · 2.86 KB
/
workflow.yaml
File metadata and controls
98 lines (89 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Student-Teacher Math Chat Workflow
#
# Demonstrates iterative conversation between two agents with loop control
# and termination conditions.
#
# Example input:
# How would you compute the value of PI?
#
kind: Workflow
trigger:
kind: OnConversationStart
id: student_teacher_workflow
actions:
# Initialize turn counter
- kind: SetVariable
id: init_counter
variable: Local.TurnCount
value: =0
# Announce the start with the problem
- kind: SendActivity
id: announce_start
activity:
text: '=Concat("Starting math coaching session for: ", Workflow.Inputs.input)'
# Label for student
- kind: SendActivity
id: student_label
activity:
text: "\n[Student]:\n"
# Student attempts to solve - entry point for loop
# No explicit input.messages - uses implicit input from workflow inputs or conversation
- kind: InvokeAzureAgent
id: question_student
conversationId: =System.ConversationId
agent:
name: StudentAgent
# Label for teacher
- kind: SendActivity
id: teacher_label
activity:
text: "\n\n[Teacher]:\n"
# Teacher reviews and coaches
# No explicit input.messages - uses conversation context from conversationId
- kind: InvokeAzureAgent
id: question_teacher
conversationId: =System.ConversationId
agent:
name: TeacherAgent
output:
messages: Local.TeacherResponse
# Increment the turn counter
- kind: SetVariable
id: increment_counter
variable: Local.TurnCount
value: =Local.TurnCount + 1
# Check for completion using ConditionGroup
- kind: ConditionGroup
id: check_completion
conditions:
- id: success_condition
condition: =!IsBlank(Find("CONGRATULATIONS", Upper(MessageText(Local.TeacherResponse))))
actions:
- kind: SendActivity
id: success_message
activity:
text: "\nGOLD STAR! The student has demonstrated understanding."
- kind: SetVariable
id: set_success_result
variable: workflow.outputs.result
value: success
elseActions:
- kind: ConditionGroup
id: check_turn_limit
conditions:
- id: can_continue
condition: =Local.TurnCount < 4
actions:
# Continue the loop - go back to student label
- kind: GotoAction
id: continue_loop
actionId: student_label
elseActions:
- kind: SendActivity
id: timeout_message
activity:
text: "\nLet's try again later... The session has reached its limit."
- kind: SetVariable
id: set_timeout_result
variable: workflow.outputs.result
value: timeout