Python Client
You can view a working example of the Admin client here.
Admin Client
User creation and authentication is managed through the Admin
client, which is authenticated via the server token (set by the MEMGPT_SERVER_PASS
environment variable, or generated when memgpt server
is run).
You can create an admin client by connecting to the server URL with the server token:
from memgpt import Admin
admin = Admin(base_url="http://localhost:8283", token="your_token")
Creating Users
You can create users via the Admin
client. Each user has a unique UUID, and can only access data (e.g. agents, data sources, etc.) which the user created.
response = admin.create_user()
user_id = response.user_id # unique UUID for the user
api_key = response.api_key # bearer token for authentication
User Client
You can connect to the user endpoints of a MemGPT service via the RESTClient
. Each instance of the RESTClient
corresponds to a single user.
from memgpt import create_client
client = create_client(base_url="http://localhost:8283", token=token)
Updated about 2 months ago