Lab 04

LangChain on AWS

Physical twin of the lab pipe

What
The same bind → retrieve → template → invoke → parse pipe, drawn as AWS boxes: Ingress, Compose, Retriever, Prompt, Model, Parser, Egress.
Why
The live lab streams runnables on localhost. This page is the production-scale picture of those hops.
What you are seeing
The region picture shows Browser → Edge → named lab hops → egress. Stage boxes below are the same twin grouped as the live Flow column.

Teaching map only. This playground uses langchain-core plus Ollama on localhost — no AWS keys, no hosted models, no prompts leave the machine.

Back to the lab

Region picture

Browser to edge, then named lab steps inside a region, then metrics and egress.

  • Edge
  • Orchestrate
  • Model
  • Storage
  • Search
  • Policy

Browser

Edge

API Gateway
Lambda

Region

LangChain physical architecture on AWS

LCEL pipe

Named hops, same order as the lab

bind
Lambda
Parameter Store
retrieve
Bedrock KB
OpenSearch
template
Bedrock Prompts
Lambda
invoke
Bedrock Runtime
Guardrails
parse
Lambda
Bedrock
CloudWatch

metrics only

API Gateway

Browser

egress

Stage boxes

The same twin, grouped the way the live Flow column lights.

The question enters a managed API, then a composed LangChain pipe. Twin of POST /labs/langchain/run.

LangChain’s lesson: retrieve | prompt | llm | parser. Each hop is a runnable you can swap. This is not a graph — it is a straight pipe.

A LangChain retriever is a runnable that returns documents. Locally: Chroma + Ollama embed. On AWS: Bedrock Knowledge Bases.

ChatPromptTemplate fills {question} and {context}. You can inspect the formatted string before it hits the model — that is the chain being honest.

The llm runnable. Locally Ollama via the provider seam (not a second Ollama client). On AWS: Bedrock Converse.

JsonOutputParser turns model text into {answer, grounded, sources}. If the model wanders, the parser fails closed and the lab still shows the raw string.

Return the parsed object and the intermediates. Metrics only — not the prompt body in logs.