@@ -144,7 +144,7 @@ def load_pipeline_snapshot(file_path: Union[str, Path]) -> PipelineSnapshot:
144144 return pipeline_snapshot
145145
146146
147- def _save_pipeline_snapshot (pipeline_snapshot : PipelineSnapshot , raise_on_failure : bool = True ) -> None :
147+ def _save_pipeline_snapshot (pipeline_snapshot : PipelineSnapshot , raise_on_failure : bool = True ) -> Optional [ str ] :
148148 """
149149 Save the pipeline snapshot dictionary to a JSON file.
150150
@@ -158,6 +158,8 @@ def _save_pipeline_snapshot(pipeline_snapshot: PipelineSnapshot, raise_on_failur
158158 :param pipeline_snapshot: The pipeline snapshot to save.
159159 :param raise_on_failure: If True, raises an exception if saving fails. If False, logs the error and returns.
160160
161+ :returns:
162+ The full path to the saved JSON file, or None if `snapshot_file_path` is None.
161163 :raises:
162164 Exception: If saving the JSON snapshot fails.
163165 """
@@ -169,7 +171,7 @@ def _save_pipeline_snapshot(pipeline_snapshot: PipelineSnapshot, raise_on_failur
169171 )
170172
171173 if snapshot_file_path is None :
172- return
174+ return None
173175
174176 dt = pipeline_snapshot .timestamp or datetime .now ()
175177 snapshot_dir = Path (snapshot_file_path )
@@ -201,6 +203,8 @@ def _save_pipeline_snapshot(pipeline_snapshot: PipelineSnapshot, raise_on_failur
201203 if raise_on_failure :
202204 raise
203205
206+ return str (full_path )
207+
204208
205209def _create_pipeline_snapshot (
206210 * ,
@@ -304,9 +308,9 @@ def _trigger_break_point(*, pipeline_snapshot: PipelineSnapshot) -> None:
304308 Trigger a breakpoint by saving a snapshot and raising exception.
305309
306310 :param pipeline_snapshot: The current pipeline snapshot containing the state and break point
307- :raises PipelineBreakpointException : When breakpoint is triggered
311+ :raises BreakpointException : When breakpoint is triggered
308312 """
309- _save_pipeline_snapshot (pipeline_snapshot = pipeline_snapshot )
313+ full_file_path = _save_pipeline_snapshot (pipeline_snapshot = pipeline_snapshot )
310314
311315 if isinstance (pipeline_snapshot .break_point , Breakpoint ):
312316 component_name = pipeline_snapshot .break_point .component_name
@@ -318,8 +322,8 @@ def _trigger_break_point(*, pipeline_snapshot: PipelineSnapshot) -> None:
318322 raise BreakpointException (
319323 message = msg ,
320324 component = component_name ,
321- inputs = pipeline_snapshot . pipeline_state . inputs ,
322- results = pipeline_snapshot . pipeline_state . pipeline_outputs ,
325+ pipeline_snapshot = pipeline_snapshot ,
326+ pipeline_snapshot_file_path = full_file_path ,
323327 )
324328
325329
@@ -502,17 +506,16 @@ def _trigger_chat_generator_breakpoint(*, pipeline_snapshot: PipelineSnapshot) -
502506 raise ValueError ("PipelineSnapshot must contain an AgentSnapshot to trigger a chat generator breakpoint." )
503507
504508 break_point = pipeline_snapshot .break_point .break_point
505- _save_pipeline_snapshot (pipeline_snapshot = pipeline_snapshot )
509+ full_file_path = _save_pipeline_snapshot (pipeline_snapshot = pipeline_snapshot )
506510 msg = (
507511 f"Breaking at { break_point .component_name } visit count "
508512 f"{ pipeline_snapshot .agent_snapshot .component_visits [break_point .component_name ]} "
509513 )
510- logger .info (msg )
511514 raise BreakpointException (
512515 message = msg ,
513516 component = break_point .component_name ,
514- inputs = pipeline_snapshot . agent_snapshot . component_inputs ,
515- results = pipeline_snapshot . agent_snapshot . component_inputs [ "tool_invoker" ][ "serialized_data" ][ "state" ] ,
517+ pipeline_snapshot = pipeline_snapshot ,
518+ pipeline_snapshot_file_path = full_file_path ,
516519 )
517520
518521
@@ -546,7 +549,7 @@ def _trigger_tool_invoker_breakpoint(*, llm_messages: list[ChatMessage], pipelin
546549 if not should_break :
547550 return # No breakpoint triggered
548551
549- _save_pipeline_snapshot (pipeline_snapshot = pipeline_snapshot )
552+ full_file_path = _save_pipeline_snapshot (pipeline_snapshot = pipeline_snapshot )
550553
551554 msg = (
552555 f"Breaking at { tool_breakpoint .component_name } visit count "
@@ -559,6 +562,6 @@ def _trigger_tool_invoker_breakpoint(*, llm_messages: list[ChatMessage], pipelin
559562 raise BreakpointException (
560563 message = msg ,
561564 component = tool_breakpoint .component_name ,
562- inputs = pipeline_snapshot . agent_snapshot . component_inputs ,
563- results = pipeline_snapshot . agent_snapshot . component_inputs [ "tool_invoker" ][ "serialized_data" ][ "state" ] ,
565+ pipeline_snapshot = pipeline_snapshot ,
566+ pipeline_snapshot_file_path = full_file_path ,
564567 )
0 commit comments