Serving Multiple Users
You may be building a multi-user application with Letta, in which each user is associated with a specific agent. In this scenario, you can use the notion of tags (part of the agent state) to associate each agent with a user in your application.
Using Agent Tags to Identify Users
Let’s assume that you have an application with multiple users that you’re building on a self-hosted Letta Server or Letta Cloud.
Each user has a unique username, starting at user_1
, and incrementing up as you add more users to the platform.
To associate agents you create in Letta with your users, you can specify a tag when creating an agent, and set the tag to the user’s unique ID.
For example, with user_1
, we would set the tags
parameter to ["user_1"]
in our create agent request:
Then, if I wanted to search for agents associated with a specific user (e.g. called user_id
), I could use the tags
parameter in the list agents request:
Full example using the Python SDK
In this example we’ll create an agent with a (user) tag, then search for all agents with that tag.
This example assumes that you have a self-hosted Letta Server running on localhost (for example, by running docker run ...
).
View example Python SDK code
Creating and Viewing Tags in the ADE
You can also modify tags in the ADE. Simply click the Advanced Settings tab in the top-left of the ADE to view an agent’s tags. You can create new tags by typing the tag name in the input field and hitting enter.
