βοΈ Highlights
π§ Agent Breakpoints
This release introduces Agent Breakpoints, a powerful new feature that enhances debugging and observability when working with Haystack Agents. You can pause execution mid-run by inserting breakpoints in the Agent or its tools to inspect internal state and resume execution seamlessly. This brings fine-grained control to agent development and significantly improves traceability during complex interactions.
from haystack.dataclasses.breakpoints import AgentBreakpoint, Breakpoint
from haystack.dataclasses import ChatMessage
chat_generator_breakpoint = Breakpoint(
component_name="chat_generator",
visit_count=0,
snapshot_file_path="debug_snapshots"
)
agent_breakpoint = AgentBreakpoint(break_point=chat_generator_breakpoint, agent_name='calculator_agent')
response = agent.run(
messages=[ChatMessage.from_user("What is 7 * (4 + 2)?")],
break_point=agent_breakpoint
)
πΌοΈ Multimodal Pipelines and Agents
You can now blend text and image capabilities across generation, indexing, and retrieval in Haystack.
-
New
ImageContentDataclass: A dedicated structure to store image data along withbase64_image,mime_type,detail, andmetadata. -
Image-Aware Chat Generators: Image inputs are now supported in
OpenAIChatGenerator
from haystack.dataclasses import ImageContent, ChatMessage
from haystack.components.generators.chat import OpenAIChatGenerator
image_url = "https://cdn.britannica.com/79/191679-050-C7114D2B/Adult-capybara.jpg"
image_content = ImageContent.from_url(image_url)
message = ChatMessage.from_user(
content_parts=["Describe the image in short.", image_content]
)
llm = OpenAIChatGenerator(model="gpt-4o-mini")
print(llm.run([message])["replies"][0].text)
-
Powerful Multimodal Components:
PDFToImageContent,ImageFileToImageContent,DocumentToImageContent: Convert PDFs, image files, and Documents intoImageContentobjects.LLMDocumentContentExtractor: Extract text from images using a vision-enabled LLM.SentenceTransformersDocumentImageEmbedder: Generate embeddings from image-based documents using models like CLIP.DocumentLengthRouter: Route documents based on textual content lengthβideal for distinguishing scanned PDFs from text-based ones.DocumentTypeRouter: Route documents automatically based on MIME type metadata.
-
Prompt Building with Image Support: The
ChatPromptBuildernow supports templates with embedded images, enabling dynamic multimodal prompt creation.
With these additions, you can now build multimodal agents and RAG pipelines that reason over both text and visual content, unlocking richer interactions and retrieval capabilities.
π Learn more about multimodality in our Introduction to Multimodal Text Generation.
π New Features
-
Add
to_dictandfrom_dicttoByteStreamso it is consistent with our other dataclasses in having serialization and deserialization methods. -
Add
to_dictandfrom_dictto classesStreamingChunk,ToolCallResult,ToolCall,ComponentInfo, andToolCallDeltato make it consistent with our other dataclasses in having serialization and deserialization methods. -
Added the
tool_invoker_kwargsparam toAgentso additional kwargs can be passed to theToolInvokerlikemax_workersandenable_streaming_callback_passthrough. -
ChatPromptBuildernow supports special string templates in addition to a list ofChatMessageobjects. This new format is more flexible and allows structured parts like images to be included in the templatizedChatMessage.from haystack.components.builders import ChatPromptBuilder from haystack.dataclasses.chat_message import ImageContent template = """ {% message role="user" %} Hello! I am {{user_name}}. What's the difference between the following images? {% for image in images %} {{ image | templatize_part }} {% endfor %} {% endmessage %} """ images=[ ImageContent.from_file_path("apple-fruit.jpg"), ImageContent.from_file_path("apple-logo.jpg") ] builder = ChatPromptBuilder(template=template) builder.run(user_name="John", images=images) -
Added convenience class methods to the
ImageContentdataclass to createImageContentobjects from file paths and URLs. -
Added multiple converters to help convert image data between different formats:
-
DocumentToImageContent: Converts documents sourced from PDF and image files intoImageContents. -
ImageFileToImageContent: Converts image files toImageContentobjects. -
ImageFileToDocument: Converts image file references into emptyDocumentobjects with associated metadata. -
PDFToImageContent: Converts PDF files toImageContentobjects. -
Chat Messages with the user role can now include images using the new
ImageContentdataclass. We’ve added image support toOpenAIChatGenerator, and plan to support more model providers over time. -
Raise a warning when a pipeline can no longer proceed because all remaining components are blocked from running and no expected pipeline outputs have been produced. This scenario can occur legitimately. For example, in pipelines with mutually exclusive branches where some components are intentionally blocked. To help avoid false positives, the check ensures that none of the expected outputs (as defined by
Pipeline().outputs()) have been generated during the current run. -
Added
source_id_meta_fieldandsplit_id_meta_fieldtoSentenceWindowRetrieverfor customizable metadata field names. Addedraise_on_missing_meta_fieldsto control whether a ValueError is raised if any of the documents at runtime are missing the required meta fields (set to True by default). If False, then the documents missing the meta field will be skipped when retrieving their windows, but the original document will still be included in the results. -
Add a
ComponentInfodataclass to thehaystack.dataclassesmodule. This dataclass is used to store information about the component. We pass it toStreamingChunkso we can tell from which component a stream is coming from. -
Pass the
component_infoto theStreamingChunkin theOpenAIChatGenerator,AzureOpenAIChatGenerator,HuggingFaceAPIChatGeneratorandHuggingFaceLocalChatGenerator. -
Added the
enable_streaming_callback_passthroughto theToolInvokerinit, run and run_async methods. If set to True the ToolInvoker will try and pass thestreaming_callbackfunction to a tool’s invoke method only if the tool’s invoke method hasstreaming_callbackin its signature. -
Added dedicated
finish_reasonfield toStreamingChunkclass to improve type safety and enable sophisticated streaming UI logic. The field uses aFinishReasontype alias with standard values: “stop”, “length”, “tool_calls”, “content_filter”, plus Haystack-specific value “tool_call_results” (used by ToolInvoker to indicate tool execution completion). -
Updated
ToolInvokercomponent to use the newfinish_reasonfield when streaming tool results. The component now setsfinish_reason="tool_call_results"in the final streaming chunk to indicate that tool execution has completed, while maintaining backward compatibility by also setting the value inmeta["finish_reason"]. -
Added new
HuggingFaceTEIRankercomponent to enable reranking with Text Embeddings Inference (TEI) API. This component supports both self-hosted Text Embeddings Inference services and Hugging Face Inference Endpoints. -
Added a raise_on_failure boolean parameter to OpenAIDocumentEmbedder and AzureOpenAIDocumentEmbedder. If set to True then the component will raise an exception when there is an error with the API request. It is set to False by default to so the previous behavior of logging an exception and continuing is still the default.
-
ToolInvokernow executestool_callsin parallel for both sync and async mode. -
Add
AsyncHFTokenStreamingHandlerfor async streaming support inHuggingFaceLocalChatGenerator -
For
HuggingFaceAPIGeneratorandHuggingFaceAPIChatGeneratorall additional key, value pairs passed inapi_paramsare now passed to the initializations of the underlying Inference Clients. This allows passing of additional parameters to the clients liketimeout,headers,provider, etc. This means we now can easily specify a different inference provider by passing theproviderkey inapi_params. -
Updated
StreamingChunkto add the fieldstool_calls,tool_call_result,index, andstartto make it easier to format the stream in a streaming callback.
β¬οΈ Upgrade Notes
-
HuggingFaceAPIGeneratormight no longer work with the Hugging Face Inference API. As of July 2025, the Hugging Face Inference API no longer offers generative models that support thetext_generationendpoint. Generative models are now only available through providers that support thechat_completionendpoint. As a result, theHuggingFaceAPIGeneratorcomponent might not work with the Hugging Face Inference API. It still works with Hugging Face Inference Endpoints and self-hosted TGI instances. To use generative models via Hugging Face Inference API, please use theHuggingFaceAPIChatGeneratorcomponent, which supports thechat_completionendpoint. -
All parameters of the
Pipeline.draw()andPipeline.show()methods must now be specified as keyword arguments. Example:
pipeline.draw(
path="output.png",
server_url="https://custom-server.com",
params=None,
timeout=30,
super_component_expansion=False
)
-
The deprecated
async_executorparameter has been removed from theToolInvokerclass. Please use themax_workersparameter instead and aThreadPoolExecutorwith these workers will be created automatically for parallel tool invocations. -
The deprecated
Stateclass has been removed from thehaystack.dataclassesmodule. TheStateclass is now part of thehaystack.components.agentsmodule. -
Remove the
deserialize_value_with_schema_legacyfunction from thebase_serializationmodule. This function was used to deserializeStateobjects created with Haystack 2.14.0 or older. Support for the old serialization format is removed in Haystack 2.16.0.
β‘οΈ Enhancement Notes
-
Add
guess_mime_typeparameter toBytestream.from_file_path() -
Add the init parameter
skip_empty_documentsto theDocumentSplittercomponent. The default value is True. Setting it to False can be useful when downstream components in the Pipeline (likeLLMDocumentContentExtractor) can extract text from non-textual documents. -
Test that our type validation and connection validation works with builtin python types introduced in 3.9. We found that these types were already supported, we just now add explicit tests for them.
-
We relaxed the requirement that in
ToolCallDelta(introduced in Haystack 2.15) which required the parameters arguments or name to be populated to be able to create aToolCallDeltadataclass. We remove this requirement to be more in line with OpenAI’s SDK and since this was causing errors for some hosted versions of open source models following OpenAI’s SDK specification. -
Added
return_embeddingparameter insideInMemoryDocumentStore::initmethod. -
Updated methods
bm25_retrieval, andfilter_documentsto useself.return_embeddingto determine whether embeddings are returned. -
Updated tests (test_in_memory & test_in_memory_embedding_retriever) to reflect the changes in the
InMemoryDocumentStore. -
Added a new
deserialize_component_inplacefunction to handle generic component deserialization that works with any component type. -
Made doc-parser a core dependency since ComponentTool that uses it is one of the core Tool components.
-
Make the
PipelineBase().validate_inputmethod public so users can use it with the confidence that it won’t receive breaking changes without warning. This method is useful for checking that all required connections in a pipeline have a connection and is automatically called in the run method of Pipeline. It is being exposed as public for users who would like to call this method before runtime to validate the pipeline. -
For component run Datadog tracing, set the span resource name to the component name instead of the operation name.
-
Added a
trust_remote_codeparameter to theSentenceTransformersSimilarityRankercomponent. When set to True, this enables execution of custom models and scripts hosted on the Hugging Face Hub. -
Add a new parameter
require_tool_call_idstoChatMessage.to_openai_dict_format. The default isTrue, for compatibility with OpenAI’s Chat API: if theidfield is missing in a Tool Call, an error is raised. UsingFalseis useful for shallow OpenAI-compatible APIs, where theidfield is not required. -
Haystack’s core modules are now [ “type complete”]( https://typing.python.org/en/latest/guides/libraries.html#how-much-of-my-library-needs-types), meaning that all function parameters and return types are explicitly annotated. This increases the usefulness of the newly added
py.typedmarker and sidesteps differences in type inference between the various type checker implementations. -
Refactors the
HuggingFaceAPIChatGeneratorto use the util method_convert_streaming_chunks_to_chat_message. This is to help with being consistent for how we convertStreamingChunksinto a finalChatMessage. -
We also add
ComponentInfoto theStreamingChunksmade inHuggingFaceGenerator, andHugginFaceLocalGeneratorso we can tell from which component a stream is coming from. -
If only system messages are provided as input a warning will be logged to the user indicating that this likely not intended and that they should probably also provide user messages.
π Bug Fixes
-
Fix
_convert_streaming_chunks_to_chat_messagewhich is used to convert HaystackStreamingChunksinto a HaystackChatMessage. This fixes the scenario where oneStreamingChunkcontains twoToolCallDeltasinStreamingChunk.tool_calls. With this fix this correctly saves bothToolCallDeltaswhereas before they were overwriting each other. This only occurs with some LLM providers like Mistral (and not OpenAI) due to how the provider returns tool calls. -
Fixed a bug in the
print_streaming_chunkutility function that prevented tool call name from being printed. -
Fixed the
to_dictandfrom_dictofToolInvokerto properly serialize thestreaming_callbackinit parameter. -
Fix bug where if
raise_on_failure=Falseand an error occurs mid-batch that the following embeddings would be paired with the wrong documents. -
Fix
component_invokerused byComponentToolto work when a dataclass likeChatMessageis directly passed tocomponent_tool.invoke(...). Previously this would either cause an error or silently skip your input. -
Fixed a bug in the
LLMMetadataExtractorthat occurred when processingDocumentobjects withNoneor empty string content. The component now gracefully handles these cases by marking such documents as failed and providing an appropriate error message in their metadata, without attempting an LLM call. -
RecursiveDocumentSplitter now generates a unique
Document.idfor every chunk. The meta fields (split_id,parent_id, etc.) are populated [ before]()Documentcreation, so the hash used foridgeneration is always unique. -
In
ConditionalRouterfixed theto_dictandfrom_dictmethods to properly handle the case whenoutput_typeis a List of types or a List of strings. This occurs when a user specifies a route inConditionalRouterto have multiple outputs. -
Fix serialization of
GeneratedAnswerwhenChatMessageobjects are nested inmeta. -
Fix the serialization of
ComponentToolandToolwhen specifyingoutputs_to_string. Previously an error occurred on deserialization right after serializing ifoutputs_to_stringis not None. -
When calling
set_output_typeswe now also check that the decorator@component.output_typesis not present on therun_asyncmethod of a Component. Previously we only checked that theComponent.runmethod did not possess the decorator. -
Fix type comparison in schema validation by replacing
is notwith!=when checking the typeList[ChatMessage]. This prevents false mismatches due to Python’sisoperator comparing object identity instead of equality. -
Re-export symbols in
__init__.pyfiles. This ensures that short imports likefrom haystack.components.builders import ChatPromptBuilderwork equivalently tofrom haystack.components.builders.chat_prompt_builder import ChatPromptBuilder, without causing errors or warnings in mypy/Pylance. -
The
SuperComponentclass can now correctly serialize and deserialize aSuperComponentbased on an async pipeline. Previously, theSuperComponentclass always assumed the underlying pipeline was synchronous.
β οΈ Deprecation Notes
async_executorparameter inToolInvokeris deprecated in favor ofmax_workersparameter and will be removed in Haystack 2.16.0. You can usemax_workersparameter to control the number of threads used for parallel tool calling.
π Big thank you to everyone who contributed to this release!
@Amnah199 @RafaelJohn9 @anakin87 @bilgeyucel @davidsbatista @julian-risch @kanenorman @kr1shnasomani @mathislucka @mpangrazzi @sjr @srishti-git1110
