Skip to content

fix: require messages input parameter in Agent component#10734

Merged
bogdankostic merged 7 commits intomainfrom
fix/require-agent-messages
Mar 5, 2026
Merged

fix: require messages input parameter in Agent component#10734
bogdankostic merged 7 commits intomainfrom
fix/require-agent-messages

Conversation

@marc-mrt
Copy link
Contributor

@marc-mrt marc-mrt commented Mar 4, 2026

Related Issues

n/a

Proposed Changes:

It seems that making Agent's messages input optional (see #10638) created unwarranted pipeline scheduling behavior when a static input was provided and its predecessors would fail to return any output (i.e. empty dict).

As a quick fix, reverting seems like a reasonable way to go as the current behavior is faulty.
Future iterations could address the inner scheduling issue if deemed necessary and bring back optionality.

How did you test it?

Added a regression test in case we were to go that route again, making sure it passes would guarantee scheduling has no breaking behaviors in regards to Agent.

Notes for the reviewer

For a deeper explanation of the pipeline execution issues that arose, see #10728 (more specifically f4b2be4).

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.

@marc-mrt marc-mrt self-assigned this Mar 4, 2026
@marc-mrt marc-mrt requested a review from a team as a code owner March 4, 2026 15:42
@marc-mrt marc-mrt requested review from anakin87 and removed request for a team March 4, 2026 15:42
@vercel
Copy link

vercel bot commented Mar 4, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
haystack-docs Ignored Ignored Preview Mar 5, 2026 9:14am

Request Review

@marc-mrt
Copy link
Contributor Author

marc-mrt commented Mar 4, 2026

Taking care of the tests, sorry for pinging too soon 🙇

@github-actions github-actions bot added the type:documentation Improvements on the docs label Mar 4, 2026
Copy link
Member

@julian-risch julian-risch 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 to me! We can discuss next week if we can solve the scheduling problem in a better way.

Comment on lines -500 to -505
if messages is None and user_prompt is None and system_prompt is None:
raise ValueError(
"No messages provided to the Agent and neither user_prompt nor system_prompt is set. "
"Please provide at least one of these inputs."
)

Copy link
Member

Choose a reason for hiding this comment

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

No change request, just a remark: We could have still kept this to catch if a user explicitly passes messages=None but we don't need to catch that because messages = messages or [] handles that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair, those always good to have in a dynamically typed language 😄
Will keep that in mind next time.

@bogdankostic bogdankostic merged commit 6ccc7df into main Mar 5, 2026
21 checks passed
@bogdankostic bogdankostic deleted the fix/require-agent-messages branch March 5, 2026 09:26
bogdankostic pushed a commit that referenced this pull request Mar 5, 2026
* fix: require messages in Agent component

* fix: default to empty messages list in LLM component

* docs: add release notes

* test: add case to prove agentic pipeline execution failure

* docs: update agent docstring to accurately represent requirement of
messages input

* tests: fix agent messages param

* docs: add explicit bug reference in new test case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants