Skip to article content
FrontendXLearning path

AI Engineering

Build LLM-backed product features end to end against a deterministic local mock: form well-formed chat requests, structure prompts and validated JSON outputs, stream and retry safely, ground answers in retrieved sources, call tools inside bounded agent loops, defend against prompt injection, and evaluate quality with reproducible checks instead of one-off demos. No API keys and no network calls are used anywhere in the course.

beginner · 20 lessons · 90 exercises · about 930 minutes

  • Predict
  • Explain
  • Implement
  • Debug
  • Test
  • Interview

What you will be able to do

#
  • Construct and read chat-completion style requests and responses, and explain the role of every field using a local mock client.
  • Control output variability deliberately with sampling parameters and describe when determinism is required.
  • Budget context windows and estimate token usage and cost with clearly labeled approximations.
  • Produce schema-validated structured output with parse, validate and retry handling instead of trusting raw text.
  • Assemble streamed deltas into full responses and cancel generation with abort signals.
  • Classify model API failures and apply bounded retries, timeouts and graceful degradation.
  • Implement cosine similarity retrieval over mock embedding vectors and rank documents by hand.
  • Build a retrieval-grounded answer pipeline that cites sources and abstains when the answer is not in them.
  • Define tool schemas, validate model-requested arguments against allowlists, and run the tool loop safely.
  • Wrap model-plus-tools loops in explicit budgets, approval gates and audit trails that separate agents from demos.
  • Recognize prompt injection through retrieved data and tool results, and apply data-boundary defenses with honest residual risk.
  • Author small evaluation sets with deterministic graders and explain why a passing demo is not an evaluation.
  • Express and gate uncertainty with abstention thresholds and self-consistency checks on scripted outputs.
  • Audit an AI feature for secret exposure, data-boundary and abuse risks, and state residual risk honestly.
  • Define an SLO with an error budget and degrade through a fallback ladder instead of failing.
  • Integrate caching, retrieval, structured output, tool policy and fallbacks into one reviewed, observable pipeline.

Prerequisites

#

Lessons

#
  1. Anatomy of a model API call

    beginner · 35 minutes · 4 exercises

    Construct a well-formed chat-style request object and explain the purpose of every top-level field.

  2. Prompt structure: roles, data boundaries and few-shots

    beginner · 40 minutes · 4 exercises

    Assemble a messages array that separates system instructions, few-shot examples and user data into distinct roles.

  3. Sampling parameters and determinism

    beginner · 35 minutes · 4 exercises

    Trace cumulative sampling over a fixed candidate table and predict the selected token for any given random value.

  4. Tokens, context windows and cost

    beginner · 40 minutes · 4 exercises

    Estimate token counts with a clearly labeled characters-per-token approximation and state when it is unsafe to trust.

  5. Structured output: extract, validate, repair

    intermediate · 45 minutes · 5 exercises

    Extract a JSON object from a reply that contains prose or markdown fences without throwing on malformed input.

  6. Streaming responses and cancellation

    intermediate · 40 minutes · 5 exercises

    Assemble streamed deltas into the complete reply and explain why chunks are fragments rather than standalone values.

  7. Errors, retries, timeouts and graceful degradation

    intermediate · 45 minutes · 5 exercises

    Classify model API failures into retryable and non-retryable classes with a stated first response for each.

  8. Embeddings and cosine similarity

    intermediate · 45 minutes · 4 exercises

    Compute cosine similarity between small vectors by hand and in code, with deterministic rounding.

  9. Retrieval-grounded answers with citations and abstention

    intermediate · 50 minutes · 5 exercises

    Implement top-k retrieval over mock embedding vectors and predict the retrieved chunk ids and scores.

  10. Tool calling: schemas, validation and the execution loop

    intermediate · 50 minutes · 5 exercises

    Execute model-requested tool calls through an allowlist registry with argument validation and structured errors.

  11. Bounded agent workflows: budgets, approvals, audit

    advanced · 55 minutes · 5 exercises

    Implement an agent loop with an explicit step budget that returns structured outcomes for done and budget-exhausted runs.

  12. Prompt injection and data boundaries

    advanced · 55 minutes · 5 exercises

    Classify injection attempts as instruction override, data exfiltration or tool abuse, and identify the carrier channel.

  13. Evaluation against demos: graders, sets and regressions

    advanced · 55 minutes · 5 exercises

    Implement an eval runner that applies deterministic graders over a case set and reports counts, not just a rate.

  14. Uncertainty, abstention and calibration

    advanced · 45 minutes · 5 exercises

    Implement majority-vote self-consistency over scripted samples with a deterministic tie rule and an agreement signal.

  15. Caching and latency budgets

    advanced · 45 minutes · 5 exercises

    Implement a deterministic response cache with explicit keys and TTL expiry, and predict hit, expired and miss lookups.

  16. Observability: structured logs and request metrics

    advanced · 45 minutes · 4 exercises

    Build a structured, redacted log entry per model request with identity, parameters, outcome class and token usage.

  17. Model routing and cost tiers

    advanced · 45 minutes · 4 exercises

    Implement a tier-based routing table that maps task classes to mock models with a stated reason, and a safe default for unknown classes.

  18. Security review: keys, data boundaries and abuse cases

    advanced · 50 minutes · 4 exercises

    Audit an AI feature for secret exposure, data-boundary and abuse risks using a fixed review checklist.

  19. Reliability: SLOs, budgets and fallbacks

    advanced · 50 minutes · 4 exercises

    Define an SLO for an AI feature in terms of measurable indicators and compute its error budget in minutes.

  20. Capstone: ship a reviewed, observable AI feature

    advanced · 60 minutes · 4 exercises

    Integrate request building, caching, retrieval, structured output, tool policy and fallbacks into one deterministic mock pipeline.

Study journeys

#

Skip-ahead journeys never remove a requirement. The prerequisite graph always reports the full chain; a skip-ahead course only marks where an assessment may substitute for study.

© 2026 FrontendX. All rights reserved.