<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: saif ur rahman</title>
    <description>The latest articles on DEV Community by saif ur rahman (@saif_urrahman).</description>
    <link>https://dev.to/saif_urrahman</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3719497%2Fd1a2c777-1bc7-466a-ad85-255b158c9ceb.jpg</url>
      <title>DEV Community: saif ur rahman</title>
      <link>https://dev.to/saif_urrahman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saif_urrahman"/>
    <language>en</language>
    <item>
      <title>Drowning in 10,000+ Pages? A Scalable AI Architecture for Turning Unstructured Documents into Actionable Knowledge</title>
      <dc:creator>saif ur rahman</dc:creator>
      <pubDate>Thu, 03 Sep 2026 18:44:40 +0000</pubDate>
      <link>https://dev.to/saif_urrahman/drowning-in-10000-pages-a-scalable-ai-architecture-for-turning-unstructured-documents-into-1ef9</link>
      <guid>https://dev.to/saif_urrahman/drowning-in-10000-pages-a-scalable-ai-architecture-for-turning-unstructured-documents-into-1ef9</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Organizations across almost every industry eventually run into the same wall: information grows faster than any team can reasonably review it. A single business, research project, investigation, healthcare workflow, insurance operation, financial process, compliance program, or enterprise archive can accumulate thousands — sometimes tens of thousands — of pages of documents.&lt;/p&gt;

&lt;p&gt;Those documents rarely arrive in one clean format. A typical collection might include PDFs, scanned PDFs, Word documents, spreadsheets, emails, reports, forms, tables, images, diagrams, handwritten notes, and historical records, mixing structured and unstructured data freely.&lt;/p&gt;

&lt;p&gt;The hard part was never storage. The hard part is turning thousands of heterogeneous pages into something that can be searched, understood, connected, summarized, and verified. A simple document search system isn't enough for that job, and a large language model on its own isn't either. What actually works is a &lt;strong&gt;document intelligence and retrieval pipeline&lt;/strong&gt; — an architecture that converts raw files into a structured knowledge layer, so that AI can reason over 10,000+ pages without ever needing the entire archive stuffed into a single prompt.&lt;/p&gt;

&lt;p&gt;At a high level, the full pipeline looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Documents
   ↓
Document Processing
   ↓
OCR / Extraction
   ↓
Classification &amp;amp; Separation
   ↓
Chunking
   ↓
Embeddings
   ↓
Vector Search
   ↓
Evidence Retrieval
   ↓
AI Reasoning
   ↓
Summaries / Answers / Reports
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach lets an application work with 10,000+ pages &lt;strong&gt;without repeatedly sending the entire document collection to a large language model.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The Real Problem Isn't Document Storage
&lt;/h2&gt;

&lt;p&gt;Uploading 10,000 pages into cloud storage is trivial — S3 handles that without complaint. The difficulty starts the moment someone asks a real question: &lt;em&gt;"Find everything related to the previous condition." "What changed between 2020 and 2024?" "Show all records that mention this subject." "Summarize the entire history."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;At that point the system has to understand the content, not just hold onto it. It helps to think of the problem in layers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    10,000+ PAGES
                           │
        ┌──────────────────┼──────────────────┐
        ▼                  ▼                  ▼
     Storage            Processing          Understanding
        │                  │                  │
        ▼                  ▼                  ▼
       S3              OCR/Parsing          AI Models
                                               │
                                               ▼
                                         Retrieval
                                               │
                                               ▼
                                            Answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The most important insight in the whole architecture is this: &lt;strong&gt;document storage, document understanding, retrieval, and reasoning are four different problems&lt;/strong&gt;, and they shouldn't all be handled by one service.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Why 10,000+ Pages Break the Naive Approach
&lt;/h2&gt;

&lt;p&gt;The obvious first idea is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10,000 pages
     ↓
Large Language Model
     ↓
Summary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That architecture creates several problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Context limitations.&lt;/strong&gt; Even models with very large context windows shouldn't be handed an entire archive for every operation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost.&lt;/strong&gt; Reprocessing the full corpus repeatedly gets expensive fast.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Latency.&lt;/strong&gt; Massive prompts take longer to process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retrieval quality.&lt;/strong&gt; When thousands of unrelated pages are dumped into one context, the model has to do the hard work of separating signal from noise itself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lack of provenance.&lt;/strong&gt; A generic summary often can't tell you exactly which document or page backs up a given statement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repeated computation.&lt;/strong&gt; Unchanged documents shouldn't have to be reanalyzed every time a new question comes in.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The better pattern flips the order of operations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Process once
    ↓
Store structured knowledge
    ↓
Search efficiently
    ↓
Send only relevant evidence to the model
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. The Solution: A Knowledge Pipeline, Not a Prompt
&lt;/h2&gt;

&lt;p&gt;Rather than treating uploaded files as one giant prompt, the goal is to convert them into a reusable knowledge system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Raw Documents
      │
      ▼
Document Processing
      │
      ▼
Normalized Content
      │
      ├───────────────┐
      ▼               ▼
Structured Data      Chunks
      │               │
      ▼               ▼
 PostgreSQL       Embeddings
                      │
                      ▼
                 Vector Index
                      │
                      ▼
                 Retrieval
                      │
                      ▼
                 AI Reasoning
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This produces a &lt;strong&gt;two-speed architecture&lt;/strong&gt;. The first stage — ingestion — is expensive but happens mostly once. The second stage — search and question-answering — is fast and runs every time a user interacts with the system.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Stage One: Ingesting the Documents
&lt;/h2&gt;

&lt;p&gt;Ingestion starts when a large collection is uploaded — a project folder full of PDFs, scans, spreadsheets, and images:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Case / Project / Dataset
│
├── document-001.pdf
├── document-002.pdf
├── report-003.docx
├── scan-004.pdf
├── image-005.png
├── spreadsheet-006.xlsx
└── ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All original files go into durable object storage, organized by project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;s3://document-ai/

projects/
  PROJECT-001/

    original/
    processed/
    pages/
    ocr/
    chunks/
    summaries/
    reports/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The original data should always remain untouched. AI processing creates &lt;strong&gt;derived representations&lt;/strong&gt; rather than replacing the source.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Determining What Each Document Actually Contains
&lt;/h2&gt;

&lt;p&gt;A 10,000-page archive is almost never one uniform dataset:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10,000 pages
      │
      ├── Reports
      ├── Forms
      ├── Correspondence
      ├── Financial records
      ├── Technical records
      ├── Historical records
      ├── Images
      └── Scanned documents
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application therefore needs document classification. Once classified, each document carries metadata like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"document_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"DOC-00021"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"technical_report"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"date"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2025-04-12"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"page_start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;143&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"page_end"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;161&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once documents are classified, downstream processing becomes much more intelligent.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Splitting Large Files into Logical Documents
&lt;/h2&gt;

&lt;p&gt;A single large PDF often contains dozens of separate logical documents stitched together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Pages 1–20
    → Report A

Pages 21–37
    → Report B

Pages 38–55
    → Form Set

Pages 56–92
    → Technical Documentation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of asking &lt;em&gt;"what is this 10,000-page file?"&lt;/em&gt; the system can ask &lt;em&gt;"what is this 15-page report?"&lt;/em&gt; — a much easier question that makes classification, summarization, metadata extraction, and retrieval significantly more precise.&lt;/p&gt;

&lt;p&gt;Managed document services such as Amazon Bedrock Data Automation can help with document processing and splitting workflows; AWS currently documents splitting for source documents up to 3,000 pages. For collections beyond that, the workload can be divided into multiple source files or processing units.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Handling Scanned Documents
&lt;/h2&gt;

&lt;p&gt;A large share of enterprise archives aren't really text documents at all — they're images sitting inside PDFs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDF
 ↓
Scanned Page
 ↓
Image
 ↓
No searchable text
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A normal PDF text parser may return &lt;code&gt;""&lt;/code&gt; even though a human can clearly read the page. This is why OCR is a required processing stage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Scanned page
     ↓
OCR
     ↓
Machine-readable text
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Amazon Textract is one AWS option for extracting text from documents, while open-source OCR engines such as PaddleOCR can provide another implementation path. The important architectural principle is: &lt;strong&gt;never discard the original page image after OCR.&lt;/strong&gt; Store the original page alongside the OCR text, because OCR can contain errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. OCR Is Not the Same as AI Understanding
&lt;/h2&gt;

&lt;p&gt;These steps are often incorrectly treated as one operation. They are actually different:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Image
 ↓
OCR
 ↓
Text
 ↓
Embedding
 ↓
Vector search
 ↓
LLM reasoning
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OCR&lt;/strong&gt; answers: what text is visible?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Embedding&lt;/strong&gt; answers: what is the semantic representation of this content?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vector search&lt;/strong&gt; answers: which stored pieces of content are semantically similar to this query?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM&lt;/strong&gt; answers: what does the retrieved evidence mean in context?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This separation makes the architecture much easier to scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Documents Are Multimodal, Not Just Text
&lt;/h2&gt;

&lt;p&gt;A single page may contain text, a table, a chart, an image, and a diagram all at once:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    SOURCE PAGE
                         │
              ┌──────────┴──────────┐
              ▼                     ▼
            Text                  Visual
              │                     │
              ▼                     ▼
        Text Embedding       Multimodal Embedding
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Amazon Nova Multimodal Embeddings is designed for multimodal retrieval and supports text, images, documents, video, and audio in a common embedding framework — especially valuable for collections containing important visual information.&lt;/p&gt;

&lt;h2&gt;
  
  
  10–11. Chunking: Turning Documents into Searchable Units
&lt;/h2&gt;

&lt;p&gt;After extraction, large documents must be divided into smaller logical pieces. Instead of creating one embedding for a 20-page report:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;20 pages
 ↓
1 vector
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the report is split into logical chunks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;20 pages
 ↓
Section 1
Section 2
Section 3
Section 4
...
 ↓
Multiple vectors
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's no universal perfect chunk size — the better strategy is &lt;strong&gt;structure-aware chunking&lt;/strong&gt;, respecting headings, paragraphs, sections, tables, page boundaries, and semantic meaning rather than cutting text blindly every N characters.&lt;/p&gt;

&lt;p&gt;A practical starting point for many document-search systems is around 700–1,000 words per chunk with moderate overlap, but the real answer comes from benchmarking sizes like 500, 800, 1,200, and 1,500 words against real queries. The goal is &lt;strong&gt;maximum retrieval accuracy with minimum unnecessary context.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  12–13. Embeddings: Turning Content into Searchable Meaning
&lt;/h2&gt;

&lt;p&gt;A keyword search for "thermal issue" may fail to match "the machine experienced repeated overheating problems," even though the concepts are clearly related. A semantic embedding captures that relationship:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Text
 ↓
Embedding Model
 ↓
[0.14, -0.82, 0.31, ...]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The numbers themselves aren't meaningful to a human — their purpose is to place semantically related content near each other in vector space.&lt;/p&gt;

&lt;p&gt;For text-heavy workloads, Amazon Titan Text Embeddings V2 is a practical option, supporting multiple output dimensions including 1024. For mixed text and visual content, Nova Multimodal Embeddings becomes attractive:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Text-heavy
    ↓
Titan Text Embeddings V2
    ↓
S3 Vectors
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Multimodal
    ↓
Nova Multimodal Embeddings
    ↓
S3 Vectors
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The final choice should be made through retrieval benchmarking rather than model specifications alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  14–15. Vector Search and Metadata
&lt;/h2&gt;

&lt;p&gt;Once millions of words become vectors, the application needs an efficient way to find similar content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Document chunks
      ↓
Embeddings
      ↓
S3 Vectors
      ↓
Vector index
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a user searches "previous equipment failures," the system generates a query embedding and searches the index:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Question
   ↓
Embedding Model
   ↓
Query Vector
      ↓
S3 Vectors
      ↓
Top-K similar chunks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A vector alone isn't enough — every vector should carry metadata back to its source:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"project_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"PROJECT-001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"document_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"DOC-00421"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"document_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"report"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"year"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2024&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"page_start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;143&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"page_end"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;145&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"chunk_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"CHUNK-00872"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"source_s3_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"projects/PROJECT-001/chunks/CHUNK-00872.json"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This hybrid approach — metadata filtering plus semantic similarity — is much stronger than pure vector search on its own.&lt;/p&gt;

&lt;h2&gt;
  
  
  16–17. Retrieve Evidence Before Generating
&lt;/h2&gt;

&lt;p&gt;One of the key lessons from this architecture: &lt;strong&gt;do not send raw embedding vectors to the language model and expect it to summarize them.&lt;/strong&gt; The correct pipeline is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Source content
     ↓
Embedding
     ↓
Vector index
     ↓
Query
     ↓
Nearest vectors
     ↓
Original source text
     ↓
AI model
     ↓
Answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, a user asking &lt;em&gt;"Find records discussing previous system failures"&lt;/em&gt; triggers this flow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Question
       ↓
Query Embedding
       ↓
Vector Search
       ↓
Top 5–20 Results
       ↓
Retrieve Source Chunks
       ↓
Build Context
       ↓
Nova
       ↓
Answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The final model receives something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Question:
Find records discussing previous system failures.

Evidence 1:
Report A, page 18
"Repeated overheating was observed..."

Evidence 2:
Maintenance Report, page 4
"Previous thermal failures..."

Evidence 3:
Inspection Report, page 12
"The system had experienced..."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model can then reason over these specific pieces of evidence, and the answer stays traceable back to a document and page.&lt;/p&gt;

&lt;h2&gt;
  
  
  18–19. Hierarchical Summarization
&lt;/h2&gt;

&lt;p&gt;A 10,000-page collection shouldn't have only one summary. Instead, create multiple levels:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10,000+ Pages
      ↓
Documents
      ↓
Document Summaries
      ↓
Category Summaries
      ↓
Year / Time Summaries
      ↓
Cross-Document Analysis
      ↓
Final Summary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Organized another way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PROJECT
│
├── Technical
│   ├── 2022
│   ├── 2023
│   └── 2024
│
├── Financial
│   ├── 2022
│   ├── 2023
│   └── 2024
│
├── Operational
│   ├── 2022
│   └── 2024
│
└── Correspondence
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of feeding 500 documents into one huge prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;500 documents
      ↓
one huge prompt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the hierarchy compresses the corpus step by step:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;500 documents
      ↓
500 document summaries
      ↓
20 category summaries
      ↓
5 yearly summaries
      ↓
1 final synthesis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is effectively a &lt;strong&gt;compression hierarchy&lt;/strong&gt; — the amount of information reaching the final reasoning model shrinks dramatically at each level while the important signal survives.&lt;/p&gt;

&lt;h2&gt;
  
  
  20–21. Batch Processing for Large Archives
&lt;/h2&gt;

&lt;p&gt;A 10,000-page system shouldn't process every document through a synchronous API request. Instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Upload
  ↓
Create Processing Job
  ↓
Queue
  ↓
Workers
  ↓
Parallel Processing
  ↓
Store Results
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Independent tasks run asynchronously:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Document 1 → Summary
Document 2 → Summary
Document 3 → Summary
...
Document 500 → Summary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Amazon Bedrock Batch Inference is designed for exactly this kind of asynchronous batch model processing using data stored in S3, and it's especially useful for work that doesn't depend on live user interaction.&lt;/p&gt;

&lt;h2&gt;
  
  
  22. Not Everything Should Be Batch
&lt;/h2&gt;

&lt;p&gt;Batch processing is excellent for classification, summaries, extraction, and embedding generation. But a live user question needs a real-time path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Understand query
      ↓
Search vectors
      ↓
Retrieve evidence
      ↓
Reason
      ↓
Respond
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A good architecture therefore combines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Batch processing
+
Real-time retrieval
+
Real-time reasoning
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  23. The Role of the Backend
&lt;/h2&gt;

&lt;p&gt;A backend framework such as AdonisJS can function as the orchestration layer. Its role isn't to perform every AI operation itself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AdonisJS
│
├── Authentication
├── Project Management
├── Upload APIs
├── Job Creation
├── Processing Status
├── AWS Integration
├── Search API
├── Report API
└── Business Logic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The heavy work runs through background workers.&lt;/p&gt;

&lt;h2&gt;
  
  
  24. Queue-Based Processing Architecture
&lt;/h2&gt;

&lt;p&gt;A robust workflow chains jobs together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Upload
  │
  ▼
Create Project
  │
  ▼
Document Processing Job
  │
  ▼
Classification Job
  │
  ▼
OCR Job
  │
  ▼
Chunking Job
  │
  ▼
Embedding Job
  │
  ▼
Vector Index Job
  │
  ▼
Summary Job
  │
  ▼
Analysis Job
  │
  ▼
Final Report Job
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each job maintains its own status, progress, attempts, error, start time, and completion time.&lt;/p&gt;

&lt;p&gt;This means a failed operation doesn't require processing the entire archive again.&lt;/p&gt;

&lt;h2&gt;
  
  
  25. PostgreSQL, S3, and S3 Vectors Have Different Jobs
&lt;/h2&gt;

&lt;p&gt;A common architecture mistake is trying to put everything into the vector database. Instead:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PostgreSQL&lt;/strong&gt; stores projects, documents, document types, dates, structured fields, summaries, timeline, processing status, users, and jobs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;S3&lt;/strong&gt; stores original documents, page images, OCR files, chunks, and generated reports.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;S3 Vectors&lt;/strong&gt; stores embeddings, vector metadata, and the retrieval index.&lt;/p&gt;

