Skip to content

feat: add agent_with_prompt_builder super-component#440

Draft
marc-mrt wants to merge 1 commit intomainfrom
feature/bui-198-provide-chatpromptbuilder-capability-to-agent-component
Draft

feat: add agent_with_prompt_builder super-component#440
marc-mrt wants to merge 1 commit intomainfrom
feature/bui-198-provide-chatpromptbuilder-capability-to-agent-component

Conversation

@marc-mrt
Copy link
Contributor

Related Issues

n/a

Proposed Changes:

As we've seen ChatPromptBuilder be paired with Agent for every use-case on the Platform, a good opportunity for simplification would be a (super-)component that encapsulates the two.
This is an attempts at implementation with a super-component indeed, happy for general feedback on that take.

How did you test it?

Added unit tests, mainly to ensure good behavior of the super-component's input inference based on the template provided.

Notes for the reviewer

I've tried to be exhaustive but there is one thing that I still don't quite get, and would appreciate guidance on: to_dict and from_dict. I saw for example on Haystack's document_preprocessor how they are defined, but not on the multi_file_converter and I'm not sure I understand why on or the other.

Also - as it's my first contribution to Haystack (albeit experimental), any pointers as to unfollowed standards, code quality or misunderstandings of the framework are more than welcome!

Checklist

As we've seen ChatPromptBuilder be paired with Agent for every use-case,
a good opportunity for simplification is a super-component that
encapsulates the two.
@marc-mrt marc-mrt self-assigned this Feb 17, 2026
@coveralls
Copy link

Pull Request Test Coverage Report for Build 22105228703

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.9%) to 58.571%

Totals Coverage Status
Change from base Build 22096224768: 0.9%
Covered Lines: 697
Relevant Lines: 1190

💛 - Coveralls

# --- ChatPromptBuilder parameters --- #
template: list[ChatMessage] | str | None = None,
required_variables: list[str] | Literal["*"] | None = None,
variables: list[str] | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

For simplicity we could consider dropping variables and just not use it. I don't think it's often used since we often rely on the auto detection of the template

self,
*,
# --- ChatPromptBuilder parameters --- #
template: list[ChatMessage] | str | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a preferred interface for this new component is to just expose a param called user_prompt: str which we feed into the ChatPromptBuilder internally.

@sjrl
Copy link
Contributor

sjrl commented Feb 17, 2026

A few other comments I have:

  • Do you know if we can easily reuse this super component to make the LLM one? I don't think we've ever done inheritance with a pre-made super component before
  • If we go with the super component approach I think we really need to test the input and output sockets of this component. The Agent component sets many inputs and outputs dynamically that we will still want to be able to use. To test this we should write tests checking the values of the attributes Agent().__haystack_input__ and Agent().__haystack_output__ where we set things like the state_schema={"documents": list[Document]} and we should see documents become a valid input and valid output of the component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants