I’m working on an agentic automation use case where I’m sending a large unstructured dataset to an LLM-powered agent to extract structured data in JSON format.
However, I’m encountering this error:
The response exceeded the maximum token limit. Please increase the max tokens limit or reduce the desired output size via prompting.
ErrorCode: Agent.BaseError
How can I avoid hitting the token limit?
Is there a way to increase the max_tokens limit for the response?
If not, how should I split or chunk the input/output to avoid this error?
Are there prompt engineering best practices to reduce output size without losing key field values?
How can I avoid hitting the token limit? Answer: Each LLM model has accepts specified context window which indicates how long input string you can pass. To avoid this break your input in smaller chunk of string. As of now UiPath does not offer much LLM models.
Is there a way to increase the max_tokens limit for the response? Answer: No, you cant increase above provided limit.
If not, how should I split or chunk the input/output to avoid this error? Answer: Break down input into multiple chunk & design multi-modal agentic system to process them. You can make use of sequesntial agents, router agents.
Are there prompt engineering best practices to reduce output size without losing key field values? Answer: You can make use of sequesntial agents where output of one agent acts as a input to other agent. Or you can make use of parallel agentic architecture where each agent process smaller chunk of input & at last all the output feeded to single agent for final response.