Skip to content

Conversation

@mpangrazzi
Copy link
Contributor

@mpangrazzi mpangrazzi commented Jan 7, 2026

Related Issues

Proposed Changes:

NOTE: Reimplementation of #10250

Added a snapshot_callback parameter to Pipeline.run() and Agent.run() that allows users to provide a custom handler for pipeline snapshots instead of the default file-saving behavior. Currently, when a breakpoint is triggered or an error occurs during pipeline execution, snapshots are always saved to JSON files on disk.

This is limiting for users who want to e.g. save snapshots to a database or send snapshots to a remote service.

How did you test it?

unit tests, manual verification

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

@vercel
Copy link

vercel bot commented Jan 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
haystack-docs Ignored Ignored Preview Jan 8, 2026 10:20am

@mpangrazzi mpangrazzi marked this pull request as ready for review January 7, 2026 16:25
@mpangrazzi mpangrazzi requested a review from a team as a code owner January 7, 2026 16:25
@mpangrazzi mpangrazzi requested review from anakin87, davidsbatista and sjrl and removed request for a team and anakin87 January 7, 2026 16:25
@sjrl
Copy link
Contributor

sjrl commented Jan 8, 2026

@mpangrazzi thanks for implementing this! If I recall a number of users also requested a way to turn off the file saving behavior and I think you mentioned you'd look at adding a something like a boolean toggle for this when working on this feature. Is that something you are still planning on doing?

@mpangrazzi
Copy link
Contributor Author

@sjrl yes definitely! But I would do that in a separate PR. So, with this one we introduce snapshot_callback to let users be able e.g. to save snapshots in a database or so. Then I'll open a new one which will probably add a boolean flag / env var to enable or disable the default behaviour (ie dumping snapshots in files). WDYT?

@sjrl
Copy link
Contributor

sjrl commented Jan 8, 2026

@sjrl yes definitely! But I would do that in a separate PR. So, with this one we introduce snapshot_callback to let users be able e.g. to save snapshots in a database or so. Then I'll open a new one which will probably add a boolean flag / env var to enable or disable the default behaviour (ie dumping snapshots in files). WDYT?

Sounds good! Especially the env var idea.

Copy link
Contributor

@sjrl sjrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Makes me wonder if in the future if we should refactor Breakpoint to drop the snapshot_file_path field and always use the callback feature. Then we could create a default snapshot_callback that uses the current logic to save to disk.

Copy link
Contributor

@davidsbatista davidsbatista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just minor suggestions.

@mpangrazzi mpangrazzi enabled auto-merge (squash) January 8, 2026 10:20
@mpangrazzi
Copy link
Contributor Author

@sjrl @davidsbatista thanks!

@mpangrazzi mpangrazzi merged commit f74f86c into main Jan 8, 2026
21 checks passed
@mpangrazzi mpangrazzi deleted the snapshot_callback branch January 8, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants