File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,25 @@ async def hello(name: str):
88
88
@app .orchestration_trigger (context_name = "context" )
89
89
@durable_openai_agent_orchestrator
90
90
def human_in_the_loop (context ):
91
- context .set_custom_status ("Waiting for approval..." )
91
+ writer = Agent (
92
+ name = "Writer" ,
93
+ instructions = "You only respond in haikus." ,
94
+ )
95
+
96
+ haiku = Runner .run_sync (writer , "Tell me about recursion in programming." )
97
+
98
+ judge = Agent (
99
+ name = "Judge" ,
100
+ instructions = "You judge haikus." ,
101
+ )
102
+
103
+ evaluation = Runner .run_sync (judge , f"Is this a good haiku? { haiku .final_output } " )
104
+
105
+ context .set_custom_status (f"Haiku:\n { haiku .final_output } \n \n Evaluation:\n { evaluation .final_output } \n \n Waiting for approval..." )
92
106
event_data = yield context .wait_for_external_event ("Approve" )
93
107
context .set_custom_status ("" )
94
- return event_data
108
+
109
+ reaction = Runner .run_sync (writer , f"Your haiku is considered { event_data } . React emotionally." )
110
+
111
+ return reaction .final_output
112
+
You can’t perform that action at this time.
0 commit comments