Saturday, March 21, 2026

AI | Application Architecture with Bedrock

Amazon Bedrock architecture consists of a client application that sends prompts through an API layer to the Bedrock service, which processes the request using selected foundation models, optionally enriches it using knowledge bases (RAG), applies guardrails, and returns the generated response back to the user.

Step-by-Step Explanation

1. User / Application Layer

This is where interaction starts:

  • Web app (chatbot UI)
  • Mobile app
  • Backend service

User sends:

  • Prompt (e.g., “Explain AI”)
  • Query (e.g., search in documents)

2. Frontend / API Layer

Handles request input:

  • UI collects input
  • Sends request via API

Common AWS tools used:

  • API Gateway
  • SDK (Python, Java, JS)

3. Application Layer (Backend Logic)

This layer prepares the request before sending to Bedrock:

Tasks:

  • Format prompt
  • Add system instructions
  • Manage session memory
  • Call Bedrock API

Example:

User: "Summarize this document"
Backend adds:
"You are a helpful assistant..."

Amazon Bedrock Core Layer 🧠

This is the main engine.

(A) Model Selection Layer

You choose which model to use:

  • Claude
  • Titan
  • Llama
    etc.

Same API → different models


(B) Prompt Processing

Bedrock processes:

  • Input prompt
  • Context (chat history)
  • Retrieved documents (if RAG)


(C) Foundation Models (FMs)

Actual AI models generate output:

Types:

  • Text models (chat, code)
  • Image models
  • Embedding models

(D) Agents (Optional but powerful)

Agents can:

  • Call APIs
  • Query databases
  • Perform tasks

Example:

User: Book a ticket
Agent → calls booking API → returns result

(E) Guardrails & Security

Controls:

  • Content filtering
  • Data privacy
  • Access control

Ensures:

  • Safe responses
  • No harmful output

5. Knowledge Base (RAG Layer)

If enabled, Bedrock uses:

  • Vector database
  • Embeddings

Flow:

User question → Search documents → Retrieve relevant info → Send to model

Connected data sources:

  • S3 (PDFs, docs)
  • Databases
  • APIs

6. Data Sources Layer

Where actual data is stored:

  • Files (PDF, Word)
  • Company databases
  • External APIs

7. Response Generation

Model generates:

  • Text answer
  • Image
  • Structured output

8. Response Back to User

Final output goes back through:

Bedrock → Backend → Frontend → User

Full Flow 
User Input

Frontend UI

Backend (adds context)

Bedrock API

Model + Knowledge Base

Generated Response

User

Key Components Summary

ComponentPurpose
FrontendUser interaction
BackendPrompt processing
BedrockAI engine
ModelsGenerate output
Knowledge BaseLong-term memory
AgentsAutomation
GuardrailsSafety

No comments:

Post a Comment

Node | Cluster Vs Worker Threads

Cluster: Multiple processes (scale app across CPU cores) Worker Threads: Multiple threads (handle CPU-heavy work inside one process) Cluster...