An architectural deep-dive into how Unblocked built a context retrieval layer for AI coding agents using MongoDB Atlas, Atlas Search, and Voyage AI rerankers. The article explores combining structured database queries with full-text search, handling multi-tenant data schemas from disparate tools, and empowering agents to write their own aggregation pipelines.
Read original on MongoDB BlogBuilding a context retrieval engine for AI software development agents requires unifying heterogeneous data sources—such as GitHub, Jira, Slack, and Zendesk—each with its own schema. Unblocked solved this by adopting a document-oriented database model in MongoDB Atlas, maintaining raw tool payloads alongside derived metadata fields within container documents.
Effective agentic retrieval cannot rely on semantic search alone. The system balances three distinct query patterns to ensure high accuracy:
A notable architectural pattern in Unblocked's stack is letting AI agents construct their own MongoDB aggregation pipelines. By exposing database schemas and Atlas Search index definitions to the language model, the agent can translate natural language questions directly into optimized data pipelines in a single model turn.
Architectural Trade-off
Allowing agents to write raw aggregation pipelines provides immense query flexibility across diverse third-party schemas, but it demands a robust validation and sandboxing layer before query execution to prevent performance degradation.
Want the fundamentals behind stories like this? Take the free System Design Academy course with certificate.