&lt;p&gt;This gives each storage layer a clear responsibility.&lt;/p&gt;

&lt;h2&gt;
  
  
  26. The Full Knowledge Lifecycle
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                RAW INFORMATION
                       │
                       ▼
              Document Processing
                       │
                       ▼
               Normalized Content
                       │
             ┌─────────┴─────────┐
             ▼                   ▼
       Structured Data          Chunks
             │                   │
             ▼                   ▼
       PostgreSQL           Embeddings
                                 │
                                 ▼
                            S3 Vectors
                                 │
                                 ▼
                             Retrieval
                                 │
                                 ▼
                          Source Evidence
                                 │
                                 ▼
                             AI Reasoning
                                 │
                ┌────────────────┼───────────────┐
                ▼                ▼               ▼
             Answers         Summaries        Reports
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  27. Cost Optimization
&lt;/h2&gt;

&lt;p&gt;Large-document AI systems should be designed around &lt;strong&gt;cost per useful answer&lt;/strong&gt;, not simply cost per page. The expensive mistake:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10,000 pages
     ↓
Large model
     ↓
Every question
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The scalable strategy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Process once
     ↓
Store knowledge
     ↓
Retrieve only relevant information
     ↓
Use AI reasoning on small context
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  28. Use Different Models for Different Jobs
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Classification
      ↓
Small / inexpensive model

High-volume extraction
      ↓
Small / inexpensive model

Document summary
      ↓
Cost-efficient model

Semantic search
      ↓
Embedding model

Complex synthesis
      ↓
More capable reasoning model
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the AWS ecosystem, Amazon Nova models can be divided according to task complexity rather than treating one model as the universal solution.&lt;/p&gt;

&lt;h2&gt;
  
  
  29. Managed Automation vs. a Custom Pipeline
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Managed document intelligence:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;S3
 ↓
BDA
 ↓
Structured document output
 ↓
Embeddings
 ↓
Vector search
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Custom pipeline:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;S3
 ↓
Parser
 ↓
OCR
 ↓
Classification
 ↓
Chunking
 ↓
Embeddings
 ↓
Vector search
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Neither is universally superior — the choice depends on engineering budget, processing volume, document diversity, required accuracy, operational complexity, and AWS cost. A hybrid architecture is often the most practical choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  30. The Hybrid Architecture
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                         10,000+ PAGES
                                │
                                ▼
                               S3
                                │
                                ▼
                    Document Processing
                         BDA / OCR
                                │
                                ▼
                       Classification
                                │
                                ▼
                     Document Separation
                                │
                    ┌───────────┴───────────┐
                    ▼                       ▼
             Structured Data              Text
                    │                       │
                    ▼                       ▼
              PostgreSQL                 Chunking
                                            │
                               ┌────────────┴────────────┐
                               ▼                         ▼
                      Text Embeddings            Visual Embeddings
                               │                         │
                               └────────────┬────────────┘
                                            ▼
                                        S3 Vectors
                                            │
                                            ▼
                                      Semantic Search
                                            │
                                            ▼
                                      Evidence Retrieval
                                            │
                                            ▼
                                      Amazon Nova
                                            │
                          ┌─────────────────┼─────────────────┐
                          ▼                 ▼                 ▼
                       Answers          Analysis           Reports
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  31. Reliability Is More Important Than a Beautiful Demo
&lt;/h2&gt;

&lt;p&gt;A production system needs to answer: &lt;em&gt;where did this statement come from?&lt;/em&gt; Every important generated claim should be traceable to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Project
 ↓
Document
 ↓
Page
 ↓
Chunk
 ↓
Original source
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Finding:
The issue was documented before 2022.

Evidence:
Document: Maintenance Report
Page: 17
Date: 2021-08-04
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is much more trustworthy than a paragraph generated without provenance.&lt;/p&gt;

&lt;h2&gt;
  
  
  32. The Source-of-Truth Principle
&lt;/h2&gt;

&lt;p&gt;AI should never become the permanent source of truth. The source of truth remains the original document:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Original
 ↓
OCR
 ↓
Extracted text
 ↓
Structured facts
 ↓
Embeddings
 ↓
Summaries
 ↓
AI analysis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the AI says something important, the application should be able to travel backward through that chain.&lt;/p&gt;

&lt;h2&gt;
  
  
  33. Contradiction Detection, Timelines, and Missing Information
&lt;/h2&gt;

&lt;p&gt;Once documents are structured and searchable, the same architecture supports higher-level analysis. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Document A:
"System was operational."

Document B:
"System was offline."

Document C:
"Maintenance required due to failure."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The system can identify a &lt;strong&gt;potential contradiction&lt;/strong&gt; — but this should be treated as an AI-generated analytical finding, not automatically as established truth. The application should show both source statements so the user can verify the issue.&lt;/p&gt;

&lt;p&gt;Dates extracted across the archive can be assembled into a chronological layer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2021-02-10 → First reported issue
2021-06-15 → Maintenance performed
2022-01-09 → New failure
2022-03-21 → Investigation
2023-04-17 → Final report
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And gaps in the record can be flagged the same way — if the archive contains 2021, 2022, and 2024 reports but nothing for 2023, the AI can flag that 2023 records may be missing, again as a finding that requires verification rather than an absolute fact.&lt;/p&gt;

&lt;h2&gt;
  
  
  34. From Search Engine to Knowledge System
&lt;/h2&gt;

&lt;p&gt;Early on, the application may look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Upload
+
Search
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After building the complete pipeline, it becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DOCUMENT INTELLIGENCE PLATFORM
│
├── Search
├── Question Answering
├── Summarization
├── Timeline
├── Classification
├── Structured Extraction
├── Contradiction Detection
├── Evidence Retrieval
├── Reports
└── Cross-Document Analysis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The vector database is only one component. The real product is the &lt;strong&gt;knowledge layer built around the document corpus.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  35. A Practical MVP
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Phase 1:&lt;/strong&gt; S3 upload, PDF/document extraction, OCR, document classification, chunking, embeddings, S3 Vectors, semantic search.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phase 2:&lt;/strong&gt; Document summaries, category summaries, structured extraction, AI Q&amp;amp;A.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phase 3:&lt;/strong&gt; Timeline, contradiction detection, missing information, final reports.&lt;/p&gt;

&lt;p&gt;This reduces implementation risk by sequencing the hardest infrastructure first and the more advanced analytical features later.&lt;/p&gt;

&lt;h2&gt;
  
  
  36. Recommended AWS Architecture
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                         USER
                           │
                           ▼
                       Next.js
                           │
                           ▼
                       AdonisJS
                           │
            ┌──────────────┼──────────────┐
            ▼              ▼              ▼
          S3            PostgreSQL       SQS
            │                              │
            │                              ▼
            │                           Workers
            │                              │
            ▼                              ▼
     Document Processing          OCR / Classification
                                           │
                                           ▼
                                       Chunking
                                           │
                                           ▼
                                      Embeddings
                                           │
                                           ▼
                                      S3 Vectors
                                           │
                                           ▼
                                      Retrieval
                                           │
                                           ▼
                                         Nova
                                           │
                        ┌──────────────────┼─────────────────┐
                        ▼                  ▼                 ▼
                     Answers           Analysis           Reports
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This architecture separates storage, processing, orchestration, retrieval, and reasoning.&lt;/p&gt;

&lt;h2&gt;
  
  
  37. Ten Rules for Building This Kind of System
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Never treat 10,000 pages as one prompt.&lt;/strong&gt; Break information into manageable, meaningful units.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preserve the original documents.&lt;/strong&gt; AI-generated derivatives should never replace source evidence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OCR and embeddings solve different problems.&lt;/strong&gt; OCR extracts text; embeddings create searchable semantic representations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vectors are for retrieval, not generation.&lt;/strong&gt; Retrieve the source content before asking a reasoning model to answer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use metadata with vectors.&lt;/strong&gt; Category, date, document ID, page and source information greatly improve retrieval.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use batch processing for independent large-volume work.&lt;/strong&gt; Don't make a single HTTP request responsible for processing an entire archive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use hierarchical summarization.&lt;/strong&gt; Document → category → period → final synthesis.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep evidence provenance.&lt;/strong&gt; Every important AI finding should be traceable to its source.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use different models for different jobs.&lt;/strong&gt; Cheap models for repetitive work; stronger models for difficult reasoning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Benchmark the complete pipeline.&lt;/strong&gt; Accuracy, retrieval quality, processing time, cost, and reliability matter more than any individual model specification.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  38. The Final Architecture in One Picture
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                ┌─────────────────────────────┐
                │       10,000+ PAGES         │
                │ PDFs / DOCX / Scans / Images│
                └──────────────┬──────────────┘
                               │
                               ▼
                         ┌───────────┐
                         │    S3     │
                         └─────┬─────┘
                               │
                               ▼
                    ┌─────────────────────┐
                    │ Document Processing │
                    │     BDA / OCR       │
                    └──────────┬──────────┘
                               │
                               ▼
                     ┌──────────────────┐
                     │ Classification   │
                     │ &amp;amp; Separation     │
                     └────────┬─────────┘
                              │
                ┌─────────────┴──────────────┐
                ▼                            ▼
       ┌─────────────────┐          ┌────────────────┐
       │ Structured Data │          │ Logical Chunks │
       └────────┬────────┘          └───────┬────────┘
                │                           │
                ▼                           ▼
          PostgreSQL                  Embedding Model
                                            │
                              ┌─────────────┴─────────────┐
                              ▼                           ▼
                       Text Embedding             Multimodal
                                                    Embedding
                              │                           │
                              └─────────────┬─────────────┘
                                            ▼
                                      ┌────────────┐
                                      │ S3 Vectors │
                                      └──────┬─────┘
                                             │
                                             ▼
                                      Query / Search
                                             │
                                             ▼
                                     Relevant Evidence
                                             │
                                             ▼
                                      Amazon Nova
                                             │
                     ┌───────────────────────┼──────────────────────┐
                     ▼                       ▼                      ▼
                  Q&amp;amp;A Answer             Analysis               Report
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;10,000+ page problem&lt;/strong&gt; is not fundamentally a problem of storing large files. Storage is relatively easy.&lt;/p&gt;

&lt;p&gt;The real challenge is transforming massive amounts of heterogeneous information into a system that can answer questions accurately, retrieve supporting evidence, understand relationships across documents, and generate useful summaries.&lt;/p&gt;

&lt;p&gt;The solution is not:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10,000 pages → one giant AI prompt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10,000+ pages
      ↓
Document processing
      ↓
OCR / extraction
      ↓
Classification
      ↓
Logical separation
      ↓
Chunking
      ↓
Embeddings
      ↓
Vector indexing
      ↓
Semantic retrieval
      ↓
Relevant source evidence
      ↓
AI reasoning
      ↓
Answers + summaries + reports
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This architecture turns an enormous document collection into a reusable &lt;strong&gt;knowledge layer&lt;/strong&gt;. Once that knowledge layer exists, the same underlying infrastructure can support many applications across industries: enterprise archives, compliance, research, insurance, healthcare, financial analysis, engineering, investigations, operations, and other document-heavy workflows.&lt;/p&gt;

&lt;p&gt;The key idea is simple: do the expensive document understanding once, store the resulting knowledge intelligently, retrieve only what matters, and use AI reasoning on the relevant evidence rather than the entire archive. That's what makes AI analysis of 10,000+ pages practical, scalable, and economically sustainable.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>aws</category>
      <category>automation</category>
    </item>
    <item>
      <title>How Amazon SQS Saved My AI Application: Lessons Learned While Building a Production AI System on AWS</title>
      <dc:creator>saif ur rahman</dc:creator>
      <pubDate>Wed, 15 Jul 2026 12:54:08 +0000</pubDate>
      <link>https://dev.to/saif_urrahman/how-amazon-sqs-saved-my-ai-application-lessons-learned-while-building-a-production-ai-system-on-aws-hn4</link>
      <guid>https://dev.to/saif_urrahman/how-amazon-sqs-saved-my-ai-application-lessons-learned-while-building-a-production-ai-system-on-aws-hn4</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;When I first started building an AI-powered application using Amazon Bedrock, everything looked perfect.&lt;/p&gt;

&lt;p&gt;The architecture was simple, clean, and easy to understand.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client
   │
AWS Lambda
   │
Amazon Bedrock
   │
Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;During development, I tested the application with only a few requests. AI responses were generated successfully, users received their results within seconds, and there were no noticeable performance issues. At that stage, I believed the architecture was production-ready.&lt;/p&gt;

&lt;p&gt;However, reality was very different once multiple users started using the application simultaneously.&lt;/p&gt;

&lt;p&gt;What worked flawlessly during development quickly became unreliable in production.&lt;/p&gt;

&lt;p&gt;This article shares the real architectural challenge I encountered, why it happened, and how introducing Amazon SQS completely transformed the reliability and scalability of the application.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Project
&lt;/h1&gt;

&lt;p&gt;The application allows users to submit company information and receive an AI-generated due diligence report powered by Amazon Bedrock.&lt;/p&gt;

&lt;p&gt;Each request involves several steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Receiving the user's request&lt;/li&gt;
&lt;li&gt;Validating the payload&lt;/li&gt;
&lt;li&gt;Fetching additional company information&lt;/li&gt;
&lt;li&gt;Building a detailed prompt&lt;/li&gt;
&lt;li&gt;Sending the prompt to Amazon Bedrock&lt;/li&gt;
&lt;li&gt;Generating a large AI response&lt;/li&gt;
&lt;li&gt;Processing the output&lt;/li&gt;
&lt;li&gt;Storing the generated report&lt;/li&gt;
&lt;li&gt;Returning the final result to the user&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Although this workflow sounds straightforward, AI inference is significantly slower than a typical REST API request.&lt;/p&gt;

&lt;p&gt;A single report could take anywhere from 20 to 90 seconds depending on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prompt size&lt;/li&gt;
&lt;li&gt;Amount of company data&lt;/li&gt;
&lt;li&gt;Model response length&lt;/li&gt;
&lt;li&gt;Current Bedrock workload&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For one user, this was acceptable.&lt;/p&gt;

&lt;p&gt;For dozens of concurrent users, it became a serious architectural problem.&lt;/p&gt;

&lt;h1&gt;
  
  
  My Initial Architecture
&lt;/h1&gt;

&lt;p&gt;The first version of the system looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                Client
                   │
                   ▼
             AWS Lambda
                   │
                   ▼
          Amazon Bedrock
                   │
                   ▼
          Return AI Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Lambda function performed every task synchronously.&lt;/p&gt;

&lt;p&gt;It waited for Amazon Bedrock to finish generating the report before sending a response back to the client.&lt;/p&gt;

&lt;p&gt;At first glance, this architecture seems reasonable.&lt;/p&gt;

&lt;p&gt;Unfortunately, production traffic exposed several hidden problems.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Production Issues
&lt;/h1&gt;

&lt;p&gt;After deployment, more users began submitting report generation requests at the same time.&lt;/p&gt;

&lt;p&gt;Almost immediately, several issues appeared.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Long Waiting Times
&lt;/h2&gt;

&lt;p&gt;Users had to keep their browser open while waiting for the AI model to finish.&lt;/p&gt;

&lt;p&gt;Some reports required over a minute to complete.&lt;/p&gt;

&lt;p&gt;Many users assumed the application had frozen and refreshed the page, unknowingly creating duplicate requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Lambda Execution Time Increased
&lt;/h2&gt;

&lt;p&gt;Since Lambda remained active throughout the entire AI generation process, execution times became unnecessarily long.&lt;/p&gt;

&lt;p&gt;Long-running Lambda functions increase both execution cost and the likelihood of timeout failures.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Traffic Spikes Overwhelmed the System
&lt;/h2&gt;

&lt;p&gt;During busy periods, many requests reached Lambda simultaneously.&lt;/p&gt;

&lt;p&gt;Every Lambda invocation immediately attempted to call Amazon Bedrock.&lt;/p&gt;

&lt;p&gt;This created sudden spikes in downstream traffic.&lt;/p&gt;

&lt;p&gt;Even though AWS Lambda scales automatically, sending every request directly to the AI model at the same time is not always the most efficient or resilient design.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Temporary Failures Meant Lost Requests
&lt;/h2&gt;

&lt;p&gt;Sometimes an AI request failed because of a temporary service interruption, a network issue, or a transient downstream error.&lt;/p&gt;

&lt;p&gt;Without a buffering mechanism, the entire user request failed and had to be submitted again manually.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. No Visibility Into Processing
&lt;/h2&gt;

&lt;p&gt;The client had no way to determine whether:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the request was queued,&lt;/li&gt;
&lt;li&gt;the AI model was still processing,&lt;/li&gt;
&lt;li&gt;the report had completed successfully, or&lt;/li&gt;
&lt;li&gt;the request had failed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From the user's perspective, everything simply appeared to be "loading."&lt;/p&gt;

&lt;h1&gt;
  
  
  Understanding the Root Cause
&lt;/h1&gt;

&lt;p&gt;The core problem was architectural rather than service-related.&lt;/p&gt;

&lt;p&gt;The application relied entirely on synchronous processing.&lt;/p&gt;

&lt;p&gt;The client waited for every step of the workflow to complete before receiving any response.&lt;/p&gt;

