Skip to lesson
Exit
Capstone: Mock Loop1 / 3

1 min lesson

Earn the AI step

Match each case in "Earn the AI step" to the signal and response that fit it.

Step 1 of 3

Earn the AI step

Cursor builds an AI tool and expects you to apply AI to real workflows, but a gratuitous LLM call is worse than none. Add exactly one AI step that genuinely beats a deterministic rule and put a guardrail on it.

AI that earns its place

Classify a free-text company description into an ICP segment a regex can't.

Draft a one-line, fact-grounded personalization from enriched fields.

AI that's just decoration

An LLM doing arithmetic the score already computes.

A model 'deciding' routing a threshold handles deterministically and cheaper.

Learn more

Full explanation

The AI column with its guardrail

the AI column with its guardrail - classify segment, constrained + verified
# Constrain the output space, ground it in real fields and verify before trusting it.
prompt = f"""Classify this company into exactly one segment.
Allowed values: ["startup", "midmarket", "enterprise", "unknown"].
Return only the value, no prose.

Company: {row.company}
Employee count: {row.employee_count}
Description: {row.description}
"""

label = llm(prompt).strip().lower()

# Guardrail: reject anything off-menu; never let a hallucinated label route a lead.
if label not in {"startup", "midmarket", "enterprise", "unknown"}:
    label = "unknown"        # fail closed, send to human review

# Cross-check against a hard signal so the LLM can't override ground truth.
if row.employee_count and row.employee_count > 2000 and label == "startup":
    label = "needs_review"   # contradiction → flag, don't silently trust
A guardrail is what makes the AI step credible

The guardrail is the part the team is actually grading: constrain the output to an allowed set, fail closed to human review on anything off-menu and cross-check the model against a hard signal it shouldn't be able to override. "I used an LLM" is table stakes; "I used an LLM and here's how I keep it from routing a lead on a hallucination" is the senior answer.