Building and customizing solutions using Microsoft 365 Copilot APIs and tools
The important distinction is between the size of the uploaded PDF and the size of the request ultimately sent to the model. A 7.7 MB PDF can potentially generate a much larger amount of contextual data after processing, particularly when the document contains many images and requires OCR/content extraction. The resulting request may include extracted text, image-related content, attachment metadata, conversation history, and other agent context. Therefore, the 30,000,000 bytes limit in the error should not be interpreted as a 30 MB limit on the original PDF itself. It is a limit on the request body being sent to the OpenAI/model endpoint.
The more interesting part of your case is that even hello fails after the PDF upload. If the problem were simply that the PDF itself exceeded a file-upload limit, you would normally expect the subsequent hello message to work. The fact that unrelated messages continue to produce:
Request body too largeContextTokenLimitExceeded
suggests that some of the conversation/session context created by the attachment may still be included when processing subsequent messages.
This is particularly relevant to Teams because Teams supports persistent conversations. In Copilot Studio, resetting the conversation and clearing the conversation history are not necessarily the same thing. The normal reset behavior can reset variables/state without necessarily removing all conversation history that is being supplied to the planner/model.
The fact that the same agent works correctly in the Microsoft Copilot app but fails in Teams is another strong indication that the agent itself is probably not fundamentally broken. It points more toward a difference in how the Teams channel is maintaining or reconstructing the conversation/session context.
Test this in the following order:
- In the affected Teams conversation, send
start overand then sendhello. - If it still fails, create a completely new Teams conversation/chat with the same agent.
- Send
helloin the new conversation before uploading any file. - If that works, try a small PDF first and then the original PDF.
- If even a brand-new Teams conversation fails with
hello, while the same agent continues to work in Microsoft Copilot, this will be considered as a strong evidence of a Teams/Copilot Studio service-side or session-state issue.