Skip to content

fix: interpolate {{ variables }} in Agentflow v2 nodes#5800

Closed
hztBUAA wants to merge 1 commit intoFlowiseAI:mainfrom
hztBUAA:fix/agentflow-variable-interpolation
Closed

fix: interpolate {{ variables }} in Agentflow v2 nodes#5800
hztBUAA wants to merge 1 commit intoFlowiseAI:mainfrom
hztBUAA:fix/agentflow-variable-interpolation

Conversation

@hztBUAA
Copy link

@hztBUAA hztBUAA commented Feb 20, 2026

Summary

  • {{ variable }} placeholders in Agentflow v2 nodes were not being interpolated with actual values
  • Added content field to HumanInput node output (user feedback or action type) so {{ humanInputAgentflow_0 }} resolves correctly
  • Improved fallback in resolveNodeReference: when a node is found but has no content or http.data, the entire output is stringified instead of returning the raw template string

Closes #5704

Test plan

  • Create an agentflow: Start -> Human Input -> (Proceed) -> Direct Reply with {{ humanInputAgentflow_0 }}
  • Verify the Direct Reply shows the user's feedback text (or "proceed"/"reject" when no feedback)
  • Verify other node variable references (e.g., {{ llmAgentflow_0 }}) continue to work correctly

Add content field to HumanInput output so {{ humanInputAgentflow_0 }}
resolves to user feedback (or action type when no feedback is given).

Also improve the fallback in resolveNodeReference: when a node is found
in executed data but has no content/http.data, stringify the entire
output instead of returning the raw template string.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hztBUAA, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical bug in Agentflow v2 where variable placeholders were not being correctly interpolated, leading to unrendered dynamic content. The changes introduce a new content field for HumanInput node outputs and implement a more robust fallback mechanism for variable resolution, significantly improving the reliability and functionality of Agentflow workflows that rely on dynamic data.

Highlights

  • Agentflow v2 Variable Interpolation Fix: Resolved an issue where {{ variable }} placeholders within Agentflow v2 nodes were not correctly interpolating with their actual values.
  • HumanInput Node Output Enhancement: A content field was added to the HumanInput node's output, ensuring that {{ humanInputAgentflow_0 }} variables correctly resolve to user feedback or action types.
  • Improved Variable Resolution Fallback: Enhanced the resolveNodeReference function to stringify the entire node output as a fallback when a node is found but lacks content or http.data, preventing raw template strings from being returned.
Changelog
  • packages/components/nodes/agentflow/HumanInput/HumanInput.ts
    • Added a 'content' field to the output object of the HumanInput node, populating it with either user feedback or the action type.
  • packages/server/src/utils/buildAgentflow.ts
    • Modified the 'resolveVariables' function to include a new conditional logic for 'formattedValue', introducing a fallback to stringify the entire 'nodeOutput' if 'actualValue' (content or http.data) is null or undefined.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request fixes variable interpolation in Agentflow v2 nodes by ensuring the HumanInput node provides a content field and improving the fallback mechanism in resolveVariables. The logic now correctly handles cases where specific output fields are missing by stringifying the entire output object, which enhances the flexibility of template variables across different node types. A minor improvement to type safety for formattedValue has also been suggested.

Array.isArray(actualValue) || (typeof actualValue === 'object' && actualValue !== null)
? JSON.stringify(actualValue)
: actualValue?.toString() ?? match
let formattedValue: any
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The variable formattedValue is always assigned a string value in all execution paths (via JSON.stringify, toString(), or the match string). Specifying the string type instead of any improves type safety and code clarity.

                let formattedValue: string

@hztBUAA
Copy link
Author

hztBUAA commented Feb 25, 2026

Thanks for the review and feedback. I am following up on this PR now and will either push the requested changes or reply point-by-point shortly.

@hztBUAA
Copy link
Author

hztBUAA commented Feb 25, 2026

Quick follow-up: I am reviewing the feedback and will update this PR shortly.

@HenryHengZJ
Copy link
Contributor

Closing as #5818 with similar fix

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.

Agentflow v2 {{ variables }} not being interpolated

2 participants