Advanced Capstone: Production Pipeline and Monitoring
The pipeline does not stop at merge. It watches the model in production, too.
5 min read5 মিনিটে পড়া যায় · 6 sections6টি সেকশন · 6 sources6টি সোর্স · updated Nov 2026আপডেট: Nov 2026
Two gates: before merge and after deployদুটো গেট: মার্জের আগে আর ডেপ্লয়ের পরে
Send a change through the CI gate, then watch live traffic catch what the gate missed.একটা পরিবর্তন CI গেটের ভেতর দিয়ে পাঠান, তারপর দেখুন লাইভ ট্রাফিক গেটের মিস করা জিনিস ধরে ফেলে।
You’ll learnআপনি শিখবেন
- What the pre-merge gate checkspre-merge গেট কী কী চেক করে
- Why the gate misses untested questionsগেট কেন টেস্ট-না-করা প্রশ্ন মিস করে
- When the cost alert firesখরচের অ্যালার্ট কখন বাজে
- How the A/B share sets the calls at riskA/B অংশ কীভাবে ঝুঁকির কল ঠিক করে
In plain words
This session connects two things built separately in this course: the CI gate from the eval modules, and the observability tools from the monitoring modules, into one pipeline that covers both pre-merge and post-deploy. Promptfoo's eval runs on every PR Source 1সোর্স 1, wired through GitHub Actions Source 6সোর্স 6, exactly as in the first capstone. Marking that job as a required status check is a branch-protection setting in GitHub Source 6সোর্স 6. What is new here is adding LangFuse tracing Source 3সোর্স 3 and Arize Phoenix continuous evaluation Source 4সোর্স 4 on the deployed app, so quality is checked twice: once before the code merges, and continuously after it is live.
Cost monitoring and an A/B framework are the two pieces that only make sense once there is live traffic to measure: cost monitoring sums real token usage instead of a test suite's fixed case count, and an A/B framework compares two model or prompt versions on real questions instead of a frozen eval set.
সহজ English
This session joins two things you built separately in this course. One is the CI gate from the eval modules. The other is the observability tools from the monitoring modules. Together they make one pipeline. It covers the time before merge and the time after deploy.
Promptfoo's eval runs on every PR Source 1সোর্স 1. It runs through GitHub Actions Source 6সোর্স 6, just as in the first capstone. Marking that job as a required check is a branch-protection setting in GitHub Source 6সোর্স 6. The new part is LangFuse tracing Source 3সোর্স 3 and Arize Phoenix continuous evaluation Source 4সোর্স 4 on the deployed app. So quality is checked twice. It is checked before the code merges. It is checked again, all the time, once the app is live.
Two pieces only make sense when you have live traffic to measure. They are cost monitoring and an A/B framework. Cost monitoring adds up real token usage. A test suite only has a fixed number of cases. An A/B framework compares two model or prompt versions on real questions. A frozen eval set cannot do that.
বাংলা ব্যাখ্যা
এই session এই course-এ আলাদাভাবে বানানো দুটো জিনিস জোড়া দেয়: eval মডিউল থেকে CI gate, আর monitoring মডিউল থেকে observability টুল, একটা pipeline-এ যা pre-merge আর post-deploy দুটোই কভার করে। Promptfoo-র eval প্রতিটা PR-এ চলে Source 1সোর্স 1, GitHub Actions দিয়ে জোড়া Source 6সোর্স 6, ঠিক প্রথম capstone-এর মতো। সেই job-কে required status check হিসেবে চিহ্নিত করা GitHub-এর branch-protection setting Source 6সোর্স 6। এখানে নতুন যা, deployed app-এ LangFuse tracing Source 3সোর্স 3 আর Arize Phoenix continuous evaluation Source 4সোর্স 4 যোগ করা, তাই quality দুইবার চেক হয়: একবার code merge হওয়ার আগে, আর একটানা এটা live হওয়ার পরে।
Cost monitoring আর একটা A/B framework দুটো অংশ যা শুধু live traffic পরিমাপ করার জন্য থাকলেই অর্থবহ হয়: cost monitoring একটা test suite-এর স্থির case সংখ্যার বদলে real token ব্যবহার যোগ করে, আর একটা A/B framework দুটো model বা prompt version real প্রশ্নে তুলনা করে, একটা হিমায়িত eval সেটে নয়।
How it works
The two halves of the pipeline, pre-merge and post-deploy, side by side:
PRE-MERGE (CI, blocks the PR)
Promptfoo eval -> exit code 100 fails the check
agent decision tests (pytest) -> non-zero exit fails the check
POST-DEPLOY (continuous, does not block anything by itself)
every call traced via Langfuse
a sample continuously scored by Arize Phoenix
cost summed per session, alerted on a spike
A/B split: a fraction of traffic on a candidate model or prompt versionThe post-deploy half does not replace the pre-merge gate; it catches what the gate cannot, because it only sees the fixed eval set, not real traffic. A quality drop that only appears on a question nobody wrote a test case for shows up here first.
The A/B framework works by routing a small percentage of live traffic to a candidate version and comparing its traced metrics against the baseline's, over the same Phoenix or LangFuse pipeline already in place Source 4সোর্স 4 Source 3সোর্স 3 — it does not need a separate tracing setup, only a routing decision and a comparison query.
সহজ English
Here are the two halves of the pipeline, side by side:
PRE-MERGE (CI, blocks the PR)
Promptfoo eval -> exit code 100 fails the check
agent decision tests (pytest) -> non-zero exit fails the check
POST-DEPLOY (continuous, does not block anything by itself)
every call traced via Langfuse
a sample continuously scored by Arize Phoenix
cost summed per session, alerted on a spike
A/B split: a fraction of traffic on a candidate model or prompt versionThe post-deploy half does not replace the pre-merge gate. It catches what the gate cannot. The gate only sees the fixed eval set, not real traffic. A quality drop on a question nobody wrote a test case for shows up here first.
The A/B framework sends a small share of live traffic to a candidate version. It then compares the candidate's traced metrics with the baseline's. It uses the same Phoenix or LangFuse pipeline you already have Source 4সোর্স 4 Source 3সোর্স 3. It needs no separate tracing setup. It only needs a routing decision and a comparison query.
বাংলা ব্যাখ্যা
pipeline-এর দুটো অর্ধেক, pre-merge আর post-deploy, পাশাপাশি:
PRE-MERGE (CI, blocks the PR)
Promptfoo eval -> exit code 100 fails the check
agent decision tests (pytest) -> non-zero exit fails the check
POST-DEPLOY (continuous, does not block anything by itself)
every call traced via Langfuse
a sample continuously scored by Arize Phoenix
cost summed per session, alerted on a spike
A/B split: a fraction of traffic on a candidate model or prompt versionpost-deploy অর্ধেক pre-merge gate-কে প্রতিস্থাপন করে না; এটা ধরে যা gate পারে না, কারণ এটা শুধু স্থির eval সেট দেখে, real traffic নয়। একটা quality পতন যা শুধু এমন একটা প্রশ্নে দেখা যায় যার জন্য কেউ test case লেখেনি তা এখানে প্রথম দেখা যায়।
A/B framework কাজ করে live traffic-এর একটা ছোট শতাংশ একটা candidate version-এ route করে আর তার traced metric-কে baseline-এর সাথে তুলনা করে, আগে থেকে থাকা একই Phoenix বা LangFuse pipeline-এর ওপর Source 4সোর্স 4 Source 3সোর্স 3 — এটার আলাদা tracing setup দরকার নেই, শুধু একটা routing সিদ্ধান্ত আর একটা তুলনা query।
In practice
The CI workflow, which you mark as a required check on every PR Source 6সোর্স 6 Source 1সোর্স 1 Source 2সোর্স 2:
# .github/workflows/advanced-capstone.yml
on: pull_request
jobs:
gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: npx promptfoo eval -c promptfooconfig.yaml # exit code 100 fails the job
- run: python -m pytest tests/agent_routing/ # non-zero exit fails the jobProduction tracing and continuous eval on the deployed app Source 3সোর্স 3 Source 5সোর্স 5:
from langfuse import observe
from phoenix.otel import register
register(project_name="advanced-capstone", auto_instrument=True)
@observe()
def handle_request(question: str) -> dict:
return agent.invoke({"question": question})Cost monitoring with an alert on a spike:
def check_cost_anomaly(today_cost: float, trailing_7_day_avg: float) -> None:
if today_cost > trailing_7_day_avg * 2:
alert(f"cost spike: {today_cost:.2f} vs 7-day avg {trailing_7_day_avg:.2f}")A minimal A/B split, comparing a candidate prompt against the baseline:
import random
def handle_request_ab(question: str) -> dict:
variant = "candidate" if random.random() < 0.05 else "baseline"
result = agent_variants[variant].invoke({"question": question})
return {**result, "variant": variant} # tagged for later comparison in Phoenix/LangFuseTutorial advice
This advice is the tutorial's own. It does not come from the sources.
- Keep the CI gate and the production monitoring as separate systems with separate alerts; conflating them makes it unclear which one caught a given problem.
- Start the A/B split small (5-10% of traffic) and only widen it once the candidate's traced metrics hold up.
- Build the executive dashboard from the same stored metrics as the quality module, so there is one source of truth, not two.
সহজ English
This CI workflow is one you mark as a required check on every PR Source 6সোর্স 6 Source 1সোর্স 1 Source 2সোর্স 2.
# .github/workflows/advanced-capstone.yml
on: pull_request
jobs:
gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: npx promptfoo eval -c promptfooconfig.yaml # exit code 100 fails the job
- run: python -m pytest tests/agent_routing/ # non-zero exit fails the jobNext is tracing and continuous eval on the deployed app Source 3সোর্স 3 Source 5সোর্স 5.
from langfuse import observe
from phoenix.otel import register
register(project_name="advanced-capstone", auto_instrument=True)
@observe()
def handle_request(question: str) -> dict:
return agent.invoke({"question": question})This cost check raises an alert when spending spikes.
def check_cost_anomaly(today_cost: float, trailing_7_day_avg: float) -> None:
if today_cost > trailing_7_day_avg * 2:
alert(f"cost spike: {today_cost:.2f} vs 7-day avg {trailing_7_day_avg:.2f}")This is a minimal A/B split. It compares a candidate prompt against the baseline.
import random
def handle_request_ab(question: str) -> dict:
variant = "candidate" if random.random() < 0.05 else "baseline"
result = agent_variants[variant].invoke({"question": question})
return {**result, "variant": variant} # tagged for later comparison in Phoenix/LangFuseTutorial advice. This advice is the tutorial's own. It does not come from the sources.
- Keep the CI gate and the production monitoring as separate systems with separate alerts. Mixing them makes it unclear which one caught a problem.
- Start the A/B split small, at 5-10% of traffic. Widen it only when the candidate's traced metrics hold up.
- Build the executive dashboard from the same stored metrics as the quality module. Then you have one source of truth, not two.
বাংলা ব্যাখ্যা
এই CI workflow-কে আপনি প্রতিটা PR-এ required check হিসেবে চিহ্নিত করবেন Source 6সোর্স 6 Source 1সোর্স 1 Source 2সোর্স 2:
# .github/workflows/advanced-capstone.yml
on: pull_request
jobs:
gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: npx promptfoo eval -c promptfooconfig.yaml # exit code 100 fails the job
- run: python -m pytest tests/agent_routing/ # non-zero exit fails the jobDeployed app-এ production tracing আর continuous eval Source 3সোর্স 3 Source 5সোর্স 5:
from langfuse import observe
from phoenix.otel import register
register(project_name="advanced-capstone", auto_instrument=True)
@observe()
def handle_request(question: str) -> dict:
return agent.invoke({"question": question})একটা spike-এ alert সহ Cost monitoring:
def check_cost_anomaly(today_cost: float, trailing_7_day_avg: float) -> None:
if today_cost > trailing_7_day_avg * 2:
alert(f"cost spike: {today_cost:.2f} vs 7-day avg {trailing_7_day_avg:.2f}")Baseline-এর বিরুদ্ধে একটা candidate prompt তুলনা করে একটা ন্যূনতম A/B split:
import random
def handle_request_ab(question: str) -> dict:
variant = "candidate" if random.random() < 0.05 else "baseline"
result = agent_variants[variant].invoke({"question": question})
return {**result, "variant": variant} # tagged for later comparison in Phoenix/LangFuseTutorial advice
এই পরামর্শ টিউটোরিয়ালের নিজস্ব। এটি সোর্স থেকে আসেনি।
- CI gate আর production monitoring-কে আলাদা alert সহ আলাদা সিস্টেম হিসেবে রাখুন; মিশিয়ে ফেলা অস্পষ্ট করে কোনটা একটা নির্দিষ্ট সমস্যা ধরেছে।
- A/B split ছোট শুরু করুন (৫-১০% traffic) আর শুধু candidate-এর traced metric টিকে থাকলেই এটা বড় করুন।
- quality module-এর একই সংরক্ষিত metric থেকে executive dashboard বানান, যাতে একটাই সত্যের উৎস থাকে, দুটো নয়।
Common mistakes
Mistake 1: treating the CI gate as sufficient on its own. It only sees the fixed eval set; production tracing is what catches a problem the eval set never anticipated Source 3সোর্স 3 Source 4সোর্স 4.
Mistake 2: starting an A/B split at 50%. A bad candidate at 50% traffic does twenty-five times the damage of one at 2%; start small.
Mistake 3: separate dashboards for cost, quality, and A/B results. A reviewer checking three places misses the one that mattered this week.
Mistake 4: alerting on a cost spike with no trailing baseline. A fixed dollar threshold does not account for normal traffic growth; compare against a trailing average instead.
Mistake 5: no link from a production alert back to a trace. An alert that only says "quality dropped" with no trace id attached cannot be diagnosed Source 4সোর্স 4 Source 3সোর্স 3.
সহজ English
Mistake 1: trusting the CI gate alone. It only sees the fixed eval set. Production tracing catches a problem the eval set never expected Source 3সোর্স 3 Source 4সোর্স 4.
Mistake 2: starting an A/B split at 50%. A bad candidate at 50% of traffic does twenty-five times the damage of one at 2%. Start small.
Mistake 3: separate dashboards for cost, quality, and A/B results. A reviewer who checks three places can miss the one that mattered this week.
Mistake 4: a cost alert with no trailing baseline. A fixed dollar threshold ignores normal traffic growth. Compare against a trailing average instead.
Mistake 5: no link from a production alert to a trace. An alert that only says "quality dropped" has no trace id attached. Nobody can diagnose it Source 4সোর্স 4 Source 3সোর্স 3.
বাংলা ব্যাখ্যা
ভুল ১: CI gate-কে নিজে নিজে যথেষ্ট ভাবা। এটা শুধু স্থির eval সেট দেখে; production tracing-ই এমন একটা সমস্যা ধরে যা eval সেট কখনো অনুমান করেনি Source 3সোর্স 3 Source 4সোর্স 4।
ভুল ২: ৫০%-এ একটা A/B split শুরু করা। ৫০% traffic-এ একটা খারাপ candidate ২%-এর চেয়ে পঁচিশ গুণ ক্ষতি করে; ছোট শুরু করুন।
ভুল ৩: cost, quality, আর A/B ফলাফলের জন্য আলাদা dashboard। তিন জায়গা চেক করা একজন reviewer এই সপ্তাহে যা গুরুত্বপূর্ণ ছিল সেটা মিস করে।
ভুল ৪: trailing baseline ছাড়া একটা cost spike-এ alert করা। একটা স্থির ডলার threshold স্বাভাবিক traffic বৃদ্ধি হিসাব করে না; এর বদলে একটা trailing average-এর সাথে তুলনা করুন।
ভুল ৫: একটা production alert থেকে একটা trace-এ ফিরে কোনো লিংক নেই। শুধু "quality কমেছে" বলা একটা alert যাতে কোনো trace id নেই তা diagnose করা যায় না Source 4সোর্স 4 Source 3সোর্স 3।
What a tester can check
Tutorial advice
This advice is the tutorial's own. It does not come from the sources.
- Confirm the CI gate and production monitoring run and alert independently, with clearly separate dashboards.
- Confirm any A/B split starts under 10% of traffic, with a documented rule for widening it.
- Confirm every alert links to the specific trace that triggered it.
- Confirm the cost alert compares against a trailing average, not a fixed number.
সহজ English
Tutorial advice
This advice is the tutorial's own. It does not come from the sources.
- Confirm the CI gate and production monitoring run and alert independently, with clearly separate dashboards.
- Confirm any A/B split starts under 10% of traffic, with a documented rule for widening it.
- Confirm every alert links to the specific trace that triggered it.
- Confirm the cost alert compares against a trailing average, not a fixed number.
বাংলা ব্যাখ্যা
Tutorial advice
এই পরামর্শ টিউটোরিয়ালের নিজস্ব। এটি সোর্স থেকে আসেনি।
- CI gate আর production monitoring আলাদাভাবে চলে আর alert করে, স্পষ্টভাবে আলাদা dashboard সহ, তা নিশ্চিত করুন।
- যেকোনো A/B split ১০%-এর কম traffic-এ শুরু হয়, এটা বড় করার একটা documented নিয়ম সহ, তা নিশ্চিত করুন।
- প্রতিটা alert যে নির্দিষ্ট trace trigger করেছে তার সাথে লিংক করা তা নিশ্চিত করুন।
- cost alert একটা স্থির সংখ্যার বদলে একটা trailing average-এর সাথে তুলনা করে তা নিশ্চিত করুন।
Key words
| Word | What it means |
|---|---|
| Pre-merge gate | The CI check that blocks a pull request on a failed eval |
| Post-deploy monitoring | Continuous tracing and evaluation of live traffic after release |
| A/B split | Routing a fraction of live traffic to a candidate version for comparison |
| Cost anomaly | A spend spike detected by comparing today's cost to a trailing average |
| Trace link | A reference from an alert back to the specific call that triggered it |