I understand that global variables are associated with an agent and are shared among all users who use that agent. However, for use cases that necessitate data persistence while ensuring uniqueness for each user, what would be the most appropriate approach?
Hi @bkermen,
It depends on the data you’re looking to save.
If you’re looking to store information provided by users, you can use Onboarding Variables. These are filled out once by the user and persist across all Runs:
If you need to store generated data, you can set up an external database like Supabase and connect it to your Agent using either a Custom Function or an HTTP Request block. That way, you can fetch and store user-specific data at both the beginning and end of your workflows.
Thanks so much for the detailed response—that clears things up perfectly. Using an external database like Supabase makes sense for now, and I’ll explore that option for my use case.
That said, I think having a built-in way to handle per-user data persistence within the platform would be a great feature to consider. It could really streamline workflows for agents that need to generate and retain user-specific context over time without relying on external systems.
I created this video when i was exploring global variables.
There are many design considerations, including how much data is required by user, and what level of security you need. But this video shows a way to persist data for different users.
This is a helpful addition—thanks for sharing! As you noted, security is definitely a concern here, since global variables aren’t scoped per user by design.
Also, you raise a great point about data volume. Do we know what the limits are for global variables? Specifically, how many can be defined per workflow, and is there a size limit for each variable?
Hi @bkermen,
You’re right, global variables aren’t meant to store user-specific data, so that approach isn’t recommended.
In terms of limits, there’s no set cap on how many global variables you can create, and each one can store up to 50 MB of data.