-
-
Notifications
You must be signed in to change notification settings - Fork 15.7k
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
[BUG] - Update variable using a custom tool don't work #2968
Comments
I don't think this is a bug, variables are not supposed to be modified and persisted across flow calls. Could you explain your use case? Maybe it can be solved in another way. |
To connect to an external API I need to request a token, which has an expiration date, to send in all requests. I need to check the expiration to request a new token and I cannot always request a new token due to limit issues from the API provider. I thought about storing the token and the expiration date in variables so I can check it in the custom tool. Another thing I need is to be able to place this verification code in a separate function because I will have to call it in several custom tools and I have already tried several ways without success. My installation is using postgreSQL and I created code to query and test the information but repeating this code in all custom tools is bad for maintaining the code. Tks |
About the repeating code, you can have a custom tool that retrieves the token, storing it/retrieving it from a cache if necessary. The agent would have to use it every time it needs to call a tool. There are a few alternatives here, depending on your infrastructure setup. One alternative is to store the token in a file in disk, but that will only work well if you have one replica of Flowise running and you have persistent storage. Another way is using an external database or storage. S3, DynamoDB, etc. might work. You might event be able to store it in the same Postgres instance you are using for Flowise. I know that this is more work than just changing a variable, but it's the only solution I can think of atm. Let's see what others think. |
You can pass it here: https://docs.flowiseai.com/integrations/langchain/tools/custom-tool#pass-variables-to-function
|
As mentioned here, I also cannot set a value in variables using the API. |
Describe the bug
I created a variable and I need to change its value during the flow with api callback. Using $vars.VariableName does not change the value stored for the variable in other calls.
Expected behavior
The variable value should be updated and persisted in the database
Setup
How can I update the values of these variables?
The text was updated successfully, but these errors were encountered: