Skip to content

Commit cb0461d

Browse files
authored
fix: log exception when output guardrail raises instead of silently ignoring (#3411)
1 parent 5e71d09 commit cb0461d

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/agents/realtime/session.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,8 +987,14 @@ async def _run_output_guardrails(self, text: str, response_id: str) -> bool:
987987
)
988988
if result.output.tripwire_triggered:
989989
triggered_results.append(result)
990-
except Exception:
991-
# Continue with other guardrails if one fails
990+
except Exception as exc:
991+
logger.warning(
992+
"Output guardrail %r raised %s: %s; skipping it.",
993+
guardrail.get_name(),
994+
type(exc).__name__,
995+
exc,
996+
)
997+
logger.debug("Output guardrail failure details.", exc_info=True)
992998
continue
993999

9941000
if triggered_results:

0 commit comments

Comments
 (0)