Configuring Multi-tenancy
Configure capacity based on users or organizations.
As discussed in the deployment guide, moving an AgentKit network into users’ hands requires configuring usage limits.
To avoid having one user’s usage affect another, you can configure multi-tenancy.
Multi-tenancy consists of configuring limits based on users or organizations (called “tenants”). It can be easily configured on your AgentKit network using Inngest.
Prerequisites
Your AgentKit network must be configured with Inngest.
Configuring Multi-tenancy
Adding multi-tenancy to your AgentKit network is done by transforming your AgentKit network into an Inngest function.
Transforming your AgentKit network into an Inngest function
First, you’ll need to create an Inngest Client:
Then, transform your AgentKit network into an Inngest function as follows:
The network.run()
is now performed by the Inngest function.
Don’t forget to register the function with createServer
’s functions
property.
Configuring a concurrency per user
We can now configure the capacity by user by adding concurrency and throttling configuration to our Inngest function:
Your AgentKit network will now be limited to 10 concurrent requests per user.
The same can be done to add throttling, rate limiting or priority.