Hi everyone,
I am building an agentic automation workflow where an LLM Agent orchestrates several tools. The process involves iterating through a list of documents, where the Agent calls a tool to perform complex processing on a specific file stored on KNIME Hub. Due to the nature of the file for it to be accessed it needs to be copied over into the tool’s data folder for it to be processed.
The Problem: I need to pass the dynamic file path (which changes every loop iteration) from the Main Workflow into the Tool Workflow.
Currently, I am achieving this by injecting the file path into the System Prompt (e.g., “You are processing file: [Path]. When you call the processing tool, pass this path as the ‘input_file’ argument”).
Why this is not ideal: This relies on the LLM “remembering” to copy-paste the string correctly into the tool’s function call. This introduces a risk of hallucination or typos, especially with complex paths.
My Question: Is there a robust, deterministic way to pass a Flow Variable from the Main Workflow directly into the Tool Workflow’s configuration without making it a parameter that the LLM has to generate?
Has anyone successfully implemented a pattern for “Global Context” or “Dynamic Tool Configuration” to handle this?
If not can we have a feature request to pass flow variables from parent workflows into tool workflows.
Hi,
thanks for the great feature request. Let me share how I would approach solving the problem with the current capabilities.
I don’t think there is currently a direct way to pass a Flow Variable from a parent workflow into a Tool Workflow’s configuration without exposing it as a parameter that the LLM has to generate.
But as a workaround, one solution is to create a global space in your workflow hub space that acts as shared memory. The main workflow can write the dynamic file path (or a document ID / Hub reference) into a table stored in that space, and the tool workflow can read from and update it as needed. This provides a deterministic, global memory for LLM orchestration without relying on the model to copy values correctly.
I hope this can help.
Bests,
Ahmad
2 Likes
Thanks for the suggestion @Ahmad_Vh.
I wanted to share an update on my approach for those following this thread.
Currently, I am passing flow variables (such as absolute file paths and lists of available database tables) by injecting them directly into the Agent Prompter’s System Message as strings. While I initially worried about hallucinations, this method has actually been working perfectly so far and the agent hasn’t misconfigured a tool call yet.
However, while prompt injection works for now, it still feels like a workaround. As the agentic framework in KNIME continues to mature, I’m hopeful we’ll see a more native solution for passing Flow Variables directly into tool workflows. Having a deterministic way to “hand off” variables without relying on the LLM to parse them from a prompt would make these workflows significantly more robust and secure.
Hopefully the knime development team will look into this.
@Ahmad_Vh I see a potential issue with using a global space for workflows deployed on KNIME Hub with multiple concurrent users. If two people execute the workflow at the same time, they would both be reading/writing to the same shared table, creating a race condition. The tool workflow could easily end up pulling the file path from a different user’s session.