File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -905,7 +905,10 @@ async def _run_input_guardrails_with_queue(
905905 t .cancel ()
906906 raise
907907
908+ # Store the full set of input guardrail results on the streamed result
909+ # and return them so callers awaiting this task can receive the list.
908910 streamed_result .input_guardrail_results = guardrail_results
911+ return guardrail_results
909912
910913 @classmethod
911914 async def _start_streaming (
@@ -1138,11 +1141,13 @@ async def _start_streaming(
11381141
11391142 streamed_result .is_complete = True
11401143 finally :
1141- if task := streamed_result ._input_guardrails_task :
1144+ if streamed_result ._input_guardrails_task :
11421145 try :
1143- streamed_result .input_guardrail_results = await task
1144- except Exception :
1145- streamed_result .input_guardrail_results = []
1146+ await streamed_result ._input_guardrails_task
1147+ except Exception as e :
1148+ logger .debug (
1149+ f"Error in streamed_result finalize for agent { current_agent .name } - { e } "
1150+ )
11461151 if current_span :
11471152 current_span .finish (reset_current = True )
11481153 if streamed_result .trace :
You can’t perform that action at this time.
0 commit comments