File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -715,6 +715,15 @@ async def run(
715715
716716 return result
717717 elif isinstance (turn_result .next_step , NextStepHandoff ):
718+ # Save the conversation to session if enabled (before handoff)
719+ if session is not None :
720+ if not any (
721+ guardrail_result .output .tripwire_triggered
722+ for guardrail_result in input_guardrail_results
723+ ):
724+ await self ._save_result_to_session (
725+ session , [], turn_result .new_step_items
726+ )
718727 current_agent = cast (Agent [TContext ], turn_result .next_step .new_agent )
719728 current_span .finish (reset_current = True )
720729 current_span = None
@@ -1166,8 +1175,7 @@ async def _start_streaming(
11661175
11671176 if isinstance (turn_result .next_step , NextStepHandoff ):
11681177 # Save the conversation to session if enabled (before handoff)
1169- # Note: Non-streaming path doesn't save handoff turns immediately,
1170- # but streaming needs to for graceful cancellation support
1178+ # Streaming needs to save for graceful cancellation support
11711179 if session is not None :
11721180 should_skip_session_save = (
11731181 await AgentRunner ._input_guardrail_tripwire_triggered_for_stream (
You can’t perform that action at this time.
0 commit comments