&lt;p&gt;This approach is suitable for lightweight APIs but not for long-running AI workloads where inference time is unpredictable.&lt;/p&gt;

&lt;p&gt;What the application needed was a way to separate request acceptance from request processing.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Solution: Introducing Amazon SQS
&lt;/h1&gt;

&lt;p&gt;Instead of invoking Amazon Bedrock immediately, I redesigned the architecture around asynchronous messaging using Amazon SQS.&lt;/p&gt;

&lt;p&gt;The updated architecture became:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                  Client
                     │
                     ▼
               API Gateway
                     │
                     ▼
                 AWS Lambda
                     │
                     ▼
                Amazon SQS
                     │
                     ▼
              Lambda Worker
                     │
                     ▼
             Amazon Bedrock
                     │
                     ▼
          Store Generated Report
                     │
                     ▼
             Notify / Poll Client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This small architectural change dramatically improved the overall system.&lt;/p&gt;

&lt;h1&gt;
  
  
  How the New Workflow Operates
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Step 1
&lt;/h3&gt;

&lt;p&gt;The client submits a report generation request.&lt;/p&gt;

&lt;p&gt;Instead of waiting for AI processing to complete, the API immediately validates the request.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2
&lt;/h3&gt;

&lt;p&gt;The Lambda function creates a message containing the request details and places it into Amazon SQS.&lt;/p&gt;

&lt;p&gt;The client instantly receives a confirmation along with a tracking ID.&lt;/p&gt;

&lt;p&gt;The request is now safely stored in the queue.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3
&lt;/h3&gt;

&lt;p&gt;Lambda workers automatically consume messages from the queue.&lt;/p&gt;

&lt;p&gt;Each worker independently processes a single report request.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4
&lt;/h3&gt;

&lt;p&gt;The worker invokes Amazon Bedrock to generate the AI report.&lt;/p&gt;

&lt;p&gt;Since this happens in the background, users no longer have to wait for the model to finish before receiving an acknowledgment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5
&lt;/h3&gt;

&lt;p&gt;Once processing completes, the report is stored (for example, in Amazon S3 or a database), and the request status is updated.&lt;/p&gt;

&lt;p&gt;The client can either poll for completion or receive a notification when the report is ready.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why Amazon SQS Made Such a Difference
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Automatic Retry
&lt;/h2&gt;

&lt;p&gt;Distributed systems occasionally experience temporary failures.&lt;/p&gt;

&lt;p&gt;Instead of losing a request immediately, Amazon SQS keeps the message available.&lt;/p&gt;

&lt;p&gt;If a Lambda worker encounters a transient error, the message becomes visible again after the visibility timeout expires, allowing another processing attempt.&lt;/p&gt;

&lt;p&gt;This significantly improves resilience without requiring custom retry logic for every failure scenario.&lt;/p&gt;

&lt;h2&gt;
  
  
  Built-in Scalability
&lt;/h2&gt;

&lt;p&gt;One of the biggest advantages of SQS is that it naturally absorbs sudden traffic spikes.&lt;/p&gt;

&lt;p&gt;Instead of sending hundreds of AI requests directly to Amazon Bedrock at once, incoming requests are buffered in the queue.&lt;/p&gt;

&lt;p&gt;Lambda workers then process messages at a pace the system can handle.&lt;/p&gt;

&lt;p&gt;As demand grows, AWS automatically scales the number of Lambda workers consuming messages from the queue.&lt;/p&gt;

&lt;p&gt;The application remains responsive because the API is no longer blocked by long-running AI inference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dead Letter Queue (DLQ)
&lt;/h2&gt;

&lt;p&gt;No system can guarantee that every request will succeed.&lt;/p&gt;

&lt;p&gt;Some messages may fail repeatedly because of invalid input, corrupted data, or unexpected processing errors.&lt;/p&gt;

&lt;p&gt;By configuring a Dead Letter Queue (DLQ), failed messages are automatically moved aside after a defined number of unsuccessful processing attempts.&lt;/p&gt;

&lt;p&gt;This prevents problematic messages from blocking the queue while preserving them for investigation and replay.&lt;/p&gt;

&lt;p&gt;Instead of silently losing data, operations teams have full visibility into failed requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Improved Reliability
&lt;/h2&gt;

&lt;p&gt;The queue acts as a protective buffer between the public API and the AI processing layer.&lt;/p&gt;

&lt;p&gt;Even if Amazon Bedrock experiences temporary latency or downstream services become slower than usual, new user requests continue to be accepted and safely stored.&lt;/p&gt;

&lt;p&gt;This decoupled architecture makes the entire system more resilient to fluctuations in traffic and temporary service disruptions.&lt;/p&gt;

&lt;h1&gt;
  
  
  Results After the Migration
&lt;/h1&gt;

&lt;p&gt;After moving to an event-driven architecture with Amazon SQS, the application behaved much more predictably under load.&lt;/p&gt;

&lt;p&gt;Some of the key improvements included:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Immediate API responses instead of long waits.&lt;/li&gt;
&lt;li&gt;Better handling of concurrent user traffic.&lt;/li&gt;
&lt;li&gt;Reduced risk of request failures during temporary service interruptions.&lt;/li&gt;
&lt;li&gt;Automatic retry behavior for transient processing errors.&lt;/li&gt;
&lt;li&gt;Better visibility into request status.&lt;/li&gt;
&lt;li&gt;Isolation of failed messages using a Dead Letter Queue.&lt;/li&gt;
&lt;li&gt;Improved scalability without redesigning the application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most importantly, users no longer experienced failed requests simply because AI processing took longer than expected.&lt;/p&gt;

&lt;h1&gt;
  
  
  Lessons Learned
&lt;/h1&gt;

&lt;p&gt;One of the biggest lessons I learned while building production AI systems is that &lt;strong&gt;the challenge is rarely the AI model itself—it is the architecture around it&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Amazon Bedrock provides powerful foundation models, but long-running AI inference should not be tightly coupled to user-facing APIs.&lt;/p&gt;

&lt;p&gt;By introducing Amazon SQS, I transformed the application from a synchronous workflow into a resilient, event-driven system capable of handling production traffic more effectively.&lt;/p&gt;

&lt;p&gt;If you're building AI applications on AWS, don't wait until production traffic exposes architectural bottlenecks. Designing with asynchronous processing, retries, buffering, and fault isolation from the start will save you significant time and improve the experience for both your users and your operations team.&lt;/p&gt;

&lt;p&gt;Serverless AI applications are most successful when every component has a single responsibility, and Amazon SQS is one of the simplest yet most effective services for achieving that goal.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>ai</category>
      <category>sqs</category>
    </item>
    <item>
      <title>Your Prompt Isn't the Problem: Why System Prompts Matter More Than User Prompts in Production AI Applications</title>
      <dc:creator>saif ur rahman</dc:creator>
      <pubDate>Fri, 26 Jun 2026 03:32:00 +0000</pubDate>
      <link>https://dev.to/saif_urrahman/your-prompt-isnt-the-problem-why-system-prompts-matter-more-than-user-prompts-in-production-ai-1fko</link>
      <guid>https://dev.to/saif_urrahman/your-prompt-isnt-the-problem-why-system-prompts-matter-more-than-user-prompts-in-production-ai-1fko</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;When developers first start building AI applications, they usually focus on one thing:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The prompt.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can I make Claude respond better?&lt;/li&gt;
&lt;li&gt;How do I reduce hallucinations?&lt;/li&gt;
&lt;li&gt;Why is my AI giving inconsistent results?&lt;/li&gt;
&lt;li&gt;Should I use Chain of Thought?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;become common.&lt;/p&gt;

&lt;p&gt;Most teams spend days optimizing user prompts.&lt;/p&gt;

&lt;p&gt;Very few spend time designing system prompts.&lt;/p&gt;

&lt;p&gt;And that's where the real problem begins.&lt;/p&gt;

&lt;p&gt;Recently, while building an AI-powered Due Diligence and Compliance Reporting platform using Amazon Bedrock and Claude, we discovered that prompt quality wasn't our biggest issue.&lt;/p&gt;

&lt;p&gt;The real issue was a lack of system-level instructions.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Our application generated forensic risk reports.&lt;/p&gt;

&lt;p&gt;The workflow was simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Input
      ↓
Claude
      ↓
Generated Report
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Users provided:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"companyName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Microsoft Corporation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"country"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"United States"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;along with intelligence gathered from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Companies House&lt;/li&gt;
&lt;li&gt;OFAC&lt;/li&gt;
&lt;li&gt;OpenSanctions&lt;/li&gt;
&lt;li&gt;News APIs&lt;/li&gt;
&lt;li&gt;Regulatory Sources&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The AI then generated a complete report.&lt;/p&gt;

&lt;p&gt;Everything seemed fine.&lt;/p&gt;

&lt;p&gt;Until we started testing at scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  Symptoms We Observed
&lt;/h2&gt;

&lt;p&gt;The exact same data often produced different outputs.&lt;/p&gt;

&lt;p&gt;Sometimes Claude generated:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Low Risk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the same company.&lt;/p&gt;

&lt;p&gt;Minutes later:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Medium Risk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for nearly identical input.&lt;/p&gt;

&lt;p&gt;Other times:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sections appeared in different orders&lt;/li&gt;
&lt;li&gt;Risk scores changed&lt;/li&gt;
&lt;li&gt;HTML formatting broke&lt;/li&gt;
&lt;li&gt;Compliance recommendations varied&lt;/li&gt;
&lt;li&gt;Findings were summarized differently&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The model wasn't hallucinating.&lt;/p&gt;

&lt;p&gt;It was doing exactly what we asked.&lt;/p&gt;

&lt;p&gt;The problem was that we hadn't told it enough.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Original Prompt
&lt;/h2&gt;

&lt;p&gt;Our first implementation looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Generate an integrity due diligence report for the company using the data below.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we appended the API results.&lt;/p&gt;

&lt;p&gt;That was it.&lt;/p&gt;

&lt;p&gt;No structure.&lt;/p&gt;

&lt;p&gt;No scoring methodology.&lt;/p&gt;

&lt;p&gt;No formatting rules.&lt;/p&gt;

&lt;p&gt;No output constraints.&lt;/p&gt;

&lt;p&gt;The model had too much freedom.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Happens
&lt;/h2&gt;

&lt;p&gt;LLMs are prediction engines.&lt;/p&gt;

&lt;p&gt;If instructions are vague:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Generate a report
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the model must decide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Format&lt;/li&gt;
&lt;li&gt;Structure&lt;/li&gt;
&lt;li&gt;Tone&lt;/li&gt;
&lt;li&gt;Risk methodology&lt;/li&gt;
&lt;li&gt;Recommendation logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;on its own.&lt;/p&gt;

&lt;p&gt;Different reasoning paths produce different outputs.&lt;/p&gt;

&lt;p&gt;This creates inconsistency.&lt;/p&gt;

&lt;p&gt;And inconsistency is dangerous in production systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Solution
&lt;/h2&gt;

&lt;p&gt;We stopped optimizing the user prompt.&lt;/p&gt;

&lt;p&gt;Instead, we designed a comprehensive system prompt.&lt;/p&gt;

&lt;p&gt;Architecture changed from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Prompt
      ↓
Claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;System Prompt
      ↓
User Prompt
      ↓
Claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The system prompt became the source of truth.&lt;/p&gt;

&lt;h2&gt;
  
  
  What We Added
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Output Constraints
&lt;/h3&gt;

&lt;p&gt;Instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Generate a report
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we specified:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Output MUST be valid HTML.
Do NOT use markdown.
Do NOT use emojis.
Do NOT use conversational language.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now every response followed the same format.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fixed Section Order
&lt;/h3&gt;

&lt;p&gt;We enforced:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Executive Summary
2. Entity Overview
3. Registry Findings
4. Sanctions Analysis
5. PEP Analysis
6. Litigation Review
7. Adverse Media Review
8. Risk Assessment
9. Recommendation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model could no longer rearrange sections.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deterministic Risk Scoring
&lt;/h3&gt;

&lt;p&gt;Before:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Assess risk.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sanctions = 30%
PEP = 20%
Corruption = 20%
Litigation = 15%
Media = 15%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every report now followed the same methodology.&lt;/p&gt;

&lt;h3&gt;
  
  
  Anti-Hallucination Rules
&lt;/h3&gt;

&lt;p&gt;One of the most important additions was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Do not invent information.
Use only provided data.
If data is unavailable, explicitly state:
"No data available from provided sources."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This dramatically improved reliability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before vs After
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Before
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Medium Risk

Reason:
Potential concerns observed.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No explanation.&lt;/p&gt;

&lt;p&gt;No evidence.&lt;/p&gt;

&lt;p&gt;No consistency.&lt;/p&gt;

&lt;h3&gt;
  
  
  After
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Risk Score: 25

Sanctions:
0/100

Evidence:
No OFAC matches found.

Source:
OFAC API
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now every score was traceable.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Hidden Benefit
&lt;/h2&gt;

&lt;p&gt;Most teams think prompts only improve output quality.&lt;/p&gt;

&lt;p&gt;In reality, strong system prompts also improve:&lt;/p&gt;

&lt;h3&gt;
  
  
  Maintainability
&lt;/h3&gt;

&lt;p&gt;When requirements change:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Add ownership analysis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you update one system prompt.&lt;/p&gt;

&lt;p&gt;Not every user prompt.&lt;/p&gt;

&lt;h3&gt;
  
  
  Debugging
&lt;/h3&gt;

&lt;p&gt;When issues occur:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Why did risk increase?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you can inspect scoring rules directly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Compliance
&lt;/h3&gt;

&lt;p&gt;Auditors want repeatable processes.&lt;/p&gt;

&lt;p&gt;System prompts create consistency.&lt;/p&gt;

&lt;p&gt;Ad hoc prompting does not.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Production Pattern
&lt;/h2&gt;

&lt;p&gt;Today our AI architecture looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;System Prompt
      ↓
API Data
      ↓
User Instructions
      ↓
Claude
      ↓
Structured HTML Report
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The system prompt defines behavior.&lt;/p&gt;

&lt;p&gt;The user prompt provides context.&lt;/p&gt;

&lt;p&gt;This separation dramatically improves reliability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;p&gt;The biggest mistake we made was treating prompts like chat messages.&lt;/p&gt;

&lt;p&gt;Production AI systems are not chatbots.&lt;/p&gt;

&lt;p&gt;They are software systems.&lt;/p&gt;

&lt;p&gt;Software systems require:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rules&lt;/li&gt;
&lt;li&gt;Constraints&lt;/li&gt;
&lt;li&gt;Validation&lt;/li&gt;
&lt;li&gt;Predictability&lt;/li&gt;
&lt;li&gt;Repeatability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;System prompts provide those guarantees.&lt;/p&gt;

&lt;h2&gt;
  
  
  Best Practices for Production AI
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Keep User Prompts Small
&lt;/h3&gt;

&lt;p&gt;User prompts should contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Data
Context
Specific Request
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nothing more.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Move Rules to System Prompts
&lt;/h3&gt;

&lt;p&gt;Examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Output format
Scoring logic
Compliance requirements
Validation rules
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Prevent Hallucinations Explicitly
&lt;/h3&gt;

&lt;p&gt;Always include:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Do not invent information.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Define Failure Behavior
&lt;/h3&gt;

&lt;p&gt;Specify:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;If data unavailable:
State that clearly.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Never leave the model guessing.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Standardize Output
&lt;/h3&gt;

&lt;p&gt;Use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;JSON
HTML
XML
Markdown
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but choose one and enforce it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Many AI teams spend weeks optimizing prompts.&lt;/p&gt;

&lt;p&gt;Few invest time designing system prompts.&lt;/p&gt;

&lt;p&gt;Yet system prompts are often the difference between:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Interesting Demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Production Application
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your AI outputs are inconsistent, unpredictable, or difficult to maintain, don't start by rewriting your user prompts.&lt;/p&gt;

&lt;p&gt;Start by asking:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does my model actually know the rules it's supposed to follow?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Because most of the time, the prompt isn't the problem.&lt;/p&gt;

&lt;p&gt;The missing system prompt is.&lt;/p&gt;

</description>
      <category>prompt</category>
      <category>aws</category>
      <category>bedrock</category>
      <category>genrativeai</category>
    </item>
    <item>
      <title>The Day DNS Broke Our Deployment: Solving a Serverless Framework S3 Resolution Failure on AWS</title>
      <dc:creator>saif ur rahman</dc:creator>
      <pubDate>Wed, 24 Jun 2026 12:03:50 +0000</pubDate>
      <link>https://dev.to/saif_urrahman/the-day-dns-broke-our-deployment-solving-a-serverless-framework-s3-resolution-failure-on-aws-2kad</link>
      <guid>https://dev.to/saif_urrahman/the-day-dns-broke-our-deployment-solving-a-serverless-framework-s3-resolution-failure-on-aws-2kad</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;As engineers, we often spend hours optimizing code, improving prompts, and scaling infrastructure.&lt;/p&gt;

&lt;p&gt;But sometimes the biggest production issues come from something much simpler.&lt;/p&gt;

&lt;p&gt;A DNS lookup.&lt;/p&gt;

&lt;p&gt;Recently, while deploying a serverless AI application to AWS, I encountered an error that completely blocked deployment.&lt;/p&gt;

&lt;p&gt;The application hadn't changed.&lt;/p&gt;

