Advanced AI Projects

Updated · 6 min read
hardPython 3.13aiprojectsagentsevaluation-pipelineproductionportfolio

Advanced AI projects are systems built the way real teams build them: with several tools, access control, automated evaluation, monitoring, security tests and a written responsible AI review. They draw on the whole course, especially the production, security and responsibility chapters. Each project has a "done when" check: a concrete result you can show, not just "it works".

The Projects

ProjectDone when
Multi-step AI agentIt has at least two tools, a step limit, and confirmation before any action that changes something; see "Securing Agents and Tools"
Enterprise knowledge assistantAccess control works per user, sources are shown, and prompt injection tests pass
AI application with multiple toolsEvery tool call is logged and tested, including failure cases
AI evaluation pipelineIt runs automatically on every change and blocks a release when the score drops
Production-ready AI applicationIt is deployed with monitoring, cost tracking, guardrails and a written responsible AI review

Example: An Evaluation Pipeline That Blocks a Release

The evaluation pipeline project needs a release gate: a script that a CI system (such as GitHub Actions) runs on every change, which fails if quality drops. A failing script stops the merge or deployment. This program runs the gate on Campus Helper for the current version and two proposed changes.

A script in the pipeline that says no to a worse version
Python
import json
 
from sentence_transformers import SentenceTransformer
 
DECLINE = "Sorry, I can only answer questions about this school. Please contact the school office."
MINIMUM = 42                                          # the release gate: at least 42 of 50
 
texts = [item["text"] for item in json.load(open("faq.json"))]
cases = json.load(open("eval_set.json"))
model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
vectors = model.encode(texts, normalize_embeddings=True)
questions = model.encode([c["question"] for c in cases], normalize_embeddings=True)
 
def evaluate(threshold):
    passed = 0
    for case, q in zip(cases, questions):
        scores = vectors @ q
        best = int(scores.argmax())
        answer = texts[best] if scores[best] >= threshold else DECLINE
        expected = case["must_contain"]
        passed += answer == DECLINE if expected is None else expected in answer
    return passed
 
def gate(name, threshold):
    """What a CI job runs on every change: exit code 0 lets the release continue, 1 blocks it."""
    score = evaluate(threshold)
    code = 0 if score >= MINIMUM else 1
    print(f"{name:34} score {score}/50 -> exit code {code} ({'release continues' if code == 0 else 'RELEASE BLOCKED'})")
    return code
 
gate("main branch (threshold 0.35)", 0.35)
gate("pull request: threshold 0.55", 0.55)
gate("pull request: threshold 0.30", 0.30)
# In a real pipeline the last line of the script is:  sys.exit(gate("candidate", candidate_threshold))
Output
main branch (threshold 0.35)       score 44/50 -> exit code 0 (release continues)
pull request: threshold 0.55       score 40/50 -> exit code 1 (RELEASE BLOCKED)
pull request: threshold 0.30       score 45/50 -> exit code 0 (release continues)

Explanation:

  • The gate runs the 50-case evaluation from "Building an Evaluation Set" and returns exit code 0 (success) if the score is at least 42, or 1 (failure) otherwise. CI systems treat any non-zero exit code as a failed check.
  • The main branch scores 44/50: the release continues.
  • The 0.55 change scores 40/50 and is blocked, the same mistake the monitoring lesson caught after release. Here it never reaches users.
  • The 0.30 change scores 45/50, one better than the current version. The gate lets it through, and the evaluation gives evidence that it's an improvement worth reviewing.
  • The program prints the exit codes so you can see them. In a real pipeline, the script ends with sys.exit(gate(...)).

What Makes an Advanced Project Production-Ready

AreaEvidence to show
QualityEvaluation set, score history, gate in CI
SecurityAttack set passing, least-privilege tools; see "Prompt Injection and Jailbreaks"
OperationsLogs, cost and latency dashboard, alerts; see "Monitoring Quality, Cost and Latency"
Data and privacyAccess control, redaction, retention rules
ResponsibilityA one-page review; see "Responsible AI Principles"
DocumentationArchitecture diagram, runbook for incidents, README

Common Mistakes

Building features instead of finishing one system. A smaller system with evaluation, monitoring and security beats a big demo.

A gate that never fails. Test it with a deliberately worse version, as above.

No failure cases. Test what happens when tools time out, return errors or get bad input.

Skipping documentation. Others must be able to run, understand and operate it.

Interview Corner

How do you stop a bad change from reaching production in an AI app?

Run the evaluation set automatically on every change and fail the pipeline if the score drops below a threshold, plus staged rollouts and monitoring with alerts after release. Keep the previous version ready to roll back.

What did you do to make your agent safe?

Least-privilege tools with argument checks, a step limit, confirmation before actions that change things, logging of every tool call, and an attack test set, tested in a sandbox before any real use.

Practice

Exercise: a stricter gate. Change the gate so a pull request must score at least as high as the main branch, not just 42. Which of the two proposed changes passes now?

Check your understanding:

  1. What does exit code 1 do in a CI pipeline?
  2. Why did the 0.55 change get blocked?
  3. Why test the gate with a deliberately worse version?

Quick check: advanced projects

4 questions
1What did the gate do with the 0.55 threshold change?
2What exit code lets a CI check pass?
3What score did the 0.30 change get?
4What must an agent do before an action that changes something?

Key Takeaways

Quick reference

NeedPractice
Release gateEvaluation script; sys.exit(0 or 1); run in CI
Agent safetyLeast privilege, step limit, confirmation, logs
OperationsDashboard, alerts, runbook, rollback
TrustAttack set, access control, responsible AI review

Was this tutorial helpful?

Lesson 181 of 186