Skip to content

Commit 18a1272

Browse files
committed
error handling
1 parent 0496c0e commit 18a1272

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/agents/run.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,11 @@ async def _start_streaming(
11391139
streamed_result.is_complete = True
11401140
finally:
11411141
if streamed_result._input_guardrails_task:
1142-
await streamed_result._input_guardrails_task
1142+
try:
1143+
streamed_result.input_guardrail_results = await streamed_result._input_guardrails_task
1144+
except Exception:
1145+
# Exceptions will be checked in the stream_events loop
1146+
output_guardrail_results = []
11431147
if current_span:
11441148
current_span.finish(reset_current=True)
11451149
if streamed_result.trace:

0 commit comments

Comments
 (0)