&lt;p&gt;AWS was healthy.&lt;/p&gt;

&lt;p&gt;Permissions were correct.&lt;/p&gt;

&lt;p&gt;The deployment package was valid.&lt;/p&gt;

&lt;p&gt;Yet every deployment failed.&lt;/p&gt;

&lt;p&gt;The error looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Error:
getaddrinfo EAI_AGAIN serverless-framework-deployments-eu-north-1-xxxxxxxx.s3.eu-north-1.amazonaws.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first glance, it looked like an AWS outage.&lt;/p&gt;

&lt;p&gt;It wasn't.&lt;/p&gt;

&lt;p&gt;This is the story of how a simple DNS resolution issue brought an entire deployment pipeline to a halt—and how we fixed it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Project
&lt;/h2&gt;

&lt;p&gt;The application was an AI-powered Due Diligence Platform built with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Lambda&lt;/li&gt;
&lt;li&gt;Amazon Bedrock&lt;/li&gt;
&lt;li&gt;Amazon DynamoDB&lt;/li&gt;
&lt;li&gt;Amazon SQS&lt;/li&gt;
&lt;li&gt;Serverless Framework&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Deployment flow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Developer
     ↓
Serverless Framework
     ↓
S3 Deployment Bucket
     ↓
CloudFormation
     ↓
Lambda Functions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every deployment package is first uploaded to an S3 bucket created by the Serverless Framework.&lt;/p&gt;

&lt;p&gt;Only after the upload succeeds does CloudFormation update the stack.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Error
&lt;/h2&gt;

&lt;p&gt;During deployment, the terminal suddenly returned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;serverless deploy

✖ Error:
getaddrinfo EAI_AGAIN serverless-framework-deployments-eu-north-1-xxxxxxxx.s3.eu-north-1.amazonaws.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The deployment stopped immediately.&lt;/p&gt;

&lt;p&gt;No Lambda updates.&lt;/p&gt;

&lt;p&gt;No CloudFormation changes.&lt;/p&gt;

&lt;p&gt;Nothing.&lt;/p&gt;

&lt;h2&gt;
  
  
  First Assumption: AWS Was Down
&lt;/h2&gt;

&lt;p&gt;The first thing I checked was AWS Service Health.&lt;/p&gt;

&lt;p&gt;Everything was operational.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;S3 was healthy&lt;/li&gt;
&lt;li&gt;CloudFormation was healthy&lt;/li&gt;
&lt;li&gt;Lambda was healthy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No incidents were reported.&lt;/p&gt;

&lt;h2&gt;
  
  
  Second Assumption: IAM Permissions
&lt;/h2&gt;

&lt;p&gt;The next suspect was permissions.&lt;/p&gt;

&lt;p&gt;I verified:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws sts get-caller-identity
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Account"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"123456789012"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Arn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:iam::123456789012:user/developer"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Credentials were valid.&lt;/p&gt;

&lt;p&gt;Permissions were correct.&lt;/p&gt;

&lt;p&gt;Still failing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Third Assumption: Serverless Framework Bug
&lt;/h2&gt;

&lt;p&gt;I upgraded Serverless Framework.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; serverless
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deployment still failed.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Problem
&lt;/h2&gt;

&lt;p&gt;The key clue was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;EAI_AGAIN
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is not an AWS error.&lt;/p&gt;

&lt;p&gt;It is a DNS resolution error.&lt;/p&gt;

&lt;p&gt;Specifically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EAI_AGAIN
=
Temporary DNS lookup failure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The operating system could not resolve the S3 endpoint hostname.&lt;/p&gt;

&lt;p&gt;The request never reached AWS.&lt;/p&gt;

&lt;h2&gt;
  
  
  How We Confirmed It
&lt;/h2&gt;

&lt;p&gt;I manually tested DNS resolution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nslookup google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Intermittent failures appeared.&lt;/p&gt;

&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nslookup s3.eu-north-1.amazonaws.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same issue occurred.&lt;/p&gt;

&lt;p&gt;This confirmed that the problem existed locally.&lt;/p&gt;

&lt;p&gt;Not in AWS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Root Cause
&lt;/h2&gt;

&lt;p&gt;The machine was using an unstable DNS resolver.&lt;/p&gt;

&lt;p&gt;Under heavy network usage, DNS lookups occasionally timed out.&lt;/p&gt;

&lt;p&gt;When Serverless Framework attempted to upload artifacts to S3:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Serverless
      ↓
DNS Lookup
      ↓
Failure
      ↓
Deployment Stops
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No connection to AWS was ever established.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix
&lt;/h2&gt;

&lt;p&gt;We switched to reliable public DNS servers.&lt;/p&gt;

&lt;p&gt;Linux:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/resolv.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Added:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nameserver 8.8.8.8
nameserver 1.1.1.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then restarted networking:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart NetworkManager
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Validation
&lt;/h2&gt;

&lt;p&gt;After updating DNS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nslookup s3.eu-north-1.amazonaws.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Returned instantly.&lt;/p&gt;

&lt;p&gt;Deployment succeeded:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;serverless deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✔ Service deployed successfully
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Additional Improvements
&lt;/h2&gt;

&lt;p&gt;To avoid future issues, we added several safeguards.&lt;/p&gt;

&lt;h3&gt;
  
  
  Retry Logic
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;serverless deploy &lt;span class="o"&gt;||&lt;/span&gt; serverless deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Useful for CI/CD jobs when transient network issues occur.&lt;/p&gt;

&lt;h3&gt;
  
  
  Connectivity Check
&lt;/h3&gt;

&lt;p&gt;Before deployment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://s3.eu-north-1.amazonaws.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If connectivity fails:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Stop deployment
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This prevents wasting build minutes on doomed deployments.&lt;/p&gt;

&lt;h3&gt;
  
  
  AWS Credential Validation
&lt;/h3&gt;

&lt;p&gt;Added:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws sts get-caller-identity
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to deployment pipelines.&lt;/p&gt;

&lt;p&gt;This immediately detects expired or invalid credentials.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;p&gt;The biggest lesson was simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Not every AWS deployment error is actually an AWS problem.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DNS fails&lt;/li&gt;
&lt;li&gt;Local networking fails&lt;/li&gt;
&lt;li&gt;VPNs interfere&lt;/li&gt;
&lt;li&gt;Corporate firewalls interfere&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And the cloud gets blamed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Production Debugging Framework
&lt;/h2&gt;

&lt;p&gt;When deployment issues occur, I now follow this order:&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1 — Validate AWS Credentials
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws sts get-caller-identity
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2 — Validate Internet Connectivity
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ping google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3 — Validate DNS
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nslookup s3.eu-north-1.amazonaws.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4 — Validate AWS Services
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws s3 &lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5 — Run Deployment
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;serverless deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This process has saved hours of troubleshooting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;As engineers, we often expect complex problems to have complex causes.&lt;/p&gt;

&lt;p&gt;This incident reminded me that some of the most disruptive failures originate from the most basic layers of infrastructure.&lt;/p&gt;

&lt;p&gt;A single DNS lookup failure stopped an entire deployment pipeline.&lt;/p&gt;

&lt;p&gt;The code was correct.&lt;/p&gt;

&lt;p&gt;AWS was healthy.&lt;/p&gt;

&lt;p&gt;The architecture was sound.&lt;/p&gt;

&lt;p&gt;But none of that mattered until the network could resolve a hostname.&lt;/p&gt;

&lt;p&gt;Sometimes the fastest fix isn't changing code.&lt;/p&gt;

&lt;p&gt;It's understanding where the request actually fails.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Takeaway
&lt;/h3&gt;

&lt;p&gt;Before blaming AWS:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check credentials&lt;/li&gt;
&lt;li&gt;Check connectivity&lt;/li&gt;
&lt;li&gt;Check DNS&lt;/li&gt;
&lt;li&gt;Check local networking&lt;/li&gt;
&lt;li&gt;Then investigate cloud services&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You'll save yourself hours of debugging.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>s3</category>
      <category>dns</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Building an AI-Powered Risk Intelligence System Using Serverless Architecture</title>
      <dc:creator>saif ur rahman</dc:creator>
      <pubDate>Fri, 17 Apr 2026 17:20:07 +0000</pubDate>
      <link>https://dev.to/saif_urrahman/building-an-ai-powered-risk-intelligence-system-using-serverless-architecture-263b</link>
      <guid>https://dev.to/saif_urrahman/building-an-ai-powered-risk-intelligence-system-using-serverless-architecture-263b</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Organizations today require faster, more reliable ways to assess risk across entities such as companies, vendors, and partners. Traditional due diligence processes rely heavily on manual effort, fragmented data sources, and static reporting, which limits scalability and slows decision-making.&lt;/p&gt;

&lt;p&gt;An AI-powered risk intelligence system solves this by automating data collection, analysis, and reporting. When combined with a serverless architecture, it becomes highly scalable, cost-efficient, and resilient without the need to manage infrastructure.&lt;/p&gt;

&lt;p&gt;This article explains not only the concept but also &lt;strong&gt;how to practically achieve this using AWS services&lt;/strong&gt;, focusing on architecture, services, and flow in a clear and implementation-oriented manner.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Goal
&lt;/h2&gt;

&lt;p&gt;The system aims to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Collect data from multiple external sources
&lt;/li&gt;
&lt;li&gt;Analyze risk signals using AI
&lt;/li&gt;
&lt;li&gt;Apply consistent scoring logic
&lt;/li&gt;
&lt;li&gt;Generate structured reports automatically
&lt;/li&gt;
&lt;li&gt;Scale without manual infrastructure management
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  End-to-End Flow (Simple Overview)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;A request is submitted (e.g., company name)&lt;/li&gt;
&lt;li&gt;The system queues the request for processing&lt;/li&gt;
&lt;li&gt;Background workers fetch data from APIs&lt;/li&gt;
&lt;li&gt;AI analyzes the data and generates a report&lt;/li&gt;
&lt;li&gt;The report is stored and made available to users&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How to Achieve This Using AWS Services
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Request Handling Layer
&lt;/h3&gt;

&lt;p&gt;At the entry point, you need a way to accept incoming requests.&lt;/p&gt;

&lt;p&gt;You can use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon API Gateway&lt;/strong&gt; → to expose an HTTP endpoint
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Lambda&lt;/strong&gt; → to process incoming requests
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What happens here:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The user sends a request (company name, country, etc.)&lt;/li&gt;
&lt;li&gt;Lambda validates the request&lt;/li&gt;
&lt;li&gt;A unique report ID is generated&lt;/li&gt;
&lt;li&gt;The request is stored for tracking&lt;/li&gt;
&lt;li&gt;A message is sent to a queue for processing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This ensures the system responds quickly without waiting for heavy processing.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Asynchronous Processing with Queue
&lt;/h3&gt;

&lt;p&gt;Instead of processing everything immediately, the request is placed in a queue.&lt;/p&gt;

&lt;p&gt;You can use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Amazon SQS (Simple Queue Service)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why this is important:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prevents timeouts&lt;/li&gt;
&lt;li&gt;Handles high traffic smoothly&lt;/li&gt;
&lt;li&gt;Allows retry if something fails&lt;/li&gt;
&lt;li&gt;Decouples request from processing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The queue acts as a buffer between incoming requests and background workers.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Worker Layer (Background Processing)
&lt;/h3&gt;

&lt;p&gt;The actual processing happens in a worker.&lt;/p&gt;

&lt;p&gt;You can use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;AWS Lambda (triggered by SQS)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What the worker does:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reads message from queue&lt;/li&gt;
&lt;li&gt;Calls multiple external APIs&lt;/li&gt;
&lt;li&gt;Collects raw data&lt;/li&gt;
&lt;li&gt;Handles failures safely&lt;/li&gt;
&lt;li&gt;Prepares data for AI processing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This layer is the core of data aggregation.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. External Data Integration
&lt;/h3&gt;

&lt;p&gt;The worker integrates with multiple external sources such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sanctions databases
&lt;/li&gt;
&lt;li&gt;Watchlists
&lt;/li&gt;
&lt;li&gt;Corporate registries
&lt;/li&gt;
&lt;li&gt;News and media APIs
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best practices:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Call APIs in parallel (faster execution)&lt;/li&gt;
&lt;li&gt;Use safe wrappers (so one failure doesn’t break everything)&lt;/li&gt;
&lt;li&gt;Log responses for traceability&lt;/li&gt;
&lt;li&gt;Normalize data into a consistent structure&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Data Normalization
&lt;/h3&gt;

&lt;p&gt;Different APIs return different formats. Before sending data to AI, you must standardize it.&lt;/p&gt;

&lt;p&gt;This step ensures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consistent structure&lt;/li&gt;
&lt;li&gt;Easier AI understanding&lt;/li&gt;
&lt;li&gt;Better accuracy in results&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Typical normalized structure includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Input data
&lt;/li&gt;
&lt;li&gt;Sanctions data
&lt;/li&gt;
&lt;li&gt;PEP/watchlist data
&lt;/li&gt;
&lt;li&gt;Corporate registry data
&lt;/li&gt;
&lt;li&gt;News/media data
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. AI Processing Layer
&lt;/h3&gt;

&lt;p&gt;This is where intelligence is applied.&lt;/p&gt;

&lt;p&gt;You can use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Bedrock&lt;/strong&gt; (for accessing foundation models)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What happens here:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The normalized data is sent to the model&lt;/li&gt;
&lt;li&gt;A structured prompt guides the model&lt;/li&gt;
&lt;li&gt;The model analyzes risk indicators&lt;/li&gt;
&lt;li&gt;Assigns scores per category&lt;/li&gt;
&lt;li&gt;Generates a structured report (HTML or text)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key advantage:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No need to train your own model
&lt;/li&gt;
&lt;li&gt;Access to advanced models through API
&lt;/li&gt;
&lt;li&gt;Fast integration with serverless systems
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. Report Generation
&lt;/h3&gt;

&lt;p&gt;The AI generates a structured report, typically in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML format (for web display)&lt;/li&gt;
&lt;li&gt;Optional PDF format (for sharing)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reports usually include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Executive summary
&lt;/li&gt;
&lt;li&gt;Risk analysis sections
&lt;/li&gt;
&lt;li&gt;Scoring tables
&lt;/li&gt;
&lt;li&gt;Final recommendation
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  8. Storage Strategy
&lt;/h3&gt;

&lt;p&gt;You need to store both metadata and reports.&lt;/p&gt;

&lt;h4&gt;
  
  
  Metadata Storage
&lt;/h4&gt;

&lt;p&gt;Use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Amazon DynamoDB&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Store:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Report ID
&lt;/li&gt;
&lt;li&gt;Status (Pending, Processing, Completed)
&lt;/li&gt;
&lt;li&gt;Risk level
&lt;/li&gt;
&lt;li&gt;Timestamps
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Report Storage
&lt;/h4&gt;

&lt;p&gt;Use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Amazon S3&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Store:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML reports
&lt;/li&gt;
&lt;li&gt;PDF files
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why separate storage:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DynamoDB is optimized for quick lookups
&lt;/li&gt;
&lt;li&gt;S3 is optimized for large file storage
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  9. Status Tracking
&lt;/h3&gt;

&lt;p&gt;Users should be able to check report progress.&lt;/p&gt;

&lt;p&gt;You can implement:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API to fetch report status
&lt;/li&gt;
&lt;li&gt;Query DynamoDB using report ID
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Possible states:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PENDING
&lt;/li&gt;
&lt;li&gt;PROCESSING
&lt;/li&gt;
&lt;li&gt;COMPLETED
&lt;/li&gt;
&lt;li&gt;FAILED
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  10. Error Handling and Reliability
&lt;/h3&gt;

&lt;p&gt;In distributed systems, failures are expected.&lt;/p&gt;

&lt;p&gt;Best practices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use retry mechanisms (built into SQS + Lambda)&lt;/li&gt;
&lt;li&gt;Wrap API calls in safe handlers&lt;/li&gt;
&lt;li&gt;Log errors properly&lt;/li&gt;
&lt;li&gt;Avoid system-wide failure due to one API&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  11. Security Considerations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use IAM roles to control access
&lt;/li&gt;
&lt;li&gt;Secure API endpoints
&lt;/li&gt;
&lt;li&gt;Encrypt data in transit and at rest
&lt;/li&gt;
&lt;li&gt;Avoid exposing sensitive data
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Serverless Works Best Here
&lt;/h2&gt;

&lt;p&gt;Serverless architecture provides:&lt;/p&gt;

&lt;h3&gt;
  
  
  Automatic Scaling
&lt;/h3&gt;

&lt;p&gt;Handles thousands of requests without manual intervention&lt;/p&gt;

&lt;h3&gt;
  
  
  Cost Efficiency
&lt;/h3&gt;

&lt;p&gt;You only pay when the system runs&lt;/p&gt;

&lt;h3&gt;
  
  
  No Infrastructure Management
&lt;/h3&gt;

&lt;p&gt;No servers to maintain or monitor&lt;/p&gt;

&lt;h3&gt;
  
  
  High Availability
&lt;/h3&gt;

&lt;p&gt;Built-in fault tolerance across services&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Design Principles
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Decoupling
&lt;/h3&gt;

&lt;p&gt;Each component works independently (API, queue, worker)&lt;/p&gt;

&lt;h3&gt;
  
  
  Fault Tolerance
&lt;/h3&gt;

