AI Agent token limitation (400 Error) after many iterations despite wanting to pass 0 context

Hey,

I run into a token limitation issue with my AI agent which I don’t think should happen.
I get data through an API which works fine. The output for my test run is roughly 140 items that are then directly fed into the AI agent. I’m using an Azure AI and a Window Memory Buffer. The context to pass through is set to 0 items.

Depending on the length of the prompt, the number of items that are processed without error differs. The longer the prompt, the fewer items are processed. The error is 400:
400 This model's maximum context length is 128000 tokens. However, your messages resulted in 128090 tokens. Please reduce the length of the messages.
The number of tokens noted in the error message increases with each additional item. I don’t actually want to pass the context from the previous iterations. What would I need to change in order to only pass the information of the individual item for each iteration so that I meet token limitations?

Thank you!

Information on your n8n setup

  • n8n version: 1.67.1
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: MacOS 15