Break the context window barrier with Amazon Bedrock AgentCore
Machine Learning Blog
This article explains how to implement Recursive Language Models (RLM) using Amazon Bedrock AgentCore to process documents exceeding model context windows.
- RLM treats documents as external environments, not context window inputs
- Root LLM writes code to explore documents; sub-LLMs analyze specific sections
- Amazon Bedrock AgentCore Code Interpreter provides sandboxed Python runtime with persistent state
- Results stored as Python variables, not consumed from context window
- Achieves 100% success rate vs. 46.7-93.3% for baseline approaches
- Claude Opus 4.6 + RLM: 80% accuracy on financial QA (vs. 66.7% Long Context)
- Claude Sonnet 4.5 + RLM: 76% accuracy on code repository QA (vs. 46% Long Context)
- Tradeoffs: higher latency (seconds to minutes), increased costs, requires careful prompt engineering
RLM enables practical analysis of arbitrarily large documents by decoupling document size from context window limits through iterative code execution and delegated sub-LLM calls.
The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.
The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.