&lt;p&gt;Failures are isolated and handled gracefully&lt;/p&gt;

&lt;h3&gt;
  
  
  Deterministic AI Output
&lt;/h3&gt;

&lt;p&gt;Strict prompts ensure consistent and reliable reports&lt;/p&gt;

&lt;h3&gt;
  
  
  Performance Optimization
&lt;/h3&gt;

&lt;p&gt;Parallel API calls reduce processing time&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges and Practical Solutions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Challenge:&lt;/strong&gt; External APIs are unreliable&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt; Use safe wrappers and fallback logic  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenge:&lt;/strong&gt; Large reports&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt; Store in S3 instead of database  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenge:&lt;/strong&gt; Inconsistent data formats&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt; Strong normalization layer  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenge:&lt;/strong&gt; AI unpredictability&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt; Use structured prompts and constraints  &lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Use Cases
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;KYC and AML screening
&lt;/li&gt;
&lt;li&gt;Vendor risk assessment
&lt;/li&gt;
&lt;li&gt;Investment due diligence
&lt;/li&gt;
&lt;li&gt;Compliance monitoring
&lt;/li&gt;
&lt;li&gt;Third-party verification
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Future Enhancements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Real-time monitoring and alerts
&lt;/li&gt;
&lt;li&gt;Risk dashboards with analytics
&lt;/li&gt;
&lt;li&gt;Entity matching using embeddings
&lt;/li&gt;
&lt;li&gt;Continuous data refresh pipelines
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Building an AI-powered risk intelligence system using serverless architecture is both practical and powerful. By combining AWS services with generative AI, it is possible to create a system that is scalable, reliable, and capable of producing high-quality, structured risk reports automatically.&lt;/p&gt;

&lt;p&gt;The key lies in designing a clean flow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accept request
&lt;/li&gt;
&lt;li&gt;Queue it
&lt;/li&gt;
&lt;li&gt;Process asynchronously
&lt;/li&gt;
&lt;li&gt;Aggregate data
&lt;/li&gt;
&lt;li&gt;Apply AI
&lt;/li&gt;
&lt;li&gt;Store and deliver results
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach transforms traditional due diligence into a modern, intelligent, and automated system capable of supporting real-world compliance and risk decision-making at scale.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>genrativeai</category>
      <category>automation</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Struggling with AI Hallucinations? Here’s How I Solved It in Production</title>
      <dc:creator>saif ur rahman</dc:creator>
      <pubDate>Wed, 01 Apr 2026 09:06:46 +0000</pubDate>
      <link>https://dev.to/saif_urrahman/struggling-with-ai-hallucinations-heres-how-i-solved-it-in-production-1je8</link>
      <guid>https://dev.to/saif_urrahman/struggling-with-ai-hallucinations-heres-how-i-solved-it-in-production-1je8</guid>
      <description>&lt;p&gt;When I started building real-world Generative AI applications, everything seemed promising at first. The model responses were fluent, confident, and surprisingly helpful.&lt;/p&gt;

&lt;p&gt;But very quickly, a serious problem started to appear.&lt;/p&gt;

&lt;p&gt;The AI was giving &lt;strong&gt;wrong answers with full confidence&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;At times, it would:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Invent facts that didn’t exist
&lt;/li&gt;
&lt;li&gt;Provide outdated or irrelevant information
&lt;/li&gt;
&lt;li&gt;Generate responses that sounded correct but were completely inaccurate
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is what we call &lt;strong&gt;hallucination&lt;/strong&gt; in Generative AI and it becomes a major issue when you move from experiments to production systems.&lt;/p&gt;

&lt;p&gt;In this article, I’ll share what caused hallucinations in my system and how I fixed them using practical, production-ready approaches.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Problem: Confident but Incorrect AI
&lt;/h1&gt;

&lt;p&gt;The biggest issue with hallucinations is not just that the AI is wrong it’s that it sounds &lt;em&gt;right&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;For example, a user might ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“What is the refund policy for my subscription?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Instead of saying “I don’t know,” the model might generate a completely fabricated policy.&lt;/p&gt;

&lt;p&gt;This creates serious risks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Loss of user trust
&lt;/li&gt;
&lt;li&gt;Incorrect business decisions
&lt;/li&gt;
&lt;li&gt;Poor customer experience
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I realized quickly that relying only on a language model was not enough for real applications.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why Hallucinations Happen
&lt;/h1&gt;

&lt;p&gt;After analyzing the system, I found a few key reasons.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. No Access to Real Data
&lt;/h2&gt;

&lt;p&gt;The model was answering based on its training data, not my application’s actual data.&lt;/p&gt;

&lt;p&gt;So it tried to “guess” answers.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Poor Prompt Design
&lt;/h2&gt;

&lt;p&gt;My prompts were too open-ended.&lt;/p&gt;

&lt;p&gt;I wasn’t guiding the model properly, which allowed it to generate uncontrolled responses.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Too Much Context or Irrelevant Data
&lt;/h2&gt;

&lt;p&gt;Sometimes I was passing too much or low-quality context, which confused the model.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. No Validation Layer
&lt;/h2&gt;

&lt;p&gt;There was no system to verify whether the answer was correct before returning it to the user.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Solution: What Actually Worked
&lt;/h1&gt;

&lt;p&gt;Fixing hallucinations required a combination of techniques, not just one change.&lt;/p&gt;

&lt;h1&gt;
  
  
  1. Implementing Retrieval-Augmented Generation (RAG)
&lt;/h1&gt;

&lt;p&gt;The biggest improvement came from moving to a RAG-based architecture.&lt;/p&gt;

&lt;p&gt;Instead of letting the model generate answers freely, I forced it to use &lt;strong&gt;retrieved documents as context&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;New flow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Query
   ↓
Retrieve Relevant Documents
   ↓
Send Context + Query to Model
   ↓
Generate Answer Based on Context
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensured that responses were grounded in real data.&lt;/p&gt;

&lt;h1&gt;
  
  
  2. Strict Prompt Engineering
&lt;/h1&gt;

&lt;p&gt;I changed my prompts to be more controlled and restrictive.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are an AI assistant.

Answer ONLY using the provided context.
If the answer is not found, say:
"I cannot find the answer in the provided data."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This single change reduced hallucinations significantly.&lt;/p&gt;

&lt;h1&gt;
  
  
  3. Limiting Context to Relevant Data
&lt;/h1&gt;

&lt;p&gt;Instead of sending large amounts of data, I:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retrieved only top relevant documents
&lt;/li&gt;
&lt;li&gt;Filtered out noisy or irrelevant content
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This improved both accuracy and performance.&lt;/p&gt;

&lt;h1&gt;
  
  
  4. Adding a Confidence and Fallback Mechanism
&lt;/h1&gt;

&lt;p&gt;I introduced fallback logic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If confidence is low → Ask user for clarification
&lt;/li&gt;
&lt;li&gt;If no relevant data → Return safe response
&lt;/li&gt;
&lt;li&gt;If uncertain → Escalate to human
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This prevented the system from guessing.&lt;/p&gt;

&lt;h1&gt;
  
  
  5. Using Structured Outputs
&lt;/h1&gt;

&lt;p&gt;Instead of free-form text, I started using structured responses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"answer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"confidence"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"high"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This made it easier to validate and debug responses.&lt;/p&gt;

&lt;h1&gt;
  
  
  6. Continuous Monitoring and Feedback
&lt;/h1&gt;

&lt;p&gt;I added logging and monitoring to track:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Incorrect responses
&lt;/li&gt;
&lt;li&gt;User feedback
&lt;/li&gt;
&lt;li&gt;Edge cases
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Over time, this helped improve the system significantly.&lt;/p&gt;

&lt;h1&gt;
  
  
  Real Impact After Fixing Hallucinations
&lt;/h1&gt;

&lt;p&gt;After applying these changes, I saw clear improvements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More accurate responses
&lt;/li&gt;
&lt;li&gt;Reduced false information
&lt;/li&gt;
&lt;li&gt;Better user trust
&lt;/li&gt;
&lt;li&gt;More stable production behavior
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The system became reliable enough for real users not just demos.&lt;/p&gt;

&lt;h1&gt;
  
  
  Key Lessons I Learned
&lt;/h1&gt;

&lt;p&gt;Looking back, here are the most important lessons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never trust raw LLM output in production
&lt;/li&gt;
&lt;li&gt;Always ground responses in real data
&lt;/li&gt;
&lt;li&gt;Prompt design matters more than expected
&lt;/li&gt;
&lt;li&gt;Less context is often better than more
&lt;/li&gt;
&lt;li&gt;Add fallback mechanisms early
&lt;/li&gt;
&lt;li&gt;Monitor everything
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Hallucinations are one of the biggest challenges in building real-world AI systems.&lt;/p&gt;

&lt;p&gt;But they are not impossible to solve.&lt;/p&gt;

&lt;p&gt;With the right architecture especially using RAG, structured prompts, and validation layers you can turn an unreliable system into a production ready solution.&lt;/p&gt;

&lt;p&gt;If you’re building AI applications today, don’t aim for perfect models.&lt;/p&gt;

&lt;p&gt;Aim for &lt;strong&gt;controlled, reliable systems&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That’s what actually works in production.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>aws</category>
      <category>hallucinations</category>
      <category>bedrock</category>
    </item>
    <item>
      <title>Why Traditional Call Centers Are Dying (And What Replaces Them)</title>
      <dc:creator>saif ur rahman</dc:creator>
      <pubDate>Tue, 31 Mar 2026 10:43:48 +0000</pubDate>
      <link>https://dev.to/saif_urrahman/why-traditional-call-centers-are-dying-and-what-replaces-them-27ld</link>
      <guid>https://dev.to/saif_urrahman/why-traditional-call-centers-are-dying-and-what-replaces-them-27ld</guid>
      <description>&lt;p&gt;For decades, call centers have been the backbone of customer support. Long queues, scripted conversations, and “press 1 for support” menus became the standard experience across industries.&lt;/p&gt;

&lt;p&gt;But today, that model is slowly breaking down.&lt;/p&gt;

&lt;p&gt;Customers expect faster responses, more personalized interactions, and support that feels natural not mechanical. Businesses, on the other hand, are looking for ways to reduce operational costs while improving efficiency.&lt;/p&gt;

&lt;p&gt;This shift is driving a major transformation: traditional call centers are fading, and a new generation of intelligent, cloud-powered systems is taking their place.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Problems with Traditional Call Centers
&lt;/h1&gt;

&lt;p&gt;Traditional call centers were designed for a different era when customer expectations were lower and technology was limited.&lt;/p&gt;

&lt;p&gt;Today, their limitations are becoming more visible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rigid IVR Systems
&lt;/h2&gt;

&lt;p&gt;Most systems rely on fixed IVR menus:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press 1 for billing
&lt;/li&gt;
&lt;li&gt;Press 2 for support
&lt;/li&gt;
&lt;li&gt;Press 3 for sales
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach often frustrates users, especially when their issue doesn’t fit neatly into predefined options.&lt;/p&gt;

&lt;h2&gt;
  
  
  Long Wait Times
&lt;/h2&gt;

&lt;p&gt;Customers are frequently placed in queues, waiting minutes or even longer to reach an agent.&lt;/p&gt;

&lt;p&gt;This leads to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Poor customer satisfaction
&lt;/li&gt;
&lt;li&gt;Increased call abandonment rates
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Lack of Personalization
&lt;/h2&gt;

&lt;p&gt;Traditional systems treat every customer the same way.&lt;/p&gt;

&lt;p&gt;They lack awareness of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customer history
&lt;/li&gt;
&lt;li&gt;Previous interactions
&lt;/li&gt;
&lt;li&gt;Account context
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This forces customers to repeat information again and again.&lt;/p&gt;

&lt;h2&gt;
  
  
  High Operational Costs
&lt;/h2&gt;

&lt;p&gt;Maintaining a large team of agents is expensive.&lt;/p&gt;

&lt;p&gt;Costs include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Staffing
&lt;/li&gt;
&lt;li&gt;Training
&lt;/li&gt;
&lt;li&gt;Infrastructure
&lt;/li&gt;
&lt;li&gt;Maintenance
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Scaling such systems becomes difficult and inefficient.&lt;/p&gt;

&lt;h1&gt;
  
  
  What Customers Expect Today
&lt;/h1&gt;

&lt;p&gt;Modern users expect a completely different experience.&lt;/p&gt;

&lt;p&gt;They want:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Instant responses
&lt;/li&gt;
&lt;li&gt;Natural conversations (not menu-driven)
&lt;/li&gt;
&lt;li&gt;24/7 availability
&lt;/li&gt;
&lt;li&gt;Personalized support
&lt;/li&gt;
&lt;li&gt;Seamless transitions between channels
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In short, they expect support systems to be as intelligent and responsive as the apps they use daily.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Replacing Traditional Call Centers?
&lt;/h1&gt;

&lt;p&gt;Traditional systems are being replaced by cloud-based, AI-powered customer engagement platforms.&lt;/p&gt;

&lt;p&gt;These systems combine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cloud contact centers
&lt;/li&gt;
&lt;li&gt;Generative AI
&lt;/li&gt;
&lt;li&gt;Automation workflows
&lt;/li&gt;
&lt;li&gt;Real-time data integration
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Together, they create a smarter and more flexible support experience.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Rise of Cloud Contact Centers
&lt;/h1&gt;

&lt;p&gt;Cloud-based contact centers eliminate the need for on-premise infrastructure.&lt;/p&gt;

&lt;p&gt;They offer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scalability on demand
&lt;/li&gt;
&lt;li&gt;Global availability
&lt;/li&gt;
&lt;li&gt;Easy integration with other systems
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of managing hardware, businesses can focus on improving customer experience.&lt;/p&gt;

&lt;h1&gt;
  
  
  Generative AI is Changing Everything
&lt;/h1&gt;

&lt;p&gt;One of the biggest shifts is the introduction of Generative AI into customer support.&lt;/p&gt;

&lt;p&gt;Unlike traditional systems, AI can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understand natural language
&lt;/li&gt;
&lt;li&gt;Generate dynamic responses
&lt;/li&gt;
&lt;li&gt;Handle complex queries
&lt;/li&gt;
&lt;li&gt;Maintain conversational context
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, instead of navigating menus, a user can simply say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“I was charged twice. Can you help me fix this?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The system can understand the issue and respond intelligently.&lt;/p&gt;

&lt;h1&gt;
  
  
  From Chatbots to Intelligent AI Assistants
&lt;/h1&gt;

&lt;p&gt;Early chatbots were rule-based and limited.&lt;/p&gt;

&lt;p&gt;Modern AI assistants are far more advanced.&lt;/p&gt;

&lt;p&gt;They can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understand intent
&lt;/li&gt;
&lt;li&gt;Perform actions
&lt;/li&gt;
&lt;li&gt;Ask follow-up questions
&lt;/li&gt;
&lt;li&gt;Handle multi-step workflows
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Change subscription
&lt;/li&gt;
&lt;li&gt;Apply discount
&lt;/li&gt;
&lt;li&gt;Update payment
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All within a single interaction.&lt;/p&gt;

&lt;h1&gt;
  
  
  Automation is Reducing Manual Work
&lt;/h1&gt;

&lt;p&gt;Automation plays a key role in replacing traditional systems.&lt;/p&gt;

&lt;p&gt;Tasks that previously required human agents can now be automated:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ticket creation
&lt;/li&gt;
&lt;li&gt;Account updates
&lt;/li&gt;
&lt;li&gt;Status checks
&lt;/li&gt;
&lt;li&gt;Basic troubleshooting
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This reduces workload on support teams and speeds up response times.&lt;/p&gt;

&lt;h1&gt;
  
  
  Smarter Call Routing and Decision Making
&lt;/h1&gt;

&lt;p&gt;Modern systems use intelligent routing instead of static rules.&lt;/p&gt;

&lt;p&gt;Calls can be routed based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customer priority
&lt;/li&gt;
&lt;li&gt;Issue type
&lt;/li&gt;
&lt;li&gt;Agent expertise
&lt;/li&gt;
&lt;li&gt;Real-time availability
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This ensures customers are connected to the right agent faster.&lt;/p&gt;

&lt;h1&gt;
  
  
  Omnichannel Support is the New Standard
&lt;/h1&gt;

&lt;p&gt;Customers no longer rely only on phone calls.&lt;/p&gt;

&lt;p&gt;They expect support across multiple channels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chat
&lt;/li&gt;
&lt;li&gt;Email
&lt;/li&gt;
&lt;li&gt;Mobile apps
&lt;/li&gt;
&lt;li&gt;Social platforms
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Modern systems unify all these channels into a single experience.&lt;/p&gt;

&lt;h1&gt;
  
  
  Benefits of Modern AI-Powered Support Systems
&lt;/h1&gt;

&lt;p&gt;The shift away from traditional call centers brings significant advantages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Better Customer Experience
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Faster responses
&lt;/li&gt;
&lt;li&gt;Natural conversations
&lt;/li&gt;
&lt;li&gt;Personalized interactions
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Reduced Costs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Fewer manual processes
&lt;/li&gt;
&lt;li&gt;Lower infrastructure costs
&lt;/li&gt;
&lt;li&gt;Efficient resource utilization
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Scalability
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Handle thousands of requests simultaneously
&lt;/li&gt;
&lt;li&gt;No need for large physical infrastructure
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Improved Efficiency
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Faster resolution times
&lt;/li&gt;
&lt;li&gt;Reduced agent workload
&lt;/li&gt;
&lt;li&gt;Smarter decision-making
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Challenges in the Transition
&lt;/h1&gt;

