Reference architecture

AI search with RAG on serverless

Natural-language search over your content that answers simple queries fast, reasons through complex ones, and keeps compute costs proportional to real usage.

All architectures
ai-rag-search.ts
AI search architecture: users query through API Gateway to an orchestrator Lambda that uses a cache, LLM and embedding models, and a vector index. Separately, source content lands in S3 and an indexing Lambda chunks, embeds and validates it into the vector index.UserNatural languageAPI GatewaySearch APIOrchestratorLambda · agentCacheRepeat queriesModelsEmbed · plan · answerVector indexSemantic recallContentDocs · catalogS3Raw contentIndexerChunk · embed · QA

The problem

Keyword search fails when users describe what they want instead of naming it. LLM-powered search fixes that, but naive implementations are slow, expensive to keep running, and only as good as the messy data behind them.

Key design decisions

  1. 01

    Adaptive query paths

    Straightforward queries are embedded and sent directly to semantic retrieval; only ambiguous or multi-step questions enter the agent loop, so most answers return quickly and cheaply.

  2. 02

    Event-driven indexing

    New or changed content lands in S3 and triggers an indexing function that chunks and embeds it with the same embedding model used at query time. There is no always-on ingestion cluster.

  3. 03

    Quality gates on ingestion

    Legacy sources are normalized and checked before they reach the index, because retrieval quality is limited by the data, not the model.

  4. 04

    Caching and pay-per-request compute

    Repeat queries are served from cache and the compute layer scales to zero. We choose a vector store whose pricing fits your traffic, since some serverless vector databases still carry a monthly minimum.

Have a system to build, or a cloud bill to tame?

Tell us what you're working on. We'll come back within one business day with next steps.