Skip to content

feat: add output_passthrough to ConditionalRouter for non-Jinja2 routing#11555

Merged
davidsbatista merged 10 commits into
deepset-ai:mainfrom
spideyashith:fix/conditional-router-unsafe-routing-9355
Jun 19, 2026
Merged

feat: add output_passthrough to ConditionalRouter for non-Jinja2 routing#11555
davidsbatista merged 10 commits into
deepset-ai:mainfrom
spideyashith:fix/conditional-router-unsafe-routing-9355

Conversation

@spideyashith

@spideyashith spideyashith commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Proposed Changes

Adds an optional output_passthrough field to ConditionalRouter routes.
When set to True, the output field is treated as a plain variable name
instead of a Jinja2 template, passing the value directly from kwargs to the
route output. This enables routing of complex non-basic types (dataclasses,
Pydantic models) without unintended Jinja2 processing.

Closes #9355

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the contributing guidelines
  • I have added tests that prove my fix is effective or that my feature works
  • I have added/updated the docstrings for all modified components
  • New and existing unit tests pass locally with my changes
  • Release notes have been added

Note

This PR was developed with AI assistance.

@spideyashith spideyashith requested a review from a team as a code owner June 9, 2026 07:02
@spideyashith spideyashith requested review from davidsbatista and removed request for a team June 9, 2026 07:02
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

@spideyashith is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

CLAassistant commented Jun 9, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@davidsbatista davidsbatista self-assigned this Jun 9, 2026
@spideyashith

spideyashith commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

I've opened a PR to address this: #11555. The implementation adds an output_passthrough field to routes that skips Jinja2 processing and passes variables directly, enabling routing of complex non-basic types.

@davidsbatista davidsbatista removed their assignment Jun 9, 2026
@davidsbatista

davidsbatista commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

I ask you in the future for upcoming PRs to stick to our PR template.

@davidsbatista

Copy link
Copy Markdown
Contributor

I've opened a PR to address this: #11555. The implementation adds an output_passthrough field to routes that skips Jinja2 processing and passes variables directly, enabling routing of complex non-basic types.

Which issue are you referring to? Is another issue introduced by opening this PR?

@spideyashith

Copy link
Copy Markdown
Contributor Author

I've opened a PR to address this: #11555. The implementation adds an output_passthrough field to routes that skips Jinja2 processing and passes variables directly, enabling routing of complex non-basic types.

Which issue are you referring to? Is another issue introduced by opening this PR?

Sorry for the confusion! I mistakenly posted that comment inside the PR instead of on the original issue. This PR addresses issue #9355 — adding a way to route complex types in ConditionalRouter without Jinja2 processing.

@spideyashith

Copy link
Copy Markdown
Contributor Author

I've opened a PR to address this: #11555. The implementation adds an output_passthrough field to routes that skips Jinja2 processing and passes variables directly, enabling routing of complex non-basic types.

Which issue are you referring to? Is another issue introduced by opening this PR?

Hi @davidsbatista, apologies for the confusion — that comment was meant for issue #9355, not this PR. I've also updated the PR description to follow the project template. Please let me know if any changes are needed, happy to update!

@spideyashith

Copy link
Copy Markdown
Contributor Author

Hi @davidsbatista, just checking in — happy to make any changes if needed. Let me know!

@github-actions github-actions Bot added the type:documentation Improvements on the docs label Jun 19, 2026
@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

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 Jun 19, 2026 12:39pm

Request Review

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/components/routers
  conditional_router.py 458, 513
Project Total  

This report was generated by python-coverage-comment-action

@davidsbatista davidsbatista left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@spideyashith thanks for this, I did some adjustments

@davidsbatista davidsbatista merged commit 557cba2 into deepset-ai:main Jun 19, 2026
23 checks passed
sjrl pushed a commit that referenced this pull request Jun 22, 2026
…ing (#11555)

Co-authored-by: David S. Batista <dsbatista@gmail.com>
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.

Add another way to specify "unsafe" type routing without jinja to ConditionalRouter

3 participants