&lt;p&gt;While the shift is powerful, it comes with challenges:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Designing intelligent workflows
&lt;/li&gt;
&lt;li&gt;Handling complex edge cases
&lt;/li&gt;
&lt;li&gt;Ensuring accuracy in AI responses
&lt;/li&gt;
&lt;li&gt;Managing data privacy and compliance
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Organizations need to carefully design and monitor these systems to ensure reliability.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Future of Customer Support
&lt;/h1&gt;

&lt;p&gt;We are moving toward a future where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI handles most routine interactions
&lt;/li&gt;
&lt;li&gt;Human agents focus on complex cases
&lt;/li&gt;
&lt;li&gt;Systems understand user intent deeply
&lt;/li&gt;
&lt;li&gt;Conversations feel natural and seamless
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Customer support is no longer just a service it is becoming a key part of the product experience.&lt;/p&gt;

&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Traditional call centers are not disappearing overnight, but their role is rapidly changing.&lt;/p&gt;

&lt;p&gt;Rigid systems, long wait times, and manual processes are being replaced by intelligent, cloud-based, and AI-driven solutions.&lt;/p&gt;

&lt;p&gt;For developers and businesses, this shift represents a major opportunity to build systems that are not only efficient but also genuinely helpful.&lt;/p&gt;

&lt;p&gt;The future of customer support is not about handling more calls.&lt;/p&gt;

&lt;p&gt;It’s about building smarter systems that solve problems before customers even feel the need to call.&lt;/p&gt;

</description>
      <category>cloudcomputing</category>
      <category>ai</category>
      <category>aws</category>
      <category>genrativeai</category>
    </item>
    <item>
      <title>How to Build a Smart Call Routing System in Amazon Connect</title>
      <dc:creator>saif ur rahman</dc:creator>
      <pubDate>Tue, 31 Mar 2026 10:13:56 +0000</pubDate>
      <link>https://dev.to/saif_urrahman/how-to-build-a-smart-call-routing-system-in-amazon-connect-43kb</link>
      <guid>https://dev.to/saif_urrahman/how-to-build-a-smart-call-routing-system-in-amazon-connect-43kb</guid>
      <description>&lt;p&gt;Customer experience is no longer just about answering calls it’s about routing customers to the right place, at the right time, with the right context.&lt;/p&gt;

&lt;p&gt;Traditional call routing systems often rely on rigid IVR menus and predefined rules, which can frustrate users and increase wait times. Modern cloud-based systems allow us to design intelligent, flexible, and scalable routing strategies.&lt;/p&gt;

&lt;p&gt;In this article, I’ll walk through how to design and build a smart call routing system using Amazon Connect, along with practical considerations and best practices.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Smart Call Routing?
&lt;/h1&gt;

&lt;p&gt;Smart call routing is the process of directing incoming customer calls based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customer intent
&lt;/li&gt;
&lt;li&gt;Call context
&lt;/li&gt;
&lt;li&gt;Business rules
&lt;/li&gt;
&lt;li&gt;Agent availability
&lt;/li&gt;
&lt;li&gt;Customer priority or profile
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of sending every caller through the same flow, smart routing ensures that each customer is handled efficiently and appropriately.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why Traditional Routing Falls Short
&lt;/h1&gt;

&lt;p&gt;Most traditional systems rely on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Static IVR menus
&lt;/li&gt;
&lt;li&gt;Fixed routing rules
&lt;/li&gt;
&lt;li&gt;Limited personalization
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This often results in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Long wait times
&lt;/li&gt;
&lt;li&gt;Misrouted calls
&lt;/li&gt;
&lt;li&gt;Poor customer experience
&lt;/li&gt;
&lt;li&gt;Increased operational overhead
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Smart routing introduces dynamic decision-making, which significantly improves efficiency and user satisfaction.&lt;/p&gt;

&lt;h1&gt;
  
  
  Key Components of a Smart Routing System
&lt;/h1&gt;

&lt;p&gt;When building a smart routing system in Amazon Connect, there are a few core components to understand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Contact Flows
&lt;/h2&gt;

&lt;p&gt;Contact flows define how calls are handled inside Amazon Connect.&lt;/p&gt;

&lt;p&gt;They allow you to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Capture user input
&lt;/li&gt;
&lt;li&gt;Define routing logic
&lt;/li&gt;
&lt;li&gt;Integrate backend services
&lt;/li&gt;
&lt;li&gt;Control the overall call experience
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Queues
&lt;/h2&gt;

&lt;p&gt;Queues represent groups of agents.&lt;/p&gt;

&lt;p&gt;Calls can be routed based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Department (billing, support, sales)
&lt;/li&gt;
&lt;li&gt;Skill set
&lt;/li&gt;
&lt;li&gt;Priority
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Routing Profiles
&lt;/h2&gt;

&lt;p&gt;Routing profiles determine how agents receive contacts.&lt;/p&gt;

&lt;p&gt;They help manage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Agent workload
&lt;/li&gt;
&lt;li&gt;Queue priority
&lt;/li&gt;
&lt;li&gt;Call distribution
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS Lambda Integration
&lt;/h2&gt;

&lt;p&gt;Lambda allows you to introduce dynamic logic into your routing system.&lt;/p&gt;

&lt;p&gt;You can use it to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fetch customer data
&lt;/li&gt;
&lt;li&gt;Validate inputs
&lt;/li&gt;
&lt;li&gt;Apply intelligent routing rules
&lt;/li&gt;
&lt;li&gt;Integrate external systems
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Designing a Smart Call Routing Flow
&lt;/h1&gt;

&lt;p&gt;A well-designed routing system follows a structured approach.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Capture Customer Intent
&lt;/h2&gt;

&lt;p&gt;At the start of the call, identify the reason for the call.&lt;/p&gt;

&lt;p&gt;This can be done using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keypad input (DTMF)
&lt;/li&gt;
&lt;li&gt;Voice input
&lt;/li&gt;
&lt;li&gt;AI-based intent recognition
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press 1 for Billing
&lt;/li&gt;
&lt;li&gt;Press 2 for Technical Support
&lt;/li&gt;
&lt;li&gt;Press 3 for Sales
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 2: Identify Customer Context
&lt;/h2&gt;

&lt;p&gt;Use backend systems to retrieve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customer profile
&lt;/li&gt;
&lt;li&gt;Previous interactions
&lt;/li&gt;
&lt;li&gt;Account status
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This helps personalize the routing decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Apply Routing Logic
&lt;/h2&gt;

&lt;p&gt;Based on intent and context:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Premium customers → Priority queue
&lt;/li&gt;
&lt;li&gt;Technical issues → Specialized agents
&lt;/li&gt;
&lt;li&gt;General queries → Standard support
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 4: Route to the Appropriate Queue
&lt;/h2&gt;

&lt;p&gt;Send the call to the correct queue.&lt;/p&gt;

&lt;p&gt;Amazon Connect automatically assigns the call to available agents based on routing rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Handle Fallback Scenarios
&lt;/h2&gt;

&lt;p&gt;Always include fallback mechanisms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Offer callback if wait time is long
&lt;/li&gt;
&lt;li&gt;Redirect to voicemail if no agents are available
&lt;/li&gt;
&lt;li&gt;Route to a default queue in case of failure
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Example Smart Routing Flow
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Incoming Call
   ↓
Capture Intent
   ↓
Fetch Customer Data (Lambda)
   ↓
Apply Routing Logic
   ↓
Route to Queue
   ↓
Agent Interaction
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Adding Intelligence with Dynamic Routing
&lt;/h1&gt;

&lt;p&gt;To make your system more advanced, you can introduce dynamic routing.&lt;/p&gt;

&lt;p&gt;This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prioritizing high-value customers
&lt;/li&gt;
&lt;li&gt;Routing based on real-time queue load
&lt;/li&gt;
&lt;li&gt;Using historical data
&lt;/li&gt;
&lt;li&gt;Integrating AI for intent detection
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, a returning customer with an unresolved issue can be routed directly to a senior agent.&lt;/p&gt;

&lt;h1&gt;
  
  
  Example Lambda Logic
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;customerId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;customerId&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;customer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getCustomerData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;customerId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;queue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;GeneralSupport&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isPremium&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;queue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;PrioritySupport&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;issueType&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;billing&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;queue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;BillingQueue&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;queueName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;queue&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shows how routing decisions can be made dynamically using backend logic.&lt;/p&gt;

&lt;h1&gt;
  
  
  Best Practices for Smart Call Routing
&lt;/h1&gt;

&lt;p&gt;To build an effective system:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep IVR menus simple and user-friendly
&lt;/li&gt;
&lt;li&gt;Avoid overly complex call flows
&lt;/li&gt;
&lt;li&gt;Use Lambda for dynamic decision-making
&lt;/li&gt;
&lt;li&gt;Monitor performance and adjust routing rules
&lt;/li&gt;
&lt;li&gt;Implement fallback options
&lt;/li&gt;
&lt;li&gt;Continuously improve based on analytics
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Common Challenges
&lt;/h1&gt;

&lt;p&gt;While building smart routing systems, you may face:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Complex call flow design
&lt;/li&gt;
&lt;li&gt;Handling edge cases
&lt;/li&gt;
&lt;li&gt;Balancing automation and human interaction
&lt;/li&gt;
&lt;li&gt;Maintaining low latency
&lt;/li&gt;
&lt;li&gt;Ensuring reliability
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Proper planning and testing help overcome these challenges.&lt;/p&gt;

&lt;h1&gt;
  
  
  Benefits of Smart Call Routing
&lt;/h1&gt;

&lt;p&gt;A well-designed routing system provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Faster resolution times
&lt;/li&gt;
&lt;li&gt;Improved customer satisfaction
&lt;/li&gt;
&lt;li&gt;Better agent utilization
&lt;/li&gt;
&lt;li&gt;Reduced operational costs
&lt;/li&gt;
&lt;li&gt;Scalable and flexible architecture
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Smart call routing is a critical component of modern customer support systems.&lt;/p&gt;

&lt;p&gt;With Amazon Connect, it becomes possible to design intelligent and scalable routing strategies without managing infrastructure.&lt;/p&gt;

&lt;p&gt;By combining contact flows, backend logic, and real-time data, you can build a system that not only routes calls efficiently but also enhances the overall customer experience.&lt;/p&gt;

&lt;p&gt;As customer expectations continue to grow, investing in intelligent routing systems is no longer optional it is essential.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>amazonconnect</category>
      <category>genrativeai</category>
      <category>ai</category>
    </item>
    <item>
      <title>Integrating Generative AI with Amazon Connect for Smarter Customer Support</title>
      <dc:creator>saif ur rahman</dc:creator>
      <pubDate>Tue, 31 Mar 2026 06:03:43 +0000</pubDate>
      <link>https://dev.to/saif_urrahman/integrating-generative-ai-with-amazon-connect-for-smarter-customer-support-150g</link>
      <guid>https://dev.to/saif_urrahman/integrating-generative-ai-with-amazon-connect-for-smarter-customer-support-150g</guid>
      <description>&lt;p&gt;Customer expectations have changed significantly in recent years. Users no longer want to wait in long queues or navigate complex IVR systems. They expect fast, intelligent, and personalized support experiences.&lt;/p&gt;

&lt;p&gt;This is where combining cloud contact centers with Generative AI becomes a game-changer.&lt;/p&gt;

&lt;p&gt;By integrating Generative AI with Amazon Connect, organizations can transform traditional support systems into intelligent, automated, and highly scalable customer engagement platforms.&lt;/p&gt;

&lt;p&gt;In this article, we’ll explore how this integration works, why it matters, and how you can design a modern AI-powered customer support system.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Amazon Connect?
&lt;/h1&gt;

&lt;p&gt;Amazon Connect is a cloud-based contact center service that allows businesses to set up customer support systems without managing infrastructure.&lt;/p&gt;

&lt;p&gt;It provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Voice and chat support
&lt;/li&gt;
&lt;li&gt;Contact flows (IVR systems)
&lt;/li&gt;
&lt;li&gt;Call routing and queue management
&lt;/li&gt;
&lt;li&gt;Real-time analytics and reporting
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Unlike traditional call centers, Amazon Connect is fully managed and scalable, making it ideal for modern applications.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why Combine Generative AI with Amazon Connect?
&lt;/h1&gt;

&lt;p&gt;Traditional contact centers rely on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Static IVR menus
&lt;/li&gt;
&lt;li&gt;Predefined responses
&lt;/li&gt;
&lt;li&gt;Manual agent intervention
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These approaches often result in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Poor user experience
&lt;/li&gt;
&lt;li&gt;High operational costs
&lt;/li&gt;
&lt;li&gt;Slow response times
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Generative AI solves these challenges by enabling:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Natural language conversations
&lt;/li&gt;
&lt;li&gt;Intelligent query understanding
&lt;/li&gt;
&lt;li&gt;Dynamic response generation
&lt;/li&gt;
&lt;li&gt;Context-aware interactions
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This creates a more human-like and efficient support experience.&lt;/p&gt;

&lt;h1&gt;
  
  
  High-Level Architecture
&lt;/h1&gt;

&lt;p&gt;Below is a simplified architecture of integrating Generative AI with Amazon Connect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 1: AI-Powered Contact Center Architecture&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Call / Chat  
↓  
Amazon Connect (Contact Flow)  
↓  
AWS Lambda  
↓  
Generative AI Model  
↓  
Response Generation  
↓  
Return Response to User
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  How the System Works
&lt;/h1&gt;

&lt;p&gt;Let’s break down the flow step by step.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. User Interaction
&lt;/h2&gt;

&lt;p&gt;A user initiates interaction through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Voice call
&lt;/li&gt;
&lt;li&gt;Chat interface
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Amazon Connect captures the request using a contact flow.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Contact Flow Processing
&lt;/h2&gt;

&lt;p&gt;Amazon Connect routes the request based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User input
&lt;/li&gt;
&lt;li&gt;Intent detection
&lt;/li&gt;
&lt;li&gt;Business logic
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of using static IVR, it can forward the request to a backend service.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. AWS Lambda Integration
&lt;/h2&gt;

&lt;p&gt;AWS Lambda acts as the backend logic layer.&lt;/p&gt;

&lt;p&gt;It:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Receives user input
&lt;/li&gt;
&lt;li&gt;Processes the request
&lt;/li&gt;
&lt;li&gt;Calls the Generative AI model
&lt;/li&gt;
&lt;li&gt;Handles responses
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Generative AI Processing
&lt;/h2&gt;

&lt;p&gt;The AI model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understands user intent
&lt;/li&gt;
&lt;li&gt;Uses context (if available)
&lt;/li&gt;
&lt;li&gt;Generates a natural language response
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This enables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dynamic conversations
&lt;/li&gt;
&lt;li&gt;Personalized answers
&lt;/li&gt;
&lt;li&gt;Reduced dependency on predefined scripts
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Response Delivery
&lt;/h2&gt;

&lt;p&gt;The generated response is sent back to Amazon Connect and delivered to the user through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Voice (Text-to-Speech)
&lt;/li&gt;
&lt;li&gt;Chat message
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Example Use Cases
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. Intelligent Customer Support
&lt;/h2&gt;

&lt;p&gt;Users can ask questions like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Why was I charged twice?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Instead of navigating menus, the AI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understands the query
&lt;/li&gt;
&lt;li&gt;Fetches relevant data
&lt;/li&gt;
&lt;li&gt;Generates a contextual response
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Automated Ticket Handling
&lt;/h2&gt;

&lt;p&gt;AI can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Collect user information
&lt;/li&gt;
&lt;li&gt;Create support tickets
&lt;/li&gt;
&lt;li&gt;Provide status updates
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. FAQ Automation
&lt;/h2&gt;

&lt;p&gt;Replace static FAQs with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dynamic AI responses
&lt;/li&gt;
&lt;li&gt;Context-aware answers
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Call Summarization
&lt;/h2&gt;

&lt;p&gt;After a call:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI generates summaries
&lt;/li&gt;
&lt;li&gt;Helps agents review conversations
&lt;/li&gt;
&lt;li&gt;Improves productivity
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Example Lambda Flow (Simplified)
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// Call Generative AI model&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;aiResponse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;generateResponse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userInput&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;aiResponse&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This simple flow shows how Lambda connects user input with AI output.&lt;/p&gt;

&lt;h1&gt;
  
  
  Benefits of This Architecture
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Improved Customer Experience
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Natural conversations
&lt;/li&gt;
&lt;li&gt;Faster responses
&lt;/li&gt;
&lt;li&gt;Personalized interactions
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Reduced Operational Costs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Fewer human agents required
&lt;/li&gt;
&lt;li&gt;Automated workflows
&lt;/li&gt;
&lt;li&gt;Efficient handling of repetitive queries
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Scalability
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Handles thousands of requests
&lt;/li&gt;
&lt;li&gt;No infrastructure management
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Flexibility
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Easy to integrate with backend systems
&lt;/li&gt;
&lt;li&gt;Supports multiple communication channels
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Best Practices
&lt;/h1&gt;

