Chapter 21 · Capstone LangChain Track Full-stack Project

One copilot, three production agents, zero "which tool do I use?".

The Chapter 21 capstone. Type any QA request in plain English and an LLM router classifies it as TRIAGE, DESIGN or RCA, then dispatches it to the matching production agent: bug triage, test designer, or root-cause analysis. CLI router and Streamlit UI share one core module.

01 What students build

copilot_core.py orchestrates the three prod agents behind a single handle(request) entry point. A small Groq classifier (route()) returns exactly one label: TRIAGE (a bug to prioritise), DESIGN (write test cases for a story), or RCA (something is failing, find why). Every path degrades gracefully: real JIRA and the RAG KB first, pasted text second, labelled sample data last, so the copilot keeps working even when local resources are unreachable. Both the CLI (qa_copilot.py) and the Streamlit UI (qa_copilot_ui.py) use the same core, so there is no duplicated logic.

LLM Router

A temperature-0 classifier prompt that must reply with a single label. Ambiguous requests default to TRIAGE, the safest bucket.

Three Prod Agents

Bug triage (JIRA + RAG), test designer (JIRA + RAG), and RCA (Jenkins, GitHub, health ping) plugged in unchanged from earlier lessons.

Graceful Fallback

Prod source first, pasted text second, sample data last: every response is stamped with which source actually served it.

02 Architecture

Free-text requestCLI or Streamlit UI
──▶
route()Groq classifier · 1 label
──▶
handle()dispatch + fallback
TRIAGEbug triage · JIRA + RAG
DESIGNtest designer · JIRA + RAG
RCAJenkins · GitHub · health
fallback ladder: prod source → pasted text → labelled sample data

03 Live demo (simulated with sample data)

This is a UI walkthrough with pre-baked sample data so you can feel the routing without any backend. In the course you run the real thing: Streamlit UI over Groq, JIRA, Jenkins and the local Chroma KB.

qa-copilot · localhost:8501 demo · sample data

04 Inputs & outputs

What goes in

  • Any free-text QA request, plus an optional JIRA key
  • Sidebar config: Groq key, JIRA creds, Jenkins job, health URL
  • The QA Copilot RAG KB (shared with triage and design)
  • Nothing else: the router decides the rest

What comes out

  • The router's label: TRIAGE, DESIGN or RCA
  • The routed agent's full result (triage card, TestPlan, or RCA verdict)
  • A source stamp: prod · JIRA + RAG, or fallback · pasted text
  • Tool-call trace for RCA runs, step by step

05 How it's built

Import the three prod agents unchanged: triage, designer and RCA each stay in their own module.
Write route(): a temperature-0 Groq prompt that must answer with exactly one label, TRIAGE, DESIGN or RCA.
Wrap each agent in a runner (run_triage, run_design, run_rca) that returns a uniform dict with ok, mode, source and payload.
Build the fallback ladder inside each runner: real JIRA/Jenkins first, pasted text second, labelled dummy data last.
Expose one handle(request, jira_key) entry point that routes and dispatches.
Ship two frontends over the same core: a CLI router and a Streamlit UI with sidebar configuration.

06 Tech stack

Python · LangChainGroq llama-3.3-70b-versatileLLM routing (classifier)Streamlit UICLI routerJIRA REST v3Jenkins + GitHub + health toolsChroma + Ollama embeddingsFallback ladder