DeadmanAbir / AgentGenesis

Welcome to AgentGenesis, your source for customizable Gen AI code snippets that you can easily copy and paste into your applications.
https://www.agentgenesis.dev/
MIT License
84 stars 19 forks source link

Implement Per-User Rate Limiting for LinkedIn Agent Access #44

Open DeadmanAbir opened 1 day ago

DeadmanAbir commented 1 day ago

Implement rate limiting to the backend of our LinkedIn Agent, restricting each unique user to 2 accesses every 24 hours in the playground. This is crucial as we are providing in-house API keys for LLMs and Proxycurl, necessitating controlled usage to prevent abuse.

By implementing this rate-limiting feature, we enhance the security and reliability of our LinkedIn Agent backend, ensuring resources are used appropriately and service availability is maintained for all users.

priyanshuverma-dev commented 1 day ago

Hi @DeadmanAbir,

May I work on this issue will solve it by using redis to save user's ip With RateLimiterRedis It is very easy

We can customize it like

const rateLimiter = new RateLimiterRedis({
  storeClient: redisClient,
  keyPrefix: 'rateLimiter',
  points: 2, // 2 requests
  duration: 24 * 60 * 60, // 24 hours
});
DeadmanAbir commented 1 day ago

Hi @DeadmanAbir,

May I work on this issue will solve it by using redis to save user's ip With RateLimiterRedis It is very easy

We can customize it like

const rateLimiter = new RateLimiterRedis({
  storeClient: redisClient,
  keyPrefix: 'rateLimiter',
  points: 2, // 2 requests
  duration: 24 * 60 * 60, // 24 hours
});

Hi @DeadmanAbir,

May I work on this issue will solve it by using redis to save user's ip With RateLimiterRedis It is very easy

We can customize it like

const rateLimiter = new RateLimiterRedis({
  storeClient: redisClient,
  keyPrefix: 'rateLimiter',
  points: 2, // 2 requests
  duration: 24 * 60 * 60, // 24 hours
});

Hey do we have to deploy redis by our own or it's free of service?

priyanshuverma-dev commented 20 hours ago

@DeadmanAbir We have to deploy it our self but we can use a free tier from render.com or other because we will be using it for only ip rating

priyanshuverma-dev commented 18 hours ago

@DeadmanAbir May I implement the fix

DeadmanAbir commented 2 hours ago

@DeadmanAbir We have to deploy it our self but we can use a free tier from render.com or other because we will be using it for only ip rating

render is slow ig for free tier. Is there any alternative options to go for inhouse deploments?