&lt;p&gt;To build an effective AI-powered contact center:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use clear and structured prompts
&lt;/li&gt;
&lt;li&gt;Add fallback mechanisms for failed responses
&lt;/li&gt;
&lt;li&gt;Maintain conversation context
&lt;/li&gt;
&lt;li&gt;Monitor AI outputs regularly
&lt;/li&gt;
&lt;li&gt;Ensure data privacy and security
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Challenges to Consider
&lt;/h1&gt;

&lt;p&gt;While powerful, this approach has challenges:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Handling complex edge cases
&lt;/li&gt;
&lt;li&gt;Avoiding incorrect AI responses
&lt;/li&gt;
&lt;li&gt;Managing latency
&lt;/li&gt;
&lt;li&gt;Ensuring compliance for sensitive data
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Careful system design is required to address these issues.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Future of AI in Contact Centers
&lt;/h1&gt;

&lt;p&gt;The combination of cloud contact centers and Generative AI is shaping the future of customer support.&lt;/p&gt;

&lt;p&gt;We are moving toward systems that can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understand user intent deeply
&lt;/li&gt;
&lt;li&gt;Automate multi-step workflows
&lt;/li&gt;
&lt;li&gt;Act as intelligent agents
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the future, these systems will evolve into fully autonomous AI-powered customer service platforms.&lt;/p&gt;

&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Integrating Generative AI with Amazon Connect enables organizations to build smarter, faster, and more efficient customer support systems.&lt;/p&gt;

&lt;p&gt;Instead of relying on rigid workflows, businesses can create dynamic, intelligent, and scalable experiences that adapt to user needs in real time.&lt;/p&gt;

&lt;p&gt;For developers and architects, this represents a powerful opportunity to build next-generation customer engagement platforms using AI and cloud technologies.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>aws</category>
      <category>bedrock</category>
      <category>genrativeai</category>
    </item>
    <item>
      <title>How Retrieval-Augmented Generation (RAG) Works on AWS</title>
      <dc:creator>saif ur rahman</dc:creator>
      <pubDate>Fri, 06 Mar 2026 16:04:16 +0000</pubDate>
      <link>https://dev.to/saif_urrahman/how-retrieval-augmented-generation-rag-works-on-aws-4j8n</link>
      <guid>https://dev.to/saif_urrahman/how-retrieval-augmented-generation-rag-works-on-aws-4j8n</guid>
      <description>&lt;h1&gt;
  
  
  How Retrieval-Augmented Generation (RAG) Works on AWS
&lt;/h1&gt;

&lt;p&gt;Generative AI models are powerful, but they have an important limitation: they only know what they were trained on. When you want an AI system to answer questions about your own documents, company knowledge bases, or internal data, relying solely on the model’s training data is not enough.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;Retrieval-Augmented Generation (RAG)&lt;/strong&gt; becomes one of the most important architectural patterns in modern AI systems.&lt;/p&gt;

&lt;p&gt;RAG allows generative AI models to access external knowledge sources in real time. Instead of guessing or relying only on training data, the model retrieves relevant information and then generates an answer based on that data.&lt;/p&gt;

&lt;p&gt;In this article, we will explore what RAG is, why it matters, and how it can be implemented using AWS services to build scalable and production-ready AI systems.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Retrieval-Augmented Generation (RAG)?
&lt;/h1&gt;

&lt;p&gt;Retrieval-Augmented Generation is an AI architecture that combines &lt;strong&gt;information retrieval&lt;/strong&gt; with &lt;strong&gt;generative language models&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead of asking a language model to answer a question based only on its training data, a RAG system retrieves relevant documents from a knowledge source and provides them to the model as context. The model then generates a response based on those documents.&lt;/p&gt;

&lt;p&gt;In simple terms:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RAG = Retrieve relevant information + Generate an intelligent answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach enables AI systems to work with &lt;strong&gt;up-to-date, domain-specific, and private data&lt;/strong&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why RAG is Important for Real-World AI Applications
&lt;/h1&gt;

&lt;p&gt;Without RAG, generative AI models often struggle with several challenges:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Outdated knowledge
&lt;/li&gt;
&lt;li&gt;Lack of domain-specific expertise
&lt;/li&gt;
&lt;li&gt;Hallucinations (incorrect answers)
&lt;/li&gt;
&lt;li&gt;Inability to access private or enterprise data
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;RAG addresses these issues by connecting the language model to external knowledge sources.&lt;/p&gt;

&lt;p&gt;Some common real-world applications include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customer support assistants
&lt;/li&gt;
&lt;li&gt;Enterprise knowledge search systems
&lt;/li&gt;
&lt;li&gt;Legal and compliance assistants
&lt;/li&gt;
&lt;li&gt;Financial document analysis tools
&lt;/li&gt;
&lt;li&gt;Healthcare knowledge systems
&lt;/li&gt;
&lt;li&gt;Internal company knowledge bots
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By retrieving relevant documents before generating a response, the AI system becomes &lt;strong&gt;more accurate, trustworthy, and explainable&lt;/strong&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  How RAG Works (Conceptual Flow)
&lt;/h1&gt;

&lt;p&gt;A typical RAG system operates in two main phases.&lt;/p&gt;

&lt;h1&gt;
  
  
  1. Data Preparation Phase
&lt;/h1&gt;

&lt;p&gt;In this stage, documents are processed and converted into a searchable format.&lt;/p&gt;

&lt;p&gt;The typical steps include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Collecting documents such as PDFs, HTML pages, text files, or databases
&lt;/li&gt;
&lt;li&gt;Splitting documents into smaller sections called &lt;strong&gt;chunks&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Converting each chunk into &lt;strong&gt;vector embeddings&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Storing embeddings in a &lt;strong&gt;vector database&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These embeddings allow the system to perform semantic searches based on meaning rather than exact keyword matches.&lt;/p&gt;

&lt;h1&gt;
  
  
  2. Query and Generation Phase
&lt;/h1&gt;

&lt;p&gt;When a user asks a question, the system performs the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The user query is converted into an embedding.
&lt;/li&gt;
&lt;li&gt;The system searches the vector database for similar embeddings.
&lt;/li&gt;
&lt;li&gt;The most relevant document chunks are retrieved.
&lt;/li&gt;
&lt;li&gt;The retrieved context is sent to a language model.
&lt;/li&gt;
&lt;li&gt;The model generates a response using the retrieved information.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This approach ensures the model answers questions using &lt;strong&gt;real documents instead of guesswork&lt;/strong&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Core Components of a RAG System on AWS
&lt;/h1&gt;

&lt;p&gt;When building RAG systems on AWS, several components work together to create a scalable pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Storage
&lt;/h2&gt;

&lt;p&gt;Documents are typically stored in &lt;strong&gt;Amazon S3&lt;/strong&gt;, which serves as the central repository for knowledge sources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Embedding Generation
&lt;/h2&gt;

&lt;p&gt;Embeddings are numerical representations of text used for semantic similarity search.&lt;/p&gt;

&lt;p&gt;These embeddings can be generated using foundation models available through &lt;strong&gt;Amazon Bedrock&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Vector Storage
&lt;/h2&gt;

&lt;p&gt;Vector databases store embeddings and allow similarity search operations.&lt;/p&gt;

&lt;p&gt;Common options include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon OpenSearch Serverless (vector search capability)
&lt;/li&gt;
&lt;li&gt;Other vector databases integrated with AWS services
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Retrieval Engine
&lt;/h2&gt;

&lt;p&gt;The retrieval layer searches the vector database to find the most relevant document chunks for a given query.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generative Model
&lt;/h2&gt;

&lt;p&gt;Finally, a foundation model from &lt;strong&gt;Amazon Bedrock&lt;/strong&gt; generates the response using the retrieved context.&lt;/p&gt;

&lt;h1&gt;
  
  
  RAG Architecture on AWS
&lt;/h1&gt;

&lt;p&gt;A simplified serverless architecture for RAG might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Query
   ↓
API Gateway
   ↓
AWS Lambda
   ↓
Embedding Generation
   ↓
Vector Search (OpenSearch)
   ↓
Retrieve Relevant Documents
   ↓
Foundation Model (Amazon Bedrock)
   ↓
Generated Answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This architecture is &lt;strong&gt;scalable, serverless, and cost-efficient&lt;/strong&gt;, making it suitable for production AI workloads.&lt;/p&gt;

&lt;h1&gt;
  
  
  Building RAG with Amazon Bedrock Knowledge Bases
&lt;/h1&gt;

&lt;p&gt;AWS also provides &lt;strong&gt;Knowledge Bases for Amazon Bedrock&lt;/strong&gt;, which simplifies the implementation of RAG.&lt;/p&gt;

&lt;p&gt;Instead of building the entire pipeline manually, Knowledge Bases handle several tasks automatically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Document ingestion
&lt;/li&gt;
&lt;li&gt;Chunking and embeddings
&lt;/li&gt;
&lt;li&gt;Vector indexing
&lt;/li&gt;
&lt;li&gt;Retrieval pipelines
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Developers simply provide the documents, and the service manages the underlying infrastructure.&lt;/p&gt;

&lt;p&gt;This significantly reduces operational complexity and allows developers to focus on building AI applications.&lt;/p&gt;

&lt;h1&gt;
  
  
  Techniques That Improve RAG Performance
&lt;/h1&gt;

&lt;p&gt;The effectiveness of a RAG system depends heavily on how the retrieval pipeline is designed.&lt;/p&gt;

&lt;p&gt;Several techniques can significantly improve performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Smart Document Chunking
&lt;/h2&gt;

&lt;p&gt;Documents should be divided into meaningful sections rather than random segments.&lt;/p&gt;

&lt;p&gt;Proper chunking improves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retrieval accuracy
&lt;/li&gt;
&lt;li&gt;Context understanding
&lt;/li&gt;
&lt;li&gt;Response relevance
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For structured documents such as reports or articles, &lt;strong&gt;hierarchical chunking&lt;/strong&gt; can preserve relationships between sections.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hybrid Search
&lt;/h2&gt;

&lt;p&gt;Hybrid search combines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Semantic search (vector similarity)
&lt;/li&gt;
&lt;li&gt;Keyword search
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach improves retrieval performance, especially for technical or domain-specific documents.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reranking
&lt;/h2&gt;

&lt;p&gt;Sometimes the initial retrieval step returns several loosely relevant results.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;reranker model&lt;/strong&gt; evaluates those results and prioritizes the most relevant documents.&lt;/p&gt;

&lt;p&gt;This allows the system to send fewer but higher-quality documents to the language model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Context Window Optimization
&lt;/h2&gt;

&lt;p&gt;Sending too many documents to the language model increases both cost and latency.&lt;/p&gt;

&lt;p&gt;A well-designed RAG system retrieves only the &lt;strong&gt;most relevant chunks&lt;/strong&gt;, ensuring efficient responses.&lt;/p&gt;

&lt;h1&gt;
  
  
  Benefits of Using RAG on AWS
&lt;/h1&gt;

&lt;p&gt;Implementing RAG provides several benefits for enterprise AI systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Improved Accuracy&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Responses are generated using real documents rather than relying solely on training data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reduced Hallucinations&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The model is grounded in verified information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Access to Private Data&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Organizations can safely use internal knowledge bases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
AWS services allow the system to scale automatically based on demand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cost Efficiency&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Serverless architectures reduce infrastructure management overhead.&lt;/p&gt;

&lt;h1&gt;
  
  
  Common Use Cases of RAG
&lt;/h1&gt;

&lt;p&gt;RAG is widely used across many industries.&lt;/p&gt;

&lt;p&gt;Some examples include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Customer Support Assistants&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
AI systems retrieve answers from support documentation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enterprise Knowledge Systems&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Employees can search internal knowledge bases using natural language.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Legal Document Analysis&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
AI retrieves relevant clauses from contracts and policies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Financial Research Tools&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Analysts can query financial reports and market documents.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Healthcare Knowledge Systems&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Medical professionals can access clinical documentation efficiently.&lt;/p&gt;

&lt;h1&gt;
  
  
  Challenges When Implementing RAG
&lt;/h1&gt;

&lt;p&gt;Although RAG is powerful, designing an effective system requires careful planning.&lt;/p&gt;

&lt;p&gt;Some common challenges include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Quality&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Poorly structured documents lead to poor retrieval results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chunking Strategy&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Improper chunk sizes reduce the quality of context provided to the model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Latency&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Multiple retrieval steps can increase response time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Sensitive documents require proper access control.&lt;/p&gt;

&lt;p&gt;AWS security features such as IAM and encryption help address these concerns.&lt;/p&gt;

&lt;h1&gt;
  
  
  Best Practices for Production RAG Systems
&lt;/h1&gt;

&lt;p&gt;When building a production-ready RAG system, consider the following best practices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Store documents in structured formats
&lt;/li&gt;
&lt;li&gt;Use semantic chunking strategies
&lt;/li&gt;
&lt;li&gt;Implement reranking for better retrieval accuracy
&lt;/li&gt;
&lt;li&gt;Monitor model outputs to detect hallucinations
&lt;/li&gt;
&lt;li&gt;Optimize the number of retrieved documents to reduce token costs
&lt;/li&gt;
&lt;li&gt;Apply strict access control for sensitive data
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Following these practices ensures your RAG system remains reliable and efficient.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Future of RAG and AI Applications
&lt;/h1&gt;

&lt;p&gt;RAG is rapidly becoming the &lt;strong&gt;standard architecture for enterprise generative AI systems&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;As foundation models continue to improve, the real competitive advantage will come from how effectively these models connect to &lt;strong&gt;real-world knowledge sources&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Combining RAG with technologies such as &lt;strong&gt;AI agents, automation workflows, and serverless cloud architectures&lt;/strong&gt; will enable even more powerful and intelligent applications.&lt;/p&gt;

&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Retrieval-Augmented Generation bridges the gap between large language models and real-world knowledge.&lt;/p&gt;

&lt;p&gt;By combining document retrieval with generative models, developers can build AI systems that are accurate, context-aware, and capable of answering complex questions based on real data.&lt;/p&gt;

&lt;p&gt;AWS provides a powerful ecosystem of services that make building RAG systems scalable and production-ready. Whether you are developing an enterprise knowledge assistant, a customer support chatbot, or a document analysis platform, RAG is one of the most effective architectures available today.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>ai</category>
      <category>genai</category>
      <category>rag</category>
    </item>
    <item>
      <title>Why Your LLM Pipeline Needs Circuit Breakers</title>
      <dc:creator>saif ur rahman</dc:creator>
      <pubDate>Wed, 25 Feb 2026 09:00:51 +0000</pubDate>
      <link>https://dev.to/saif_urrahman/why-your-llm-pipeline-needs-circuit-breakers-26c4</link>
      <guid>https://dev.to/saif_urrahman/why-your-llm-pipeline-needs-circuit-breakers-26c4</guid>
      <description>&lt;p&gt;Most LLM demos work perfectly.&lt;/p&gt;

&lt;p&gt;Until they don’t.&lt;/p&gt;

&lt;p&gt;You test your prompt in the playground. It responds beautifully. You wire it into production. A few users try it. Everything seems fine.&lt;/p&gt;

&lt;p&gt;Then traffic increases.&lt;/p&gt;

&lt;p&gt;Then Bedrock throttles.&lt;/p&gt;

&lt;p&gt;Then retries start firing.&lt;/p&gt;

&lt;p&gt;Then your queue depth spikes.&lt;/p&gt;

&lt;p&gt;Then you accidentally DDoS your own model endpoint.&lt;/p&gt;

&lt;p&gt;This is the moment most AI systems fail — not because of intelligence, but because of infrastructure.&lt;/p&gt;

&lt;p&gt;If you're building a real production AI backend, you don’t just need prompts.&lt;/p&gt;

&lt;p&gt;You need circuit breakers.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Illusion of Reliability in LLM Systems
&lt;/h2&gt;

&lt;p&gt;When we integrate an LLM into a system, it feels like calling any other API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;callLLM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But LLMs are not ordinary APIs.&lt;/p&gt;

&lt;p&gt;They are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Capacity-constrained&lt;/li&gt;
&lt;li&gt;Rate-limited&lt;/li&gt;
&lt;li&gt;Token-limited&lt;/li&gt;
&lt;li&gt;Region-dependent&lt;/li&gt;
&lt;li&gt;Occasionally throttled&lt;/li&gt;
&lt;li&gt;Sometimes unavailable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And when they fail, they fail in bursts.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Real Failure Modes
&lt;/h1&gt;

&lt;p&gt;Let’s look at what actually happens in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  1 Bedrock Throttling
&lt;/h2&gt;

&lt;p&gt;You’ll see errors like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ThrottlingException: Too many tokens per day
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rate exceeded
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is not a bug in your code.&lt;/p&gt;

&lt;p&gt;This is capacity control.&lt;/p&gt;

&lt;p&gt;But here’s where it becomes dangerous:&lt;/p&gt;

&lt;p&gt;If your system retries immediately, you amplify the problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  2 Retry Storms
&lt;/h2&gt;

&lt;p&gt;Imagine 500 concurrent requests.&lt;/p&gt;

&lt;p&gt;Each one gets throttled.&lt;/p&gt;

&lt;p&gt;Each one retries instantly.&lt;/p&gt;

&lt;p&gt;Now you have 1,000 requests.&lt;/p&gt;

&lt;p&gt;They retry again.&lt;/p&gt;

&lt;p&gt;Now you have 2,000.&lt;/p&gt;

