# CREWAI Agent keeps triggering rate limits after tool completion

**URL:** <https://community.crewai.com/t/crewai-agent-keeps-triggering-rate-limits-after-tool-completion/4033>\
**Category:** CrewAI Community Support\
**Tags:** openai, agent\
**Created:** [February 20, 2025, 9:49pm UTC](https://community.crewai.com/t/crewai-agent-keeps-triggering-rate-limits-after-tool-completion/4033 "2025-02-20T21:49:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Weiprecht](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/weiprecht/32/2696_2.png) [@Weiprecht](https://community.crewai.com/u/Weiprecht)\
**Post date:** [February 20, 2025, 9:49pm UTC](https://community.crewai.com/t/crewai-agent-keeps-triggering-rate-limits-after-tool-completion/4033/1 "2025-02-20T21:49:04Z")

</div>

Thank you for your assistance.

I am running an agent to support RAG. I have one tool =\> ‘Create\_vector\_store’ that iterates through a file with txt documents and metadata, reads the txt files, splits/chunks the documents for embedding and storage, stores the documents in a local chroma persistent database, and then ends. The storage and processing works perfectly. But then the agent doesn’t stop there. The agent then sends a request with what I assume to be all the documents at once to an the llm=‘gpt-40-mini’ and triggers a rate limit error:

“2025-02-20 16:28:12,056 - 471248 - llm.py-llm:161 - ERROR: LiteLLM call failed: litellm.RateLimitError: RateLimitError: OpenAIException - Error code: 429 - {‘error’: {‘message’: 'Request too large for gpt-4o-mini in organization org-6cu3xAqhtUTsvd4JH8zSbK4w on tokens per min (TPM): Limit 200000, Requested 598946.”

The agent does not have to do anything except start the tool. I am running a crew with one agent. I have all these parameters:  
verbose=False,  
memory=False,  
cache=True,  
max\_rpm=100,  
share\_crew=False,  
max\_iter=1,  
max\_retry\_limit=1,  
respect\_context\_window=True

I can not find any way to stop the agent or stop it from sending a request.

Any help is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Weiprecht](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/weiprecht/32/2696_2.png) [@Weiprecht](https://community.crewai.com/u/Weiprecht)\
**Post date:** [February 22, 2025, 6:44am UTC](https://community.crewai.com/t/crewai-agent-keeps-triggering-rate-limits-after-tool-completion/4033/2 "2025-02-22T06:44:57Z")

</div>

I did not figure out how to limit returning tokens, but I did discover that I was returning an index from my tool that was triggering the large token request. I just created a json file to hold the index inside of the tool and deleted the return index and that took care of it.
