You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs-website/docs/concepts/pipelines/pipeline-breakpoints.mdx
+4-58Lines changed: 4 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,21 +2,19 @@
2
2
title: "Pipeline Breakpoints"
3
3
id: pipeline-breakpoints
4
4
slug: "/pipeline-breakpoints"
5
-
description: "Learn how to pause and resume Haystack pipeline or Agent execution using breakpoints to debug, inspect, and continue workflows from saved snapshots."
5
+
description: "Learn how to pause and resume Haystack pipeline execution using breakpoints to debug, inspect, and continue workflows from saved snapshots."
6
6
---
7
7
8
8
# Pipeline Breakpoints
9
9
10
-
Learn how to pause and resume Haystack pipeline or Agent execution using breakpoints to debug, inspect, and continue workflows from saved snapshots.
10
+
Learn how to pause and resume Haystack pipeline execution using breakpoints to debug, inspect, and continue workflows from saved snapshots.
11
11
12
12
## Introduction
13
13
14
14
Haystack pipelines support breakpoints for debugging complex execution flows. A `Breakpoint` allows you to pause the execution at specific components, inspect the pipeline state, and resume execution from saved snapshots. This feature works for any regular component as well as an `Agent` component.
15
15
16
16
You can set a `Breakpoint` on any component in a pipeline with a specific visit count. When triggered, the system stops the execution of the `Pipeline` and captures a snapshot of the current pipeline state. The state can be saved to a JSON file when snapshot file saving is enabled, see [Snapshot file saving](#snapshot-file-saving) below. You can inspect and modify the snapshot and use it to resume execution from the exact point where it stopped.
17
17
18
-
You can also set breakpoints on an Agent, specifically on the `ChatGenerator` component or on any of the `Tool` specified in the `ToolInvoker` component .
19
-
20
18
## Setting a `Breakpoint` on a Regular Component
21
19
22
20
Create a `Breakpoint` by specifying the component name and the visit count at which to trigger it. This is useful for pipelines with loops. The default `visit_count` value is 0.
@@ -49,7 +47,7 @@ To access the pipeline state during the breakpoint we can both catch the excepti
49
47
50
48
## Using a custom snapshot callback
51
49
52
-
You can pass a `snapshot_callback` to `Pipeline.run()`or `Agent.run()`to handle snapshots yourself instead of saving to a file. When a breakpoint is triggered or a snapshot is created on error, the callback is invoked with the `PipelineSnapshot` object. This is useful for saving snapshots to a database, sending them to a remote service, or custom logging.
50
+
You can pass a `snapshot_callback` to `Pipeline.run()` to handle snapshots yourself instead of saving to a file. When a breakpoint is triggered or a snapshot is created on error, the callback is invoked with the `PipelineSnapshot` object. This is useful for saving snapshots to a database, sending them to a remote service, or custom logging.
53
51
54
52
```python
55
53
from haystack.core.errors import BreakpointException
@@ -72,7 +70,7 @@ except BreakpointException as e:
72
70
print(f"Breakpoint triggered: {e.component}")
73
71
```
74
72
75
-
When `snapshot_callback` is provided, file-saving is skipped and the callback is responsible for handling the snapshot. The same parameter is available on `Agent.run()` for agent breakpoints.
73
+
When `snapshot_callback` is provided, file-saving is skipped and the callback is responsible for handling the snapshot.
76
74
77
75
## Snapshot file saving
78
76
@@ -111,58 +109,6 @@ result = pipeline.run(data={}, pipeline_snapshot=snapshot)
111
109
print(result["llm"]["replies"])
112
110
```
113
111
114
-
## Setting a Breakpoint on an Agent
115
-
116
-
You can also set breakpoints in an Agent component. An Agent supports two types of breakpoints:
117
-
118
-
1.**Chat Generator Breakpoint**: Pauses before LLM calls.
119
-
2.**Tool Invoker Breakpoint**: Pauses before any tool execution.
120
-
121
-
A `ChatGenerator` breakpoint is defined as shown below. You need to define a `Breakpoint` as for a pipeline breakpoint and then an `AgentBreakpoint` where you pass the breakpoint defined before and the name of Agent component.
122
-
123
-
```python
124
-
from haystack.dataclasses.breakpoints import AgentBreakpoint, Breakpoint, ToolBreakpoint
To set a breakpoint on a Tool in an Agent, do the following:
132
-
133
-
First, define a `ToolBreakpoint` specifying the `ToolInvoker` component whose name is `tool_invoker` and then the tool associated with the breakpoint, in this case – a `weather_tool` .
134
-
135
-
Then, define an `AgentBreakpoint` passing the `ToolBreakpoint` defined before as the breakpoint.
136
-
137
-
```python
138
-
from haystack.dataclasses.breakpoints import AgentBreakpoint, Breakpoint, ToolBreakpoint
139
-
140
-
# Break at tool invoker (tool calls)
141
-
tool_bp = ToolBreakpoint(
142
-
component_name="tool_invoker",
143
-
visit_count=0,
144
-
tool_name="weather_tool", # Specific tool, or None for any tool
When an Agent breakpoint is triggered, you can resume execution using the saved snapshot. Similar to the regular component in a pipeline, pass the JSON file with the snapshot to the `run()` method of the pipeline.
152
-
153
-
```python
154
-
from haystack.core.pipeline.breakpoint import load_pipeline_snapshot
result = pipeline.run(data={}, pipeline_snapshot=snapshot)
162
-
print("Pipeline resumed successfully")
163
-
print(f"Final result: {result}")
164
-
```
165
-
166
112
## Error Recovery with Snapshots
167
113
168
114
Pipelines automatically create a snapshot of the last valid state if a run fails. The snapshot contains inputs, visit counts, and intermediate outputs up to the failure. You can inspect it, fix the issue, and resume execution from that checkpoint instead of restarting the whole run.
Copy file name to clipboardExpand all lines: docs-website/docs/development/tracing.mdx
+7-16Lines changed: 7 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,26 +23,17 @@ Instrumented applications typically send traces to a trace collector or a tracin
23
23
|[LoggingTracer](tracing/logging-tracer.mdx)| Inspect the data flowing through your pipeline in real time through logs, with no backend setup. |
24
24
|[Custom Tracer](tracing/custom-tracer.mdx)| Connect any tracing backend by implementing the `Tracer` interface. |
25
25
26
-
## Disabling Auto Tracing
26
+
## Enabling and Disabling Tracing
27
27
28
-
Haystack automatically detects and enables tracing under the following circumstances:
28
+
Haystack never enables tracing automatically. To enable it, either call `haystack.tracing.enable_tracing(...)` with the tracer of your choice, or add a tracing connector component such as the [`OpenTelemetryConnector`](tracing/opentelemetry.mdx) or the [`DatadogConnector`](tracing/datadog.mdx) to your pipeline.
29
29
30
-
- If `opentelemetry-sdk` is installed and configured for OpenTelemetry. Note that this auto-enabling is deprecated and will be removed in Haystack 3.0 – use the [`OpenTelemetryConnector`](tracing/opentelemetry.mdx) to enable OpenTelemetry tracing instead.
31
-
- If `ddtrace` is installed for Datadog. Note that this auto-enabling is deprecated and will be removed in Haystack 3.0 – use the [`DatadogConnector`](tracing/datadog.mdx) to enable Datadog tracing instead.
30
+
To disable an enabled tracer:
32
31
33
-
To disable this behavior, there are two options:
32
+
```python
33
+
from haystack.tracing import disable_tracing
34
34
35
-
- Set the environment variable `HAYSTACK_AUTO_TRACE_ENABLED` to `false` when running your Haystack application
Copy file name to clipboardExpand all lines: docs-website/docs/overview/migrating-from-langgraphlangchain-to-haystack.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ Here's a table of key concepts and their approximate equivalents between the two
43
43
| Multi-Agent Collaboration (LangChain) | Multi-Agent System | Using [`ComponentTool`](../tools/componenttool.mdx), agents can use other agents as tools, enabling [multi-agent architectures](https://haystack.deepset.ai/tutorials/45_creating_a_multi_agent_system) within one framework. |
44
44
| Model Context Protocol `load_mcp_tools``MultiServerMCPClient`| Model Context Protocol - `MCPTool`, `MCPToolset`, `StdioServerInfo`, `StreamableHttpServerInfo`| Haystack provides [various MCP primitives](https://haystack.deepset.ai/integrations/mcp) for connecting multiple MCP servers and organizing MCP toolsets. |
45
45
| Memory (State, short-term, long-term) | Memory (Agent State, short-term, long-term) | Agent [State](../pipeline-components/agents-1/state.mdx) provides a structured way to share data between tools and store intermediate results during agent execution. For short-term memory, Haystack offers a [ChatMessage Store](/reference/experimental-chatmessage-store-api) to persist chat history. More memory options are coming soon. |
46
-
| Time travel (Checkpoints) | Breakpoints (Breakpoint, AgentBreakpoint, ToolBreakpoint, Snapshot) |[Breakpoints](../concepts/pipelines/pipeline-breakpoints.mdx) let you pause, inspect, modify, and resume a pipeline, agent, or tool for debugging or iterative development. |
46
+
| Time travel (Checkpoints) | Breakpoints (Breakpoint, PipelineSnapshot) |[Breakpoints](../concepts/pipelines/pipeline-breakpoints.mdx) let you pause, inspect, modify, and resume a pipeline for debugging or iterative development. |
47
47
| Human-in-the-Loop (Interrupts / Commands) | Human-in-the-loop (`ConfirmationHook` with confirmation strategies) | Haystack applies [confirmation strategies](https://haystack.deepset.ai/tutorials/47_human_in_the_loop_agent) through a `ConfirmationHook` registered under the Agent's `before_tool`[hook point](../pipeline-components/agents-1/hooks.mdx) to pause or block the execution to gather user feedback |
48
48
49
49
## Ecosystem and Tooling Mapping: LangChain → Haystack
Copy file name to clipboardExpand all lines: docs-website/docs/pipeline-components/generators/guides-to-generators/function-calling.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,7 +74,7 @@ At this point the model has only *requested* a call. Nothing has been executed y
74
74
75
75
### 3. Actually Invoke the Tool
76
76
77
-
To execute the requested tool calls, use the [`ToolInvoker`](../../tools/toolinvoker.mdx) component. It takes a list of [`ChatMessage`](../../../concepts/data-classes/chatmessage.mdx) objects containing tool calls, runs the corresponding tools, and returns new `ChatMessage` objects (with role `tool`) carrying the results as `ToolCallResult`s. To get a final natural-language answer, feed those results back to the ChatGenerator.
77
+
To execute the requested tool calls, use the `ToolInvoker` component. It takes a list of [`ChatMessage`](../../../concepts/data-classes/chatmessage.mdx) objects containing tool calls, runs the corresponding tools, and returns new `ChatMessage` objects (with role `tool`) carrying the results as `ToolCallResult`s. To get a final natural-language answer, feed those results back to the ChatGenerator.
0 commit comments