Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReAct agent (only?): workflow [null] that gets passed via "Extra Workflow Inputs" as string, comes out as "null" #11766

Open
Morriz opened this issue Nov 16, 2024 · 7 comments
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@Morriz
Copy link

Morriz commented Nov 16, 2024

Bug Description

What the title says.

To Reproduce

null_passing_to_sub_workflows.json

  1. trigger workflow
  2. observe that the calling workflow's value for $json.test is [null], but in the receiving workflow it is now "null".

Expected behavior

The ReAct agent to not mess with values. I hope the recent refactoring of this agent has fixed this, but maybe my bug report is just in time to get a fix shipped ;)

Operating System

docker

n8n Version

1.68.0

Node.js Version

docker

Database

SQLite (default)

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented Nov 16, 2024

Hey @Morriz,

We have created an internal ticket to look into this which we will be tracking as "GHC-454"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Nov 16, 2024
@Morriz Morriz changed the title ReAct agent (only?) previous [null] that is passed in Set gets passed as null to tool, breaking is not empty ReAct agent (only?) previous [null] that is passed in Set gets passed as "null" (str) to tool, breaking is not empty Nov 18, 2024
@jeanpaul
Copy link
Contributor

Hi @Morriz

Can you provide more information here as well? It's unclear what you mean by "test output workflow". A workflow JSON with minimal working example would be appreciated.

Also, we recommend users to move away from ReAct agents, and use Tools agents as much as possible; ReAct agents are not as reliable.

@Morriz
Copy link
Author

Morriz commented Nov 20, 2024

@jeanpaul ?? I find react agents to be MORE reliable and I have switched to that from tools agents.

I will provide my workflow here in a bit

@Morriz Morriz changed the title ReAct agent (only?) previous [null] that is passed in Set gets passed as "null" (str) to tool, breaking is not empty ReAct agent (only?) previous [null] that is passed in Set gets passed as null to tool, breaking is not empty Nov 20, 2024
@Morriz
Copy link
Author

Morriz commented Nov 20, 2024

@jeanpaul I never saw I did not correctly add the test workflow files in my OP, but have added it now.

@jeanpaul
Copy link
Contributor

jeanpaul commented Nov 22, 2024

Hi @Morriz, I've looked at your workflows, and I'm not exactly sure what I should observe. When running this, I see that the variable test, with value null, is being transformed into a string (because you explicitly type it as string), and that means that the if-node in the sub-workflow is entering the true branch, because the test variable is, indeed, not empty.

I've used the following workflow to make it a bit easier, and to keep everything in one workflow (be advised, you need to save it before you can actually call the self-contained sub-workflow):

react_agent_only_previous_null_that_is.json

@Morriz
Copy link
Author

Morriz commented Nov 23, 2024

I would assume that n8n deals with passing on keys that are given undefined values correctly. (It seems messy in the traces, as I see [undefined] as well as [null] values, making me think who uses nulls? Not me.) Maybe I am mistaken and got lucky so far. (To me it only seems to be an issue in this setup.)

My point is: how can we detect in such setups that we got an empty value passed in the sub-workflow? Can you help me solve that use case?

@Morriz Morriz changed the title ReAct agent (only?) previous [null] that is passed in Set gets passed as null to tool, breaking is not empty ReAct agent (only?): workflow [null] that gets passed via "Extra Workflow Inputs" as string, comes out as "null" Nov 23, 2024
@Morriz
Copy link
Author

Morriz commented Nov 23, 2024

@jeanpaul I tested it again and this bug still holds. Your assumption that an undefined or null value being passed to another workflow via "Extra Workflow Inputs" will be cast by the UI's formatter (string in this case) is correct, but this should not happen as INSIDE a workflow this never happens. We should be safe to assume that any primitive values such as undefined or null are passed on as-is, and not piped through the formatter.

Unfortunately "Extra Workflow Inputs" does not offer raw json so we can't work around this issue, and I think this needs work by the team to make sure the props passing paradigm holds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

3 participants