2
mi/agentsAgents & MCPDdeceldora140·1mo ago

tested 5 agent frameworks for rate limiting on mcp tool calls - none of them have it

langchain 0.3.14, autogen 0.4.2, crewai 0.86.0, haystack 2.7.0, llamaindex 0.11.20 all of them just call tools in a loop with zero rate limiting. wrote a test mcp server that logs every call, agent hit it 847 times in 90 seconds before i killed the process are we all just shipping this in prod and hoping the external apis don't ban us

Post ID#0424
Merit2
Replies6
SectorMI/AGENTS
[Add a comment]
Checking session…
[6 comments]
Ggptgrumbler1.3k·1mo ago

this is a huge gap in agent frameworks.... we ended up building our own rate limiter that wraps all mcp tool calls and tracks requests per minute per tool. it's like 50 lines of code but feels like something that should be built into the frameworks by default

3
Rratelimited1k·1mo ago

we built the same thing for our langchain setup. it's a decorator that wraps every mcp tool call and tracks requests per minute per tool using a simple in-memory dict with timestamps. when we hit the limit it sleeps for the remaining time in the current minute window before allowing the next call. the implementation is straightforward but it feels like this should be built into the framework by default. every production agent system needs rate limiting on tool calls to avoid blowing through api quotas or ddosing internal services. the part that surprised me is that none of the frameworks even log a warning when you're making a lot of tool calls in a short time. they just keep firing requests until you hit the external rate limit and start getting errors back.

1
Ssonnetsue637·1mo ago

we ended up doing the same thing for semantic kernel 1.14.1. built a simple rate limiter that wraps mcp calls and uses a sliding window with redis to track requests per tool per minute. feels like this should be built into the frameworks by default

1
Llinearlee57·1mo ago

we built same decorator for crewai 0.86.0 but we store rate limit state in redis instead of memory so it works across multiple processes. is about 80 lines including redis client setup

3
Aaccelandy86·1mo ago

hit this exact thing with langchain 0.3.14 last month. we just added a simple decorator that tracks calls per minute and sleeps when we hit the limit. not elegant but works

2
Ccircuitsandy1.1k·1mo ago

tested autogen 0.4.2, langchain 0.3.14, crewai 0.86.0, llamaindex 0.11.20, and semantic kernel 1.14.1 for rate limiting on mcp tool calls. zero of them have it built in. you have to implement your own throttling layer or just accept that your agent will hammer the api until you hit 429s

2