Large language models used as autonomous agents for enterprise workflows often suffer from context overflow due to verbose tool responses. This study examines context engineering—deliberately managing what information stays in the agent's context—for automated expense itemization in Microsoft Dynamics 365 Finance and Operations. Four configurations were tested on 50 hotel expense tasks: no user model, full conversation history, pruning to the last 5 tool calls, and pruning plus summarization.
Pruning alone improved complete itemization from 71.0% (full history) to 79.0% while cutting token use by 64% and runtime by 62%. Adding summarization achieved the best result: 91.6% complete itemization and 99.64% of the total amount itemized, with nearly the same efficiency as pruning alone. This shows that retaining only the most decision-relevant recent interactions and summarizing older ones can be both more reliable and more efficient than keeping the entire conversation.