&lt;p&gt;You’ve created a retry storm.&lt;/p&gt;

&lt;p&gt;Your queue explodes.&lt;br&gt;
Your workers saturate.&lt;br&gt;
Your AI endpoint collapses.&lt;/p&gt;

&lt;p&gt;This is how fragile AI backends implode.&lt;/p&gt;
&lt;h2&gt;
  
  
  3 Naive Exponential Backoff Isn’t Enough
&lt;/h2&gt;

&lt;p&gt;Most developers think this solves it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;retryWithExponentialBackoff&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s necessary.&lt;/p&gt;

&lt;p&gt;But it’s not sufficient.&lt;/p&gt;

&lt;p&gt;Because if the upstream dependency (Bedrock) is hard-throttled for minutes or hours, exponential backoff just spreads out the pain.&lt;/p&gt;

&lt;p&gt;You still keep hitting a failing system.&lt;/p&gt;

&lt;p&gt;What you actually need is a circuit breaker.&lt;/p&gt;

&lt;h1&gt;
  
  
  What Is a Circuit Breaker (In AI Context)?
&lt;/h1&gt;

&lt;p&gt;A circuit breaker is a control mechanism that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Detects repeated failures&lt;/li&gt;
&lt;li&gt;Stops sending traffic to a failing dependency&lt;/li&gt;
&lt;li&gt;Waits for recovery&lt;/li&gt;
&lt;li&gt;Gradually restores traffic&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It prevents cascading failures.&lt;/p&gt;

&lt;p&gt;It protects your infrastructure from external instability.&lt;/p&gt;

&lt;p&gt;In LLM systems, it’s mandatory.&lt;/p&gt;

&lt;h1&gt;
  
  
  Designing Circuit Breakers for LLM Pipelines
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. Failure Threshold Detection
&lt;/h2&gt;

&lt;p&gt;Track consecutive failures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ThrottlingException&lt;/li&gt;
&lt;li&gt;Timeout&lt;/li&gt;
&lt;li&gt;5xx responses&lt;/li&gt;
&lt;li&gt;Token quota exceeded&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If failure rate exceeds a threshold (e.g., 30% in 1 minute):&lt;/p&gt;

&lt;p&gt;Trip the breaker.&lt;/p&gt;

&lt;p&gt;Store this state in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Memory (single worker)&lt;/li&gt;
&lt;li&gt;Redis (multi-instance)&lt;/li&gt;
&lt;li&gt;DynamoDB (serverless safe)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Open the Circuit
&lt;/h2&gt;

&lt;p&gt;When open:&lt;/p&gt;

&lt;p&gt;Do NOT call Bedrock.&lt;/p&gt;

&lt;p&gt;Instead:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Return a graceful error&lt;/li&gt;
&lt;li&gt;Queue for later processing&lt;/li&gt;
&lt;li&gt;Route to fallback model&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This prevents retry storms.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Half-Open State
&lt;/h2&gt;

&lt;p&gt;After a cooldown (e.g., 60 seconds):&lt;/p&gt;

&lt;p&gt;Allow limited traffic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1 request&lt;/li&gt;
&lt;li&gt;Then 5&lt;/li&gt;
&lt;li&gt;Then 10&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If successful → close the breaker.&lt;br&gt;
If failed → reopen immediately.&lt;/p&gt;

&lt;p&gt;Controlled recovery is critical.&lt;/p&gt;
&lt;h1&gt;
  
  
  Fallback Models: Your Safety Net
&lt;/h1&gt;

&lt;p&gt;Circuit breakers should not just stop traffic.&lt;/p&gt;

&lt;p&gt;They should degrade gracefully.&lt;/p&gt;

&lt;p&gt;Primary model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Claude Sonnet 4.5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fallback model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Claude 3 Sonnet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Emergency fallback:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Claude Haiku
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If high-tier model fails:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatically switch to smaller model&lt;/li&gt;
&lt;li&gt;Reduce max_tokens&lt;/li&gt;
&lt;li&gt;Return simplified output&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Users prefer partial functionality over total outage.&lt;/p&gt;




&lt;h1&gt;
  
  
  Auto-Disabling Failing Endpoints
&lt;/h1&gt;

&lt;p&gt;In distributed AI systems, you might have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multiple regions&lt;/li&gt;
&lt;li&gt;Multiple models&lt;/li&gt;
&lt;li&gt;Multiple inference profiles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If one endpoint begins failing:&lt;/p&gt;

&lt;p&gt;Disable it automatically.&lt;/p&gt;

&lt;p&gt;Maintain a health registry:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;us-east-1: unhealthy
eu-west-1: healthy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Route traffic only to healthy regions.&lt;/p&gt;

&lt;p&gt;This is how resilient systems behave.&lt;/p&gt;

&lt;h1&gt;
  
  
  A Safe Architecture Pattern
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;API Gateway
    ↓
Request Lambda
    ↓
SQS
    ↓
Worker Lambda
    ↓
Circuit Breaker Layer
    ↓
LLM Call
    ↓
Fallback Router
    ↓
S3 + DynamoDB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Never let your worker blindly call the model.&lt;/p&gt;

&lt;p&gt;Always call through a protective layer.&lt;/p&gt;

&lt;h1&gt;
  
  
  AI Systems Are Distributed Systems
&lt;/h1&gt;

&lt;p&gt;LLM integration is not prompt engineering.&lt;/p&gt;

&lt;p&gt;It’s distributed systems engineering.&lt;/p&gt;

&lt;p&gt;If you wouldn’t connect your production system to a database without:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connection pooling&lt;/li&gt;
&lt;li&gt;Retry logic&lt;/li&gt;
&lt;li&gt;Circuit breakers&lt;/li&gt;
&lt;li&gt;Health checks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then you shouldn’t connect it directly to an LLM either.&lt;/p&gt;

&lt;h1&gt;
  
  
  Final Thought
&lt;/h1&gt;

&lt;p&gt;LLMs are probabilistic.&lt;/p&gt;

&lt;p&gt;Infrastructure must be deterministic.&lt;/p&gt;

&lt;p&gt;If you don’t design protective layers around your AI dependencies, your system will eventually fail under load.&lt;/p&gt;

&lt;p&gt;Not because your model is bad.&lt;/p&gt;

&lt;p&gt;But because your architecture is fragile.&lt;/p&gt;

&lt;p&gt;And fragile systems don’t scale.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>ai</category>
      <category>bedrock</category>
      <category>genai</category>
    </item>
    <item>
      <title>6 Mistakes Developers Make When Deploying Generative AI on AWS (And How to Fix Them)</title>
      <dc:creator>saif ur rahman</dc:creator>
      <pubDate>Tue, 24 Feb 2026 10:27:27 +0000</pubDate>
      <link>https://dev.to/saif_urrahman/6-mistakes-developers-make-when-deploying-generative-ai-on-aws-and-how-to-fix-them-36od</link>
      <guid>https://dev.to/saif_urrahman/6-mistakes-developers-make-when-deploying-generative-ai-on-aws-and-how-to-fix-them-36od</guid>
      <description>&lt;p&gt;Generative AI is everywhere right now.&lt;/p&gt;

&lt;p&gt;We’re building AI report generators, document summarizers, compliance checkers, risk engines, chatbots — and most of them work perfectly in local development.&lt;/p&gt;

&lt;p&gt;Until they hit production.&lt;/p&gt;

&lt;p&gt;Then things start breaking.&lt;/p&gt;

&lt;p&gt;Timeouts.&lt;br&gt;&lt;br&gt;
Retries gone wrong.&lt;br&gt;&lt;br&gt;
Users refreshing the page 10 times.&lt;br&gt;&lt;br&gt;
S3 buckets accidentally public.&lt;br&gt;&lt;br&gt;
No clear job status.&lt;br&gt;&lt;br&gt;
Lambda costs increasing silently.&lt;/p&gt;

&lt;p&gt;I recently built a production-ready serverless Generative AI backend on AWS, and along the way I made (and fixed) almost every mistake in this list.&lt;/p&gt;

&lt;p&gt;If you’re deploying GenAI workloads on AWS, especially with Lambda, this article will save you time, money, and headaches.&lt;/p&gt;

&lt;p&gt;Let’s break it down.&lt;/p&gt;
&lt;h1&gt;
  
  
  Mistake #1: Blocking API Calls with LLM Requests
&lt;/h1&gt;
&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;The most common mistake I see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Inside API handler&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;callLLM&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
`&lt;/p&gt;

&lt;p&gt;Looks simple.&lt;/p&gt;

&lt;p&gt;But here’s what happens in production:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API Gateway has a &lt;strong&gt;29-second timeout&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;LLM calls can take 10–60 seconds&lt;/li&gt;
&lt;li&gt;External APIs (news, sanctions, risk feeds) add latency&lt;/li&gt;
&lt;li&gt;Users sit there waiting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Eventually:&lt;/p&gt;

&lt;p&gt;Timeout.&lt;/p&gt;

&lt;p&gt;And your user thinks your AI “doesn’t work”.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix: Asynchronous Architecture with SQS
&lt;/h2&gt;

&lt;p&gt;Instead of blocking the API, decouple it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Better flow:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
Client&lt;br&gt;
  ↓&lt;br&gt;
API Gateway&lt;br&gt;
  ↓&lt;br&gt;
Lambda (Request Handler)&lt;br&gt;
  ↓&lt;br&gt;
SQS&lt;br&gt;
  ↓&lt;br&gt;
Worker Lambda (long timeout)&lt;br&gt;
  ↓&lt;br&gt;
Bedrock / External APIs&lt;br&gt;
  ↓&lt;br&gt;
S3 + DynamoDB&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The API only:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Validates input&lt;/li&gt;
&lt;li&gt;Creates a report record&lt;/li&gt;
&lt;li&gt;Sends message to SQS&lt;/li&gt;
&lt;li&gt;Returns immediately&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The worker handles heavy AI processing.&lt;/p&gt;

&lt;p&gt;This removes timeouts completely and makes your system scalable.&lt;/p&gt;

&lt;h1&gt;
  
  
  Mistake #2: No Retry Logic for AI Failures
&lt;/h1&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;LLMs fail.&lt;br&gt;
External APIs fail.&lt;br&gt;
Network calls fail.&lt;/p&gt;

&lt;p&gt;If you call AI directly inside a request and it fails:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The user request fails&lt;/li&gt;
&lt;li&gt;No retry&lt;/li&gt;
&lt;li&gt;No recovery&lt;/li&gt;
&lt;li&gt;No record of what happened&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is dangerous in compliance or risk systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix: Let SQS Handle Retries
&lt;/h2&gt;

&lt;p&gt;SQS + Lambda event source mapping automatically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retries failed messages&lt;/li&gt;
&lt;li&gt;Respects visibility timeout&lt;/li&gt;
&lt;li&gt;Supports Dead Letter Queues&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now if your worker fails:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The message returns to queue&lt;/li&gt;
&lt;li&gt;Lambda retries&lt;/li&gt;
&lt;li&gt;You can configure &lt;code&gt;maxReceiveCount&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;You can attach a DLQ for failed jobs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You get retry logic &lt;strong&gt;without writing retry code&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That’s production engineering.&lt;/p&gt;

&lt;h1&gt;
  
  
  Mistake #3: No Status Tracking for AI Jobs
&lt;/h1&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;User submits request.&lt;/p&gt;

&lt;p&gt;Now what?&lt;/p&gt;

&lt;p&gt;You have no idea if the job is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pending&lt;/li&gt;
&lt;li&gt;Processing&lt;/li&gt;
&lt;li&gt;Completed&lt;/li&gt;
&lt;li&gt;Failed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Users refresh blindly.&lt;br&gt;
You cannot build dashboards.&lt;br&gt;
You cannot monitor performance.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Fix: DynamoDB Lifecycle Tracking
&lt;/h2&gt;

&lt;p&gt;Use DynamoDB as a job state tracker.&lt;/p&gt;

&lt;p&gt;When request is created:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;json&lt;br&gt;
{&lt;br&gt;
  "status": "PENDING",&lt;br&gt;
  "risk_level": null,&lt;br&gt;
  "s3_url": null&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When worker starts:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
status → PROCESSING&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When completed:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
status → COMPLETED&lt;br&gt;
risk_level → High&lt;br&gt;
s3_url → https://...&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now your frontend can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Poll job status&lt;/li&gt;
&lt;li&gt;Show progress&lt;/li&gt;
&lt;li&gt;Display result when ready&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is how long-running AI jobs should be handled.&lt;/p&gt;

&lt;h1&gt;
  
  
  Mistake #4: Making S3 Buckets Public
&lt;/h1&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;You generate AI reports and store them in S3.&lt;/p&gt;

&lt;p&gt;Quick solution?&lt;/p&gt;

&lt;p&gt;Make bucket public.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;json&lt;br&gt;
{&lt;br&gt;
  "Principal": "*",&lt;br&gt;
  "Action": "s3:GetObject"&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Done.&lt;/p&gt;

&lt;p&gt;Except now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Anyone can download reports&lt;/li&gt;
&lt;li&gt;Sensitive data is exposed&lt;/li&gt;
&lt;li&gt;Compliance risk increases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And yes, I’ve seen this happen.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix: Use Pre-Signed URLs
&lt;/h2&gt;

&lt;p&gt;Keep your bucket private.&lt;/p&gt;

&lt;p&gt;When job completes:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;js&lt;br&gt;
const url = await getSignedUrl(s3Client, command, {&lt;br&gt;
  expiresIn: 600 // 10 minutes&lt;br&gt;
});&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;URL works temporarily&lt;/li&gt;
&lt;li&gt;Only authorized user gets access&lt;/li&gt;
&lt;li&gt;Bucket remains private&lt;/li&gt;
&lt;li&gt;You avoid major security risks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Public buckets and AI-generated reports should never mix.&lt;/p&gt;

&lt;h1&gt;
  
  
  Mistake #5: Weak Input Validation
&lt;/h1&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Most GenAI systems accept user input like:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;json&lt;br&gt;
{&lt;br&gt;
  "companyName": "...",&lt;br&gt;
  "corporateNumber": "..."&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Without proper validation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Invalid corporate numbers&lt;/li&gt;
&lt;li&gt;Injection attempts&lt;/li&gt;
&lt;li&gt;Broken workflows&lt;/li&gt;
&lt;li&gt;Garbage-in → garbage-out AI responses&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;LLMs amplify bad input.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix: Strong Validation Schema
&lt;/h2&gt;

&lt;p&gt;Use a validation layer (e.g., Joi):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;js&lt;br&gt;
corporateNumber: Joi.string()&lt;br&gt;
  .pattern(/^[a-zA-Z0-9-]+$/)&lt;br&gt;
  .required()&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Validate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Length&lt;/li&gt;
&lt;li&gt;Format&lt;/li&gt;
&lt;li&gt;Required fields&lt;/li&gt;
&lt;li&gt;Country constraints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Never trust AI to fix bad input.&lt;/p&gt;

&lt;p&gt;AI is powerful — not magical.&lt;/p&gt;

&lt;h1&gt;
  
  
  Mistake #6: Over-Permissive IAM Roles
&lt;/h1&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Many developers attach:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
AdministratorAccess&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To Lambda for convenience.&lt;/p&gt;

&lt;p&gt;This is dangerous:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;S3 access everywhere&lt;/li&gt;
&lt;li&gt;DynamoDB access everywhere&lt;/li&gt;
&lt;li&gt;Bedrock access unrestricted&lt;/li&gt;
&lt;li&gt;Harder to audit&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Fix: Least Privilege IAM
&lt;/h2&gt;

&lt;p&gt;Grant only what you need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sqs:SendMessage&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sqs:ReceiveMessage&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dynamodb:UpdateItem&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;s3:PutObject&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;s3:GetObject&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Specific resource ARNs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your GenAI backend becomes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More secure&lt;/li&gt;
&lt;li&gt;Easier to audit&lt;/li&gt;
&lt;li&gt;Production compliant&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Security is part of AI engineering.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Real Lesson
&lt;/h1&gt;

&lt;p&gt;Generative AI is not just about prompting.&lt;/p&gt;

&lt;p&gt;It’s about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Architecture&lt;/li&gt;
&lt;li&gt;Reliability&lt;/li&gt;
&lt;li&gt;Security&lt;/li&gt;
&lt;li&gt;Observability&lt;/li&gt;
&lt;li&gt;Lifecycle management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you treat LLMs like simple API calls, your system will fail at scale.&lt;/p&gt;

&lt;p&gt;If you treat them like long-running distributed workloads, you’ll build something production-ready.&lt;/p&gt;

&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;AI is the exciting part.&lt;/p&gt;

&lt;p&gt;But infrastructure is what makes it usable.&lt;/p&gt;

&lt;p&gt;The difference between a demo and a real product is not the model — it’s the backend design.&lt;/p&gt;

&lt;p&gt;If you’re deploying Generative AI on AWS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use async patterns&lt;/li&gt;
&lt;li&gt;Track state&lt;/li&gt;
&lt;li&gt;Avoid blocking APIs&lt;/li&gt;
&lt;li&gt;Secure your storage&lt;/li&gt;
&lt;li&gt;Validate aggressively&lt;/li&gt;
&lt;li&gt;Follow least privilege&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s how you build AI systems that survive production.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>ai</category>
      <category>bedrock</category>
      <category>generativeai</category>
    </item>
  </channel>
</rss>
