Skip to content

Commit 260bdf0

Browse files
committed
review comments
1 parent 3d05b71 commit 260bdf0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/agents/run.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff 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:

0 commit comments

Comments
 (0)