Developer Tools

v2.28.0-rc2

The latest release candidate introduces flexible State parameter injection, eliminating manual wiring for agent tools.

Deep Dive

Deepset has launched the release candidate for Haystack v2.28.0-rc2, introducing a significant architectural enhancement for building AI agents. The standout feature allows developers to declare a `State` (or `State | None`) parameter directly in their tool signatures—whether using the `@tool` decorator for functions or `ComponentTool` for class-based components. At invocation time, the `ToolInvoker` automatically injects the runtime State object, providing tools with immediate access to the agent's full context, like conversation history or session data, without requiring explicit parameter mapping. This approach offers greater flexibility than the existing `inputs_from_state`/`outputs_to_state` options, particularly when tools need to interact with multiple state keys, though it does create tighter coupling to the State implementation.

Beyond the State injection, v2.28 brings several important improvements. The framework now standardizes on `httpx` for all HTTP requests, replacing the `requests` library, which improves async support and error reporting. The `MarkdownHeaderSplitter` component gains new precision with a `header_split_levels` parameter for controlling split boundaries and now intelligently ignores `#` lines inside fenced code blocks. Other enhancements include making agent snapshot serialization more robust to errors, adding a `run_async` method to `LLMMetadataExtractor`, and expanding documentation for OCR converters. A notable breaking change requires the `messages` argument to be explicitly passed to `Agent.run()` methods, removing the previous default `None` value.

Key Points
  • Tools can now declare a `State` parameter for automatic injection of the live agent context, removing manual wiring overhead.
  • HTTP client standardized to `httpx` from `requests`, improving async support and error detail in failed requests.
  • `MarkdownHeaderSplitter` enhanced with `header_split_levels` control and protection against misreading code comments as headers.

Why It Matters

Simplifies development of complex, state-aware AI agents by reducing boilerplate code and providing more flexible access to runtime context.