AI Fundamentals · Lesson 1 · 9 min read
My learning
Resume a lesson or return to a lesson you saved.
Reading progress and bookmarks stay in this browser. No account is required; they do not sync between devices.
Continue learning
Start your first lesson
A lesson appears here after you move beyond its first section or mark it complete. In-progress lessons appear before completed lessons, in course order.
AI Fundamentals · Lesson 2 · 9 min read
Count tokens with the model's tokenizer
AI Fundamentals · Lesson 3 · 9 min read
Trace next-token generation
AI Fundamentals · Lesson 4 · 10 min read
Send chat messages within the context window
AI Fundamentals · Lesson 5 · 10 min read
Control sampling, output limits and streaming
AI Fundamentals · Lesson 6 · 10 min read
Call a local model and a hosted API
AI Fundamentals · Lesson 7 · 10 min read
Get structured output and validate it with Pydantic
AI Fundamentals · Lesson 8 · 10 min read
Rank documents with embeddings
AI Fundamentals · Lesson 9 · 11 min read
Validate a model-proposed tool call
AI Fundamentals · Lesson 10 · 11 min read
Defend a tool-using assistant against prompt injection
AI Fundamentals · Lesson 11 · 11 min read
Write your first eval for an LLM app
Model Context Protocol (MCP) · Lesson 1 · 15 min read
Implement an MCP server with typed tool contracts
Model Context Protocol (MCP) · Lesson 2 · 20 min read
Serve MCP over stdio and Streamable HTTP, and test the contracts
Model Context Protocol (MCP) · Lesson 3 · 22 min read
Build an MCP client with discovery, calls and tracing
Model Context Protocol (MCP) · Lesson 4 · 20 min read
Expose resources and prompts from an MCP server
Model Context Protocol (MCP) · Lesson 5 · 20 min read
Integrate MCP tools into ADK and LangGraph agents
Model Context Protocol (MCP) · Lesson 6 · 24 min read
Secure a remote MCP server with OAuth 2.1 and scoped tokens
Model Context Protocol (MCP) · Lesson 7 · 26 min read
Build a read-only database MCP server with scoped roles
Building Agents with Google ADK 2.0 · Lesson 1 · 15 min read
Build your first ADK agent with Gemini
Building Agents with Google ADK 2.0 · Lesson 2 · 20 min read
Run an agent and read its event stream
Building Agents with Google ADK 2.0 · Lesson 3 · 25 min read
Give an agent typed function tools
Building Agents with Google ADK 2.0 · Lesson 4 · 20 min read
Connect an agent to MCP servers with McpToolset
Building Agents with Google ADK 2.0 · Lesson 5 · 25 min read
Persist sessions and search conversation memory
Building Agents with Google ADK 2.0 · Lesson 6 · 25 min read
Guard model and tool calls with callbacks and plugins
Building Agents with Google ADK 2.0 · Lesson 7 · 20 min read
Build a graph workflow from nodes and edges
Building Agents with Google ADK 2.0 · Lesson 8 · 20 min read
Route a workflow with conditional edges
Building Agents with Google ADK 2.0 · Lesson 9 · 25 min read
Pause a workflow for human approval
Building Agents with Google ADK 2.0 · Lesson 10 · 25 min read
Build dynamic workflows in Python
Building Agents with Google ADK 2.0 · Lesson 11 · 20 min read
Delegate to sub-agents through a coordinator
Building Agents with Google ADK 2.0 · Lesson 12 · 25 min read
Evaluate an agent's tool trajectory and response
Building Agents with Google ADK 2.0 · Lesson 13 · 15 min read
Choose an ADK workflow pattern
Building Agents with Google ADK 2.0 · Lesson 14 · 20 min read
Generate and review a release announcement
Building Agents with Google ADK 2.0 · Lesson 15 · 20 min read
Revise a changelog line with a bounded loop
Building Agents with Google ADK 2.0 · Lesson 16 · 25 min read
Run independent workflow branches and gather results
Building Agents with Google ADK 2.0 · Lesson 17 · 25 min read
Delegate an upgrade guide through a bounded agent tree
Connecting Agents to Tools and Services with Google ADK 2.0 · Lesson 1 · 20 min read
Give an agent skills from a folder with SkillToolset
Connecting Agents to Tools and Services with Google ADK 2.0 · Lesson 2 · 20 min read
Use Gemini built-in tools: Google Search grounding and code execution
Connecting Agents to Tools and Services with Google ADK 2.0 · Lesson 3 · 25 min read
Query PostgreSQL through MCP Toolbox for Databases
Connecting Agents to Tools and Services with Google ADK 2.0 · Lesson 4 · 25 min read
Query BigQuery with BigQueryToolset
Connecting Agents to Tools and Services with Google ADK 2.0 · Lesson 5 · 25 min read
Search private data stores with Agent Search
Connecting Agents to Tools and Services with Google ADK 2.0 · Lesson 6 · 25 min read
Expose the docs assistant over A2A and consume it
Running and Deploying Agents with Google ADK 2.0 · Lesson 1 · 20 min read
Serve an agent over HTTP and drive it from the CLI
Running and Deploying Agents with Google ADK 2.0 · Lesson 2 · 20 min read
Configure an ADK agent with YAML
Running and Deploying Agents with Google ADK 2.0 · Lesson 3 · 20 min read
Tune a run with RunConfig and read the event loop
Running and Deploying Agents with Google ADK 2.0 · Lesson 4 · 20 min read
Resume an interrupted agent run
Running and Deploying Agents with Google ADK 2.0 · Lesson 5 · 25 min read
Rewind a session and migrate its database
Running and Deploying Agents with Google ADK 2.0 · Lesson 6 · 20 min read
Run an agent from event triggers
Running and Deploying Agents with Google ADK 2.0 · Lesson 7 · 25 min read
Reduce repeated context with caching and compaction
Running and Deploying Agents with Google ADK 2.0 · Lesson 8 · 20 min read
Save and load files with Artifacts
Running and Deploying Agents with Google ADK 2.0 · Lesson 9 · 25 min read
Call a REST API from an OpenAPI spec, with authentication
Running and Deploying Agents with Google ADK 2.0 · Lesson 10 · 20 min read
Make tools parallel-ready
Running and Deploying Agents with Google ADK 2.0 · Lesson 11 · 25 min read
Expose the docs assistant as an MCP server
Running and Deploying Agents with Google ADK 2.0 · Lesson 12 · 25 min read
Trace and measure agent runs with OpenTelemetry
Running and Deploying Agents with Google ADK 2.0 · Lesson 13 · 25 min read
Test an agent against simulated users
Running and Deploying Agents with Google ADK 2.0 · Lesson 14 · 25 min read
Inject tool failures with environment simulation
Running and Deploying Agents with Google ADK 2.0 · Lesson 15 · 30 min read
Write a custom eval metric and optimize the instruction
Running and Deploying Agents with Google ADK 2.0 · Lesson 16 · 25 min read
Apply safety and security guardrails to agent tools
Running and Deploying Agents with Google ADK 2.0 · Lesson 17 · 20 min read
Use Agent Platform models, sessions and Memory Bank
Running and Deploying Agents with Google ADK 2.0 · Lesson 18 · 20 min read
Scaffold and deploy an agent with the Agents CLI
Running and Deploying Agents with Google ADK 2.0 · Lesson 19 · 20 min read
Deploy an ADK agent to Agent Runtime
Running and Deploying Agents with Google ADK 2.0 · Lesson 20 · 20 min read
Deploy an ADK agent to Cloud Run
Building Live and Voice Agents with Google ADK 2.0 · Lesson 1 · 25 min read
Stream a voice conversation with run_live
Building Live and Voice Agents with Google ADK 2.0 · Lesson 2 · 30 min read
Read live events and manage live sessions
Building Live and Voice Agents with Google ADK 2.0 · Lesson 3 · 25 min read
Send audio, images and video, and configure voice
Building Live and Voice Agents with Google ADK 2.0 · Lesson 4 · 30 min read
Call tools during a live conversation
Building Live and Voice Agents with Google ADK 2.0 · Lesson 5 · 25 min read
Run live agents inside a workflow
Building Live and Voice Agents with Google ADK 2.0 · Lesson 6 · 25 min read
Guard and evaluate a voice agent
Building Live and Voice Agents with Google ADK 2.0 · Lesson 7 · 25 min read
Build a custom WebSocket server for a live agent
Building Agents with LangGraph · Lesson 1 · 25 min read
Build a graph agent with tools
Building Agents with LangGraph · Lesson 2 · 20 min read
Add branches and stop conditions to a LangGraph agent
Building Agents with LangGraph · Lesson 3 · 25 min read
Trim conversation history to a token budget in LangGraph
Building Agents with LangGraph · Lesson 4 · 22 min read
Add timeouts and token budgets to a LangGraph agent
Building Agents with LangGraph · Lesson 5 · 22 min read
Checkpoint a LangGraph workflow and resume it after a crash
Building Agents with LangGraph · Lesson 6 · 22 min read
Make LangGraph retries idempotent
Building Agents with LangGraph · Lesson 7 · 25 min read
Plan, execute and verify a multi-step task in LangGraph
Building Agents with LangGraph · Lesson 8 · 30 min read
Add human-in-the-loop interrupts
Building Agents with LangGraph · Lesson 9 · 30 min read
Add a long-term memory store
Retrieval-Augmented Generation (RAG) · Lesson 1 · 22 min read
Build an embedding pipeline with LangChain
Retrieval-Augmented Generation (RAG) · Lesson 2 · 24 min read
Build a PostgreSQL vector store with LangChain
Retrieval-Augmented Generation (RAG) · Lesson 3 · 26 min read
Compare exact, HNSW and IVFFlat search in pgvector
Retrieval-Augmented Generation (RAG) · Lesson 4 · 28 min read
Build a RAG pipeline with citations
Retrieval-Augmented Generation (RAG) · Lesson 5 · 26 min read
Build multimodal RAG with chart source references
Retrieval-Augmented Generation (RAG) · Lesson 6 · 16 min read
Rank document vectors with cosine distance
Building Agentic RAG Applications · Lesson 1 · 6 min read
How RAG works
Building Agentic RAG Applications · Lesson 2 · 25 min read
Trace a RAG request from search to answer
Building Agentic RAG Applications · Lesson 3 · 25 min read
Build a RAG eval dataset
Building Agentic RAG Applications · Lesson 4 · 28 min read
Record a RAG baseline
Building Agentic RAG Applications · Lesson 5 · 20 min read
Load developer documentation
Building Agentic RAG Applications · Lesson 6 · 20 min read
Track passage sources
Building Agentic RAG Applications · Lesson 7 · 20 min read
Handle ingestion failures
Building Agentic RAG Applications · Lesson 8 · 25 min read
Version documents and chunks
Building Agentic RAG Applications · Lesson 9 · 25 min read
Resume document ingestion
Building Agentic RAG Applications · Lesson 10 · 25 min read
Update and delete indexed content
Building Agentic RAG Applications · Lesson 11 · 25 min read
How BM25 ranks documents
Building Agentic RAG Applications · Lesson 12 · 25 min read
Add vector retrieval
Building Agentic RAG Applications · Lesson 13 · 25 min read
Apply filters across retrievers
Building Agentic RAG Applications · Lesson 14 · 25 min read
Build hybrid retrieval
Building Agentic RAG Applications · Lesson 15 · 25 min read
Rerank retrieved passages
Building Agentic RAG Applications · Lesson 16 · 25 min read
Compare retrieval configurations
Building Agentic RAG Applications · Lesson 17 · 25 min read
Choose chunk boundaries
Building Agentic RAG Applications · Lesson 18 · 25 min read
Retrieve surrounding context
Building Agentic RAG Applications · Lesson 19 · 25 min read
Assemble context within a token budget
Building Agentic RAG Applications · Lesson 20 · 25 min read
Stream RAG answers
Building Agentic RAG Applications · Lesson 21 · 25 min read
Handle conflicting documentation
Building Agentic RAG Applications · Lesson 22 · 25 min read
Add search and read tools
Building Agentic RAG Applications · Lesson 23 · 25 min read
Refine queries with a scripted policy
Building Agentic RAG Applications · Lesson 24 · 25 min read
Bound scripted retrieval runs
Building Agentic RAG Applications · Lesson 25 · 25 min read
Compare fixed, scripted and Gemini retrieval policies
Building Agentic RAG Applications · Lesson 26 · 35 min read
Build a model-driven RAG agent
Building Agentic RAG Applications · Lesson 27 · 25 min read
Serve the RAG application with FastAPI
Building Agentic RAG Applications · Lesson 28 · 25 min read
Build a retrieval inspector
Building Agentic RAG Applications · Lesson 29 · 25 min read
Connect retrieval tools through MCP
Building Agentic RAG Applications · Lesson 30 · 20 min read
Authorize collection searches
Building Agentic RAG Applications · Lesson 31 · 20 min read
Cache retrieval results
Building Agentic RAG Applications · Lesson 32 · 25 min read
Trace RAG requests
Building Agentic RAG Applications · Lesson 33 · 25 min read
Limit concurrent RAG requests
Building Agentic RAG Applications · Lesson 34 · 20 min read
Run RAG evals on an updated corpus
Building Agentic RAG Applications · Lesson 35 · 25 min read
Evaluate scripted retrieval tasks
Building Agentic RAG Applications · Lesson 36 · 25 min read
Release the RAG application
Building Agentic RAG Applications · Lesson 37 · 35 min read
Build the developer knowledge assistant
LLM Evals · Lesson 1 · 25 min read
Build an eval harness with pytest
LLM Evals · Lesson 2 · 25 min read
Measure RAG and tool-call quality
LLM Evals · Lesson 3 · 20 min read
Write robustness tests for an LLM app
LLM Evals · Lesson 4 · 22 min read
Gate releases on eval regressions in CI
LLM Evals · Lesson 5 · 22 min read
Check evaluation datasets for leakage
LLM Evals · Lesson 6 · 20 min read
Bind an eval run to a release manifest
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 1 · 18 min read
Scaffold, lint, and run an ADK project with Google Agents CLI
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 2 · 20 min read
Enhance, upgrade, and extend an Agents CLI project
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 3 · 22 min read
Generate traces and grade evaluations with agents-cli eval
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 4 · 20 min read
Synthesize user simulations and compare evaluation runs
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 5 · 22 min read
Provision Terraform infrastructure and deploy with agents-cli
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 6 · 20 min read
Publish to Gemini and configure agent observability
Building AI Systems · Lesson 1 · 25 min read
Choose an architecture from task requirements
Building AI Systems · Lesson 2 · 25 min read
Create an evaluation set and a failure taxonomy
Building AI Systems · Lesson 3 · 25 min read
Set task acceptance criteria and request resource budgets
Building AI Systems · Lesson 4 · 30 min read
Define a task-specific answer rubric
Building AI Systems · Lesson 5 · 25 min read
Separate source support, action correctness and format validity
Building AI Systems · Lesson 6 · 25 min read
Measure quality by request slice and asymmetric failure cost
Building AI Systems · Lesson 7 · 22 min read
Build a resumable repeated-trial benchmark
Building AI Systems · Lesson 8 · 22 min read
Compare paired evaluation runs with uncertainty
Building AI Systems · Lesson 9 · 26 min read
Build a portable model adapter with contract tests
Building AI Systems · Lesson 10 · 22 min read
Build a model selection harness
Building AI Systems · Lesson 11 · 22 min read
Check user and tool permissions across service boundaries
Building AI Systems · Lesson 12 · 22 min read
Check tool proposals and untrusted agent handoffs
Building AI Systems · Lesson 13 · 20 min read
Build a guardrails proxy with streaming-output tests
Building AI Systems · Lesson 14 · 25 min read
Build end-to-end request tracing with source provenance
Building AI Systems · Lesson 15 · 22 min read
Build LLM monitoring for latency, cost and errors
Building AI Systems · Lesson 16 · 25 min read
Compare cached and uncached attention work
Building AI Systems · Lesson 17 · 25 min read
Compare full updates and low-rank adaptation
Building AI Systems · Lesson 18 · 30 min read
Compare packed weight quantization and output error
Building AI Systems · Lesson 19 · 30 min read
Admit decoding requests between token steps
Building AI Systems · Lesson 20 · 30 min read
Inspect a direct preference optimization update
Building AI Systems · Lesson 21 · 30 min read
Run group-relative policy updates on sampled completions
Building MLOps · Lesson 1 · 25 min read
Use only data available when the prediction is made
Building MLOps · Lesson 2 · 25 min read
Choose evaluation dates for the return model
Building MLOps · Lesson 3 · 25 min read
Train, save and reload the user-return model
Building MLOps · Lesson 4 · 25 min read
Choose a decision threshold using explicit error costs
Building MLOps · Lesson 5 · 25 min read
Validate incoming events before preparing training data
Building MLOps · Lesson 6 · 25 min read
Reconstruct the feature used by an earlier prediction
Building MLOps · Lesson 7 · 25 min read
Compare historical and current feature calculations
Building MLOps · Lesson 8 · 25 min read
Version the dataset and feature contract together
Building MLOps · Lesson 9 · 30 min read
Track a training run and reload its model
Building MLOps · Lesson 10 · 30 min read
Connect preparation, training and evaluation with Prefect
Building MLOps · Lesson 11 · 30 min read
Retry a failed step without repeating the experiment
Building MLOps · Lesson 12 · 30 min read
Test pipeline changes before producing a candidate
Building MLOps · Lesson 13 · 30 min read
Evaluate a candidate against a declared release policy
Building MLOps · Lesson 14 · 30 min read
Register and select an explicit model version
Building MLOps · Lesson 15 · 30 min read
Produce daily predictions and expose an optional HTTP interface
Building MLOps · Lesson 16 · 30 min read
Stage a candidate with an explicit traffic decision
Building MLOps · Lesson 17 · 30 min read
Roll back to a compatible model bundle
Building MLOps · Lesson 18 · 30 min read
Monitor prediction requests and input failures
Building MLOps · Lesson 19 · 30 min read
Evaluate predictions after return labels become final
Building MLOps · Lesson 20 · 30 min read
Investigate changed inputs before choosing a response
Building MLOps · Lesson 21 · 30 min read
Recover the input path and evaluate a new candidate
Build a Small Language Model From Scratch · Lesson 1 · 25 min read
Build one training step by hand
Build a Small Language Model From Scratch · Lesson 2 · 25 min read
Build a byte-pair encoding tokenizer
Build a Small Language Model From Scratch · Lesson 3 · 25 min read
Build a next-token prediction baseline
Build a Small Language Model From Scratch · Lesson 4 · 30 min read
Build causal self-attention and inspect intermediate outputs
Build a Small Language Model From Scratch · Lesson 5 · 30 min read
Build a transformer block with positional information
Build a Small Language Model From Scratch · Lesson 6 · 30 min read
Build a small language-model training pipeline
Build a Small Language Model From Scratch · Lesson 7 · 30 min read
Build checkpoints and resumable training
Build a Small Language Model From Scratch · Lesson 8 · 25 min read
Build text generation with sampling controls
Build a Small Language Model From Scratch · Lesson 9 · 25 min read
Build a KV cache for LLM generation
Build a Small Language Model From Scratch · Lesson 10 · 30 min read
Build a local server for the trained model
Build a Small Language Model From Scratch · Lesson 11 · 30 min read
Compare a handwritten transformer with PyTorch
Agent Design, Optimization and Harnesses · Lesson 1 · 25 min read
Compare a workflow with a bounded policy
Agent Design, Optimization and Harnesses · Lesson 2 · 25 min read
Run a search-and-read decision loop
Agent Design, Optimization and Harnesses · Lesson 3 · 25 min read
Delegate independent tasks with explicit worker state
Agent Design, Optimization and Harnesses · Lesson 4 · 25 min read
Curate traces before selecting an improvement
Agent Design, Optimization and Harnesses · Lesson 5 · 25 min read
Tune retrieval policy on separated task families
Agent Design, Optimization and Harnesses · Lesson 6 · 25 min read
Calibrate task graders before comparing policies
Agent Design, Optimization and Harnesses · Lesson 7 · 25 min read
Bound a local repair process
Agent Design, Optimization and Harnesses · Lesson 8 · 25 min read
Build a coding-agent loop
Agent Design, Optimization and Harnesses · Lesson 9 · 20 min read
Verify edits independently of completion claims
Context and Memory Engineering for AI Agents · Lesson 1 · 30 min read
Assemble a model request within a context budget
Context and Memory Engineering for AI Agents · Lesson 2 · 28 min read
Build context compaction with information-loss tests
Context and Memory Engineering for AI Agents · Lesson 3 · 26 min read
Build isolated contexts for users, tasks, and agents
Context and Memory Engineering for AI Agents · Lesson 4 · 27 min read
Build a context-selection benchmark
Context and Memory Engineering for AI Agents · Lesson 5 · 26 min read
Build a memory service with explicit user and task scope
Context and Memory Engineering for AI Agents · Lesson 6 · 30 min read
Build memory provenance and deletion
Context and Memory Engineering for AI Agents · Lesson 7 · 28 min read
Build working, semantic, and episodic memory retrieval
Context and Memory Engineering for AI Agents · Lesson 8 · 28 min read
Build memory consolidation with conflict tests
Context and Memory Engineering for AI Agents · Lesson 9 · 30 min read
Compare memory compaction with fact-retention checks
Context and Memory Engineering for AI Agents · Lesson 10 · 26 min read
Build a memory usefulness eval
LLM Inference Engineering · Lesson 1 · 25 min read
Trace a real inference request from prompt to first token
LLM Inference Engineering · Lesson 2 · 25 min read
Stream model output and stop work when the client disconnects
LLM Inference Engineering · Lesson 3 · 25 min read
Benchmark streaming inference under load
LLM Inference Engineering · Lesson 4 · 25 min read
Budget model weights, KV cache, and runtime memory
LLM Inference Engineering · Lesson 5 · 25 min read
Choose hardware from the workload bottleneck
LLM Inference Engineering · Lesson 6 · 25 min read
Implement paged cache allocation and copy-on-write
LLM Inference Engineering · Lesson 7 · 25 min read
Explain tiled attention and verify its output
LLM Inference Engineering · Lesson 8 · 25 min read
Schedule requests between decode iterations
LLM Inference Engineering · Lesson 9 · 25 min read
Balance long-prompt prefill against streaming latency
LLM Inference Engineering · Lesson 10 · 25 min read
Reuse prompt prefixes without overloading a warm replica
LLM Inference Engineering · Lesson 11 · 25 min read
Quantize a model and evaluate the regression
LLM Inference Engineering · Lesson 12 · 25 min read
Check speculative decoding correctness and its cost
LLM Inference Engineering · Lesson 13 · 25 min read
Choose a latency-throughput operating point
LLM Inference Engineering · Lesson 14 · 25 min read
Investigate host overhead before changing GPU settings
LLM Inference Engineering · Lesson 15 · 25 min read
Compare eager and compiled normalization on real tensors
LLM Inference Engineering · Lesson 16 · 25 min read
Investigate inference tail latency with request records
LLM Inference Engineering · Lesson 17 · 25 min read
Protect interactive requests from noisy neighbors
LLM Inference Engineering · Lesson 18 · 25 min read
Plan cold starts and gate model rollouts
LLM Inference Engineering · Lesson 19 · 25 min read
Budget cache transfer before splitting inference pools
LLM Inference Engineering · Lesson 20 · 25 min read
Size serving capacity from accepted benchmark results
Saved lessons
AI Fundamentals · Lesson 1 · 9 min read
Run inference with a local LLM
Run a language model with and without supplied documentation, and explain how request context differs from trained model weights.
AI Fundamentals · Lesson 2 · 9 min read
Count tokens with the model's tokenizer
Tokenize docuctl docs, commands and IDs with Gemma's own tokenizer, then compare your counts with what Ollama actually processed, chat template included.
AI Fundamentals · Lesson 3 · 9 min read
Trace next-token generation
Trace generation one token at a time, inspect the candidate scores, and compare how supplied documentation changes the model’s next-token predictions.
AI Fundamentals · Lesson 4 · 10 min read
Send chat messages within the context window
Build a multi-turn chat request for the docuctl docs assistant, resend the history Ollama needs, and detect when the configured context window loses input.
AI Fundamentals · Lesson 5 · 10 min read
Control sampling, output limits and streaming
Control response variation and length, stream a reply as it arrives, and distinguish a finished answer from a cutoff or timeout.
AI Fundamentals · Lesson 6 · 10 min read
Call a local model and a hosted API
Send one docuctl docs question to Gemma through Ollama and to Gemini through its API, compare latency and token usage, and handle each failure.
AI Fundamentals · Lesson 7 · 10 min read
Get structured output and validate it with Pydantic
Make the docuctl docs assistant return a typed answer: send a Pydantic JSON schema as the output format, validate every reply, and see its limits.
AI Fundamentals · Lesson 8 · 10 min read
Rank documents with embeddings
Embed the docuctl docs pages and questions with a local model, rank pages by cosine similarity, and see the two ways similarity search misleads.
AI Fundamentals · Lesson 9 · 11 min read
Validate a model-proposed tool call
Send a read tool schema to a local model, inspect one proposed call, and reject unknown names or invalid page arguments before the tool function runs.
AI Fundamentals · Lesson 10 · 11 min read
Defend a tool-using assistant against prompt injection
Test whether document text can trigger an unauthorized tool call, and compare prompt warnings with application permission checks.
AI Fundamentals · Lesson 11 · 11 min read
Write your first eval for an LLM app
Write fixed cases for the docuctl docs assistant, grade every answer in code, run three trials per case, and use the results to judge two attempted fixes.
Model Context Protocol (MCP) · Lesson 1 · 15 min read
Implement an MCP server with typed tool contracts
Implement a task-tracker server with the MCP Python SDK whose typed tool schemas reject bad arguments and keep tool errors apart from protocol errors.
Model Context Protocol (MCP) · Lesson 2 · 20 min read
Serve MCP over stdio and Streamable HTTP, and test the contracts
Serve one MCP Python SDK server over stdio and Streamable HTTP, read the JSON-RPC requests the client sends, and pin its tool contracts with pytest.
Model Context Protocol (MCP) · Lesson 3 · 22 min read
Build an MCP client with discovery, calls and tracing
Build an MCP client that discovers tools, checks arguments before calling them, distinguishes failures and traces calls across client and server.
Model Context Protocol (MCP) · Lesson 4 · 20 min read
Expose resources and prompts from an MCP server
Build a docs server with the MCP Python SDK that offers a search tool, pages as resources and a review prompt, and returns the specified error codes.
Model Context Protocol (MCP) · Lesson 5 · 20 min read
Integrate MCP tools into ADK and LangGraph agents
Connect one MCP server to a Google ADK agent with McpToolset and a LangGraph agent with langchain-mcp-adapters, and compare how each handles tool failures.
Model Context Protocol (MCP) · Lesson 6 · 24 min read
Secure a remote MCP server with OAuth 2.1 and scoped tokens
Serve an MCP server over Streamable HTTP that accepts only tokens issued for it, publishes Protected Resource Metadata and returns 403 for a missing scope.
Model Context Protocol (MCP) · Lesson 7 · 26 min read
Build a read-only database MCP server with scoped roles
Let a model run SQL through an MCP tool on PostgreSQL 17 with a read-only role, a statement timeout and row and byte limits, and test what each layer stops.
Building Agents with Google ADK 2.0 · Lesson 1 · 15 min read
Build your first ADK agent with Gemini
Build a documentation assistant with Google ADK, understand its model and instructions, and run it from the terminal or development Web UI.
Building Agents with Google ADK 2.0 · Lesson 2 · 20 min read
Run an agent and read its event stream
Use Python Runner to manage an ADK conversation, inspect model and tool events, select the final answer and handle streaming and model-call limits.
Building Agents with Google ADK 2.0 · Lesson 3 · 25 min read
Give an agent typed function tools
Give a Google ADK 2.0 agent typed function tools, validate every call with Pydantic before it runs, and require human approval for the tool that writes.
Building Agents with Google ADK 2.0 · Lesson 4 · 20 min read
Connect an agent to MCP servers with McpToolset
Attach a typed MCP server to a Google ADK 2.0 agent with McpToolset, expose only the tools it needs, read what reaches the model and catch a failed start.
Building Agents with Google ADK 2.0 · Lesson 5 · 25 min read
Persist sessions and search conversation memory
Persist Google ADK 2.0 sessions in SQLite with DatabaseSessionService, keep user state across restarts and recall earlier conversations with load_memory.
Building Agents with Google ADK 2.0 · Lesson 6 · 25 min read
Guard model and tool calls with callbacks and plugins
Redact matching access-key identifiers before storage or model use, and reject file-tool reads outside the workspace with ADK callbacks and plugins.
Building Agents with Google ADK 2.0 · Lesson 7 · 20 min read
Build a graph workflow from nodes and edges
Build a release-notes workflow with function nodes, a typed agent node and a deterministic check that every commit reaches the output.
Building Agents with Google ADK 2.0 · Lesson 8 · 20 min read
Route a workflow with conditional edges
Route documentation build logs with Python, use a default edge for incomplete runs and ask an agent for link suggestions only when needed.
Building Agents with Google ADK 2.0 · Lesson 9 · 25 min read
Pause a workflow for human approval
Pause a migration workflow with the SQL attached, validate a reviewer decision and resume the same session to apply or reject the change.
Building Agents with Google ADK 2.0 · Lesson 10 · 25 min read
Build dynamic workflows in Python
Review changed documentation pages with dynamic child nodes, deterministic lint checks and a bounded agent fix loop with retries and timeouts.
Building Agents with Google ADK 2.0 · Lesson 11 · 20 min read
Delegate to sub-agents through a coordinator
Build a documentation review team with a coordinator, two typed specialists and an event check that both delegations ran.
Building Agents with Google ADK 2.0 · Lesson 12 · 25 min read
Evaluate an agent's tool trajectory and response
Write evaluation cases for tool use and complete answers, run ADK AgentEvaluator and understand the limits of trajectory, ROUGE and judge scores.
Building Agents with Google ADK 2.0 · Lesson 13 · 15 min read
Choose an ADK workflow pattern
Compare ADK workflow patterns by dependencies, control and failure policy, then inspect the real lesson graphs without calling a model.
Building Agents with Google ADK 2.0 · Lesson 14 · 20 min read
Generate and review a release announcement
Build an ADK writer and reviewer that compare a release announcement with changelog facts, then enforce the typed verdict in code.
Building Agents with Google ADK 2.0 · Lesson 15 · 20 min read
Revise a changelog line with a bounded loop
Refine a changelog line in an ADK 2.0 graph loop: a lint checks each draft, a back-edge sends problems to a reviser, and a state counter stops the loop.
Building Agents with Google ADK 2.0 · Lesson 16 · 25 min read
Run independent workflow branches and gather results
Run ADK 2.0 workflow branches in parallel and merge them with a JoinNode, then see one failed branch fail the graph and a dynamic parent keep the rest.
Building Agents with Google ADK 2.0 · Lesson 17 · 25 min read
Delegate an upgrade guide through a bounded agent tree
Build a depth-limited ADK AgentTool tree for an upgrade guide, check its source paths and share a model-call budget across nested runs.
Connecting Agents to Tools and Services with Google ADK 2.0 · Lesson 1 · 20 min read
Give an agent skills from a folder with SkillToolset
Load a folder of Agent Skills into an ADK agent with SkillToolset, run skill scripts, and catch the failures that silently skip a skill's steps.
Connecting Agents to Tools and Services with Google ADK 2.0 · Lesson 2 · 20 min read
Use Gemini built-in tools: Google Search grounding and code execution
Add Gemini's Google Search and code execution to an ADK agent beside a function tool, cite answers from grounding metadata, and handle request errors.
Connecting Agents to Tools and Services with Google ADK 2.0 · Lesson 3 · 25 min read
Query PostgreSQL through MCP Toolbox for Databases
Connect an ADK agent to PostgreSQL through MCP Toolbox with fixed SQL tools and a read-only role, and catch toolsets that fail to load.
Connecting Agents to Tools and Services with Google ADK 2.0 · Lesson 4 · 25 min read
Query BigQuery with BigQueryToolset
Query docs analytics through ADK BigQueryToolset with SELECT-only execution, a per-query bytes cap, and offline tests for refused jobs.
Connecting Agents to Tools and Services with Google ADK 2.0 · Lesson 5 · 25 min read
Search private data stores with Agent Search
Search engineering documents with ADK VertexAiSearchTool, validate a team filter from application state, and inspect recorded grounding metadata.
Connecting Agents to Tools and Services with Google ADK 2.0 · Lesson 6 · 25 min read
Expose the docs assistant over A2A and consume it
Serve an ADK agent over A2A with to_a2a, call it from another agent with RemoteA2aAgent, and debug card, connection and timeout failures.
Running and Deploying Agents with Google ADK 2.0 · Lesson 1 · 20 min read
Serve an agent over HTTP and drive it from the CLI
Serve a Google ADK 2.0 agent with adk api_server, call /run and /run_sse from a Python client, and script adk run with replay files and JSONL output.
Running and Deploying Agents with Google ADK 2.0 · Lesson 2 · 20 min read
Configure an ADK agent with YAML
Define a Google ADK 2.0 agent in root_agent.yaml, load it with from_config, and test which YAML the loader and the Visual Builder save endpoint refuse.
Running and Deploying Agents with Google ADK 2.0 · Lesson 3 · 20 min read
Tune a run with RunConfig and read the event loop
Set Google ADK 2.0 RunConfig per run to tag events, cap model calls and history, and time out the model, then trace when the Runner commits state.
Running and Deploying Agents with Google ADK 2.0 · Lesson 4 · 20 min read
Resume an interrupted agent run
Make a Google ADK 2.0 app resumable, finish a run whose process died inside a tool, and keep the retried tool from filing a duplicate issue.
Running and Deploying Agents with Google ADK 2.0 · Lesson 5 · 25 min read
Rewind a session and migrate its database
Undo turns in a Google ADK 2.0 session with rewind_async, see what it restores, and migrate a legacy pickle session database with adk migrate session.
Running and Deploying Agents with Google ADK 2.0 · Lesson 6 · 20 min read
Run an agent from event triggers
Start an ADK agent from Pub/Sub and Eventarc request bodies, authenticate local trigger calls, and deduplicate the review tool’s writes.
Running and Deploying Agents with Google ADK 2.0 · Lesson 7 · 25 min read
Reduce repeated context with caching and compaction
Cache the docs assistant's manual with ContextCacheConfig, summarize old turns with EventsCompactionConfig, and measure both in Gemini usage metadata.
Running and Deploying Agents with Google ADK 2.0 · Lesson 8 · 20 min read
Save and load files with Artifacts
Store an uploaded ship.toml and versioned reviews as ADK artifacts on disk, load files only when needed, and compare session and user scopes.
Running and Deploying Agents with Google ADK 2.0 · Lesson 9 · 25 min read
Call a REST API from an OpenAPI spec, with authentication
Turn a release API's OpenAPI spec into ADK tools, send its API key outside the prompt, keep the agent read-only, and debug wrong keys.
Running and Deploying Agents with Google ADK 2.0 · Lesson 10 · 20 min read
Make tools parallel-ready
Measure how ADK runs several function calls from one Gemini response, and make them overlap with async tools or a tool thread pool.
Running and Deploying Agents with Google ADK 2.0 · Lesson 11 · 25 min read
Expose the docs assistant as an MCP server
Serve the docs assistant as one MCP tool with to_mcp_server, call it from the MCP SDK and another ADK agent, and fix key and timeout failures.
Running and Deploying Agents with Google ADK 2.0 · Lesson 12 · 25 min read
Trace and measure agent runs with OpenTelemetry
Record ADK spans and GenAI metrics with OpenTelemetry, inspect one docs-assistant run, and control prompt and tool content in exported spans.
Running and Deploying Agents with Google ADK 2.0 · Lesson 13 · 25 min read
Test an agent against simulated users
Evaluate a docs assistant with simulated novice and expert users, inspect multi-turn scores, and diagnose turn caps and unsupported metrics.
Running and Deploying Agents with Google ADK 2.0 · Lesson 14 · 25 min read
Inject tool failures with environment simulation
Inject docs-service failures with ADK environment simulation, replay the recorded responses, and test the limits of retry guidance and error rules.
Running and Deploying Agents with Google ADK 2.0 · Lesson 15 · 30 min read
Write a custom eval metric and optimize the instruction
Score citations against completed docs reads, optimize an ADK instruction with GEPA, and inspect copied facts and limits of the validation set.
Running and Deploying Agents with Google ADK 2.0 · Lesson 16 · 25 min read
Apply safety and security guardrails to agent tools
Guard docs-assistant write tools with role checks, confirmation and path validation, then test refused calls and a followed prompt injection.
Running and Deploying Agents with Google ADK 2.0 · Lesson 17 · 20 min read
Use Agent Platform models, sessions and Memory Bank
Connect a local ADK runner to managed sessions and Memory Bank, separate model and storage locations, and inspect one cross-session recall run.
Running and Deploying Agents with Google ADK 2.0 · Lesson 18 · 20 min read
Scaffold and deploy an agent with the Agents CLI
Use an Agents CLI project for an existing ADK agent, inspect deployment defaults, set explicit resource limits, and resume a recorded remote session.
Running and Deploying Agents with Google ADK 2.0 · Lesson 19 · 20 min read
Deploy an ADK agent to Agent Runtime
Deploy an ADK agent with the native CLI, call Agent Runtime session and streaming methods, and distinguish endpoint mistakes from user-session errors.
Running and Deploying Agents with Google ADK 2.0 · Lesson 20 · 20 min read
Deploy an ADK agent to Cloud Run
Serve an ADK agent on private Cloud Run, separate caller and runtime permissions, and inspect what happens to local sessions across a revision change.
Building Live and Voice Agents with Google ADK 2.0 · Lesson 1 · 25 min read
Stream a voice conversation with run_live
Open an ADK live connection, send text and microphone audio, inspect transcripts and audio events, and compare saved answers with and without the docs page.
Building Live and Voice Agents with Google ADK 2.0 · Lesson 2 · 30 min read
Read live events and manage live sessions
Fold ADK live events into captions, handle interruptions, inspect saved session history, and test reconnect behavior with and without a handle.
Building Live and Voice Agents with Google ADK 2.0 · Lesson 3 · 25 min read
Send audio, images and video, and configure voice
Send PCM audio and JPEG frames to an ADK live agent, choose its voice, use push-to-talk signals, and diagnose format and configuration failures.
Building Live and Voice Agents with Google ADK 2.0 · Lesson 4 · 30 min read
Call tools during a live conversation
Run docs lookup and background tools in an ADK live conversation, inspect function responses, and reproduce tool errors and model-specific limits.
Building Live and Voice Agents with Google ADK 2.0 · Lesson 5 · 25 min read
Run live agents inside a workflow
Sequence a voice intake and docs-answer agent with ADK Workflow, inspect the typed handoff, and test live modes and incomplete transcripts.
Building Live and Voice Agents with Google ADK 2.0 · Lesson 6 · 25 min read
Guard and evaluate a voice agent
Test ADK live input, output and tool callbacks, inspect audio delivered before a block, and check what a recorded speech evaluation really scored.
Building Live and Voice Agents with Google ADK 2.0 · Lesson 7 · 25 min read
Build a custom WebSocket server for a live agent
Bridge a WebSocket client to an ADK live agent with binary audio, JSON events, bounded concurrent sessions and cleanup when either direction stops.
Building Agents with LangGraph · Lesson 1 · 25 min read
Build a graph agent with tools
Build a LangGraph code-review agent that chooses read-only tools, receives their results and answers, then test tool errors and graph step limits.
Building Agents with LangGraph · Lesson 2 · 20 min read
Add branches and stop conditions to a LangGraph agent
Replace tools_condition with a custom LangGraph router that stops repeated tool calls and runs near recursion_limit, and test every branch without a model.
Building Agents with LangGraph · Lesson 3 · 25 min read
Trim conversation history to a token budget in LangGraph
Trim a LangGraph code-review thread with trim_messages, pin key decisions, and compare the token estimate with Gemini’s reported input usage.
Building Agents with LangGraph · Lesson 4 · 22 min read
Add timeouts and token budgets to a LangGraph agent
Bound a LangGraph agent with tool and model timeouts and a soft token budget, then inspect a genuine tool proposal followed by a native local timeout.
Building Agents with LangGraph · Lesson 5 · 22 min read
Checkpoint a LangGraph workflow and resume it after a crash
Checkpoint a LangGraph workflow to SQLite with SqliteSaver, kill the process mid-run, resume without calling Gemini again and see which steps repeat.
Building Agents with LangGraph · Lesson 6 · 22 min read
Make LangGraph retries idempotent
Retry a ticket-filing write with a LangGraph RetryPolicy, see a retry file a duplicate, and stop duplicates across retries and resumes with an idempotency key.
Building Agents with LangGraph · Lesson 7 · 25 min read
Plan, execute and verify a multi-step task in LangGraph
Build a LangGraph plan, execute and verify graph that applies a review fix with a create_agent executor and grades it by running the project's tests.
Building Agents with LangGraph · Lesson 8 · 30 min read
Add human-in-the-loop interrupts
Pause a LangGraph code-review agent with interrupt() before it posts a comment, then resume it with Command(resume=...) to approve, edit or reject.
Building Agents with LangGraph · Lesson 9 · 30 min read
Add a long-term memory store
Give a LangGraph code-review agent memory across threads with a store keyed by repository and topic, and see the stale-rule and namespace-prefix failures.
Retrieval-Augmented Generation (RAG) · Lesson 1 · 22 min read
Build an embedding pipeline with LangChain
Prepare documents for search by splitting them into passages and creating embeddings. Keep source details and settings with the vectors.
Retrieval-Augmented Generation (RAG) · Lesson 2 · 24 min read
Build a PostgreSQL vector store with LangChain
Store searchable document passages in PostgreSQL. Update, filter and delete them, then check what happens when a write is retried or interrupted.
Retrieval-Augmented Generation (RAG) · Lesson 3 · 26 min read
Compare exact, HNSW and IVFFlat search in pgvector
Compare exact and approximate vector search on the same questions. Inspect which passages each method returns and how PostgreSQL runs the query.
Retrieval-Augmented Generation (RAG) · Lesson 4 · 28 min read
Build a RAG pipeline with citations
Answer questions from retrieved document passages. Check that each citation names a supplied source and quotes text that actually appears in it.
Retrieval-Augmented Generation (RAG) · Lesson 5 · 26 min read
Build multimodal RAG with chart source references
Find a chart through its description, then let a model read the image. Check the image’s identity and inspect the answer against its source.
Retrieval-Augmented Generation (RAG) · Lesson 6 · 16 min read
Rank document vectors with cosine distance
See how cosine distance ranks document vectors for a question. Check vector dimensions and lengths, then inspect the returned passages.
Building Agentic RAG Applications · Lesson 1 · 6 min read
How RAG works
Learn how an application searches documents, supplies relevant passages to a language model and links its answer to sources.
Building Agentic RAG Applications · Lesson 2 · 25 min read
Trace a RAG request from search to answer
Follow a question through document search, context assembly and the model request, then check the answer’s source links.
Building Agentic RAG Applications · Lesson 3 · 25 min read
Build a RAG eval dataset
Define which questions your documents can answer and which passages support them. Keep documentation versions and evaluation splits separate.
Building Agentic RAG Applications · Lesson 4 · 28 min read
Record a RAG baseline
Save a fixed RAG run before changing it. Compare retrieved passages and answer checks while keeping failures and missing responses visible.
Building Agentic RAG Applications · Lesson 5 · 20 min read
Load developer documentation
Turn pinned local documentation files into text records. Reject changed inputs and keep each document’s identity, source link and version.
Building Agentic RAG Applications · Lesson 6 · 20 min read
Track passage sources
Keep a passage tied to its exact source lines. Detect changed source files or altered passage text before displaying it.
Building Agentic RAG Applications · Lesson 7 · 20 min read
Handle ingestion failures
Continue loading valid documents when another source fails. Keep accepted text and failure reasons together, and mark incomplete batches.
Building Agentic RAG Applications · Lesson 8 · 25 min read
Version documents and chunks
Give document text, metadata and chunks their own revision identities. Compare a source-text edit with a metadata-only title change.
Building Agentic RAG Applications · Lesson 9 · 25 min read
Resume document ingestion
Restart interrupted ingestion without skipping unfinished sources or duplicating completed chunks. Check stored content before trusting a checkpoint.
Building Agentic RAG Applications · Lesson 10 · 25 min read
Update and delete indexed content
Replace or remove document passages and their text-index entries together. Verify search results and roll back interrupted changes.
Building Agentic RAG Applications · Lesson 11 · 25 min read
How BM25 ranks documents
See how matching words and document lengths affect SQLite BM25 ranking. Inspect indexed terms and scores before interpreting a result.
Building Agentic RAG Applications · Lesson 12 · 25 min read
Add vector retrieval
Search with saved text embeddings in a LangChain vector store. Inspect ranked passages and reject questions outside the recording.
Building Agentic RAG Applications · Lesson 13 · 25 min read
Apply filters across retrievers
Apply the same documentation-version rule before choosing lexical and vector results. See why filtering after a result limit can lose useful passages.
Building Agentic RAG Applications · Lesson 14 · 25 min read
Build hybrid retrieval
Combine word-based and vector-search rankings without adding incompatible scores. Trace each passage’s contribution to the combined order.
Building Agentic RAG Applications · Lesson 15 · 25 min read
Rerank retrieved passages
Reorder retrieved passages with term coverage, Gemini and a cross-encoder. Compare their recorded rankings and the limits of each scorer.
Building Agentic RAG Applications · Lesson 16 · 25 min read
Compare retrieval configurations
Compare word-based, vector, hybrid and reranked search on the same questions and source targets. Inspect individual misses before averages.
Building Agentic RAG Applications · Lesson 17 · 25 min read
Choose chunk boundaries
Compare character, paragraph and heading-based splits on one document. Check whether each chunk keeps an instruction with its qualifier.
Building Agentic RAG Applications · Lesson 18 · 25 min read
Retrieve surrounding context
Add nearby source text around selected passages, merge overlaps, and keep each window inside the same section and document revision.
Building Agentic RAG Applications · Lesson 19 · 25 min read
Assemble context within a token budget
Fit source windows, instructions and the question into a complete token-counted request. Reserve space for output and reject required-content overflow.
Building Agentic RAG Applications · Lesson 20 · 25 min read
Stream RAG answers
Reconstruct complete replies from streamed data and check source references before accepting them. Compare saved replay with a recorded Gemini stream.
Building Agentic RAG Applications · Lesson 21 · 25 min read
Handle conflicting documentation
Keep the requested documentation version, compare explicit source rules, and withhold an answer request when eligible claims conflict.
Building Agentic RAG Applications · Lesson 22 · 25 min read
Add search and read tools
Separate candidate search from reading source text. Bind each read to a result issued for the same request and document snapshot.
Building Agentic RAG Applications · Lesson 23 · 25 min read
Refine queries with a scripted policy
Use a scripted policy to read a passage, refine its search query and decide when to stop. Keep each attempt and its stopping reason.
Building Agentic RAG Applications · Lesson 24 · 25 min read
Bound scripted retrieval runs
Check search, read and source-byte allowances before running a scripted action. Distinguish denied calls from admitted calls that fail.
Building Agentic RAG Applications · Lesson 25 · 25 min read
Compare fixed, scripted and Gemini retrieval policies
Compare fixed, scripted and Gemini-selected retrieval on the same tasks. Check source reads separately from whether the controller finished.
Building Agentic RAG Applications · Lesson 26 · 35 min read
Build a model-driven RAG agent
Let Gemini choose search, read, answer or stop actions. Enforce tool limits, check citations and compare the recorded results with fixed RAG.
Building Agentic RAG Applications · Lesson 27 · 25 min read
Serve the RAG application with FastAPI
Expose the retrieval core through FastAPI. Validate requests, return source traces and distinguish HTTP errors from limited retrieval runs.
Building Agentic RAG Applications · Lesson 28 · 25 min read
Build a retrieval inspector
Inspect retrieval decisions and source passages in a browser. Check response bytes and request identity before displaying the latest result.
Building Agentic RAG Applications · Lesson 29 · 25 min read
Connect retrieval tools through MCP
Expose documentation search and reads through an MCP client and server. Discover tool schemas and keep issued passage handles in the same session.
Building Agentic RAG Applications · Lesson 30 · 20 min read
Authorize collection searches
Limit search and passage reads to collections the caller may access. Recheck identity and current permissions before returning source text.
Building Agentic RAG Applications · Lesson 31 · 20 min read
Cache retrieval results
Reuse completed retrieval results only for matching callers, permissions and source snapshots. Expire old entries and skip failed or incomplete runs.
Building Agentic RAG Applications · Lesson 32 · 25 min read
Trace RAG requests
Follow each local retrieval execution through its operations. Separate concurrent attempts and keep questions, source text and credentials out of trace logs.
Building Agentic RAG Applications · Lesson 33 · 25 min read
Limit concurrent RAG requests
Limit active retrieval work and waiting requests. Inspect queue overflow, waiting deadlines and slot cleanup when a client cancels or times out.
Building Agentic RAG Applications · Lesson 34 · 20 min read
Run RAG evals on an updated corpus
Compare retrieval before and after a document update. Reject stale target labels and keep deleted sources visible in the comparison.
Building Agentic RAG Applications · Lesson 35 · 25 min read
Evaluate scripted retrieval tasks
Check whether fixed and scripted policies read their required passages. Separate execution checks, task outcomes and local release decisions.
Building Agentic RAG Applications · Lesson 36 · 25 min read
Release the RAG application
Check a staged local retrieval service against its files, runtime behavior and task report. Preserve failed promotion and rollback results.
Building Agentic RAG Applications · Lesson 37 · 35 min read
Build the developer knowledge assistant
Build a local documentation assistant with a browser UI and CLI. Connect version-aware search, collection permissions, source-linked answers and evaluation.
LLM Evals · Lesson 1 · 25 min read
Build an eval harness with pytest
Build a versioned pytest eval harness for an LLM triage function with structured-output checks, a calibrated DeepEval G-Eval judge, pass^k and offline replay.
LLM Evals · Lesson 2 · 25 min read
Measure RAG and tool-call quality
Evaluate a LangChain docs agent stage by stage with DeepEval, score its tool calls, retrieval and answer faithfulness, and report the first stage that fails.
LLM Evals · Lesson 3 · 20 min read
Write robustness tests for an LLM app
Extend a pytest eval suite with meaning-preserving perturbations and prompt-injection cases, run it on Gemini and Gemma, and read per-perturbation pass counts.
LLM Evals · Lesson 4 · 22 min read
Gate releases on eval regressions in CI
Gate prompt, model and dataset changes by comparing a pytest eval run with the main baseline, block new failures and run it in GitHub Actions without a model.
LLM Evals · Lesson 5 · 22 min read
Check evaluation datasets for leakage
Keep related tracker issues in one split, review word overlap and copied prompt text, and detect changes after a held-out dataset is frozen.
LLM Evals · Lesson 6 · 20 min read
Bind an eval run to a release manifest
Hash a tracker docs-assistant bundle, compare its settings with a recorded eval run, and reject changed files or missing evaluated cases.
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 1 · 18 min read
Scaffold, lint, and run an ADK project with Google Agents CLI
Scaffold a prototype ADK agent with agents-cli, inspect agents-cli-manifest.yaml, run agents-cli lint, and serve multi-turn ADK and A2A sessions locally.
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 2 · 20 min read
Enhance, upgrade, and extend an Agents CLI project
Add Cloud Run and CI/CD scaffolding in place with scaffold enhance, run 3-way template merges with scaffold upgrade, and wire agents-cli-extension.yaml.
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 3 · 22 min read
Generate traces and grade evaluations with agents-cli eval
Author single-turn and continued-conversation datasets, generate ADK traces with agents-cli eval generate, and score custom metrics in eval grade.
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 4 · 20 min read
Synthesize user simulations and compare evaluation runs
Generate simulated conversations, inspect failure groups and compare baseline and candidate evaluation runs with Google Agents CLI.
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 5 · 22 min read
Provision Terraform infrastructure and deploy with agents-cli
Separate Terraform ownership from code rollouts. Inspect Agent Runtime preflight checks and Cloud Run command previews before deploying an agent.
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 6 · 20 min read
Publish to Gemini and configure agent observability
Configure Gemini Enterprise agent registration, separate trace metadata from message payloads, and validate settings before checking delivery after deployment.
Building AI Systems · Lesson 1 · 25 min read
Choose an architecture from task requirements
Build a version-aware documentation lookup and an approval-bound action proposal. Use their contracts to choose an application boundary.
Building AI Systems · Lesson 2 · 25 min read
Create an evaluation set and a failure taxonomy
Turn version, environment, role and action requirements into evaluation cases. Distinguish failed task contracts from incomplete execution.
Building AI Systems · Lesson 3 · 25 min read
Set task acceptance criteria and request resource budgets
Define task acceptance and request resource limits. Reuse application graders and distinguish admission decisions from post-execution checks.
Building AI Systems · Lesson 4 · 30 min read
Define a task-specific answer rubric
Write source-based criteria for a documentation answer, bind example judgements to exact revisions and keep pending review separate from scored outcomes.
Building AI Systems · Lesson 5 · 25 min read
Separate source support, action correctness and format validity
Diagnose a structured answer without letting valid JSON, a matching citation or a correct command stand in for the other requirements.
Building AI Systems · Lesson 6 · 25 min read
Measure quality by request slice and asymmetric failure cost
Inspect request-group coverage and explicit error costs. Keep critical failures, incomplete runs and empty groups visible beside the overall score.
Building AI Systems · Lesson 7 · 22 min read
Build a resumable repeated-trial benchmark
Repeat evaluation cases across sampled model replies, log each trial and resume interrupted runs. Report per-case passes, pass@k and pass^k.
Building AI Systems · Lesson 8 · 22 min read
Compare paired evaluation runs with uncertainty
Compare prompt versions on paired cases and seeds. Bootstrap differences over cases, source groups and trials, then inspect uncertainty by slice.
Building AI Systems · Lesson 9 · 26 min read
Build a portable model adapter with contract tests
Use one chat contract for Ollama’s native and OpenAI-compatible APIs. Test recorded traffic for request, response and error behavior.
Building AI Systems · Lesson 10 · 22 min read
Build a model selection harness
Define requirements for a small task, test two local models on development and held-out cases, and inspect the recorded model-selection rule.
Building AI Systems · Lesson 11 · 22 min read
Check user and tool permissions across service boundaries
Delegate a docuctl tool call with limited authority. Test role, tenant, actor, audience, expiry and replay checks without forwarding session tokens.
Building AI Systems · Lesson 12 · 22 min read
Check tool proposals and untrusted agent handoffs
Check docuctl proposals against trusted page and reviewer records. Keep handoffs untrusted and hold publication after external input arrives.
Building AI Systems · Lesson 13 · 20 min read
Build a guardrails proxy with streaming-output tests
Build a streaming proxy that redacts or blocks email addresses and card numbers across chunk boundaries. Test it with saved streams and failures.
Building AI Systems · Lesson 14 · 25 min read
Build end-to-end request tracing with source provenance
Propagate a trace across two local docuctl processes. Inspect parent links and distinguish current, stale and dropped sources before returning a citation.
Building AI Systems · Lesson 15 · 22 min read
Build LLM monitoring for latency, cost and errors
Aggregate simulated model-service requests into latency, token, cost, error and queue metrics. Test alert transitions and histogram estimates.
Building AI Systems · Lesson 16 · 25 min read
Compare cached and uncached attention work
Compare cached and uncached causal attention across workloads. Check equivalent outputs, counted operations and local CPU timings before interpreting savings.
Building AI Systems · Lesson 17 · 25 min read
Compare full updates and low-rank adaptation
Train full and low-rank updates of a small text classifier, compare held-out predictions and count the parameters each method changes.
Building AI Systems · Lesson 18 · 30 min read
Compare packed weight quantization and output error
Pack trained matrices into eight-bit values or paired four-bit codes. Compare numeric payload sizes and output errors using dequantized CPU inference.
Building AI Systems · Lesson 19 · 30 min read
Admit decoding requests between token steps
Compare fixed batches with admission between decoding steps. Follow unequal-length requests through a padded CPU model and check the generated tokens.
Building AI Systems · Lesson 20 · 30 min read
Inspect a direct preference optimization update
Update a tiny transformer from chosen and rejected completions. Trace completion-token scores, a frozen reference and the direction of the DPO loss.
Building AI Systems · Lesson 21 · 30 min read
Run group-relative policy updates on sampled completions
Sample completions from a tiny CPU policy, normalize rewards within each group, and inspect clipped updates with fixed old scores and a frozen reference.
Building MLOps · Lesson 1 · 25 min read
Use only data available when the prediction is made
Separate event time, arrival time and label readiness so a historical return prediction uses only available inputs and finalized outcomes.
Building MLOps · Lesson 2 · 25 min read
Choose evaluation dates for the return model
Match the evaluation to future predictions for existing users, keep the declared date windows and exclude later outcomes from earlier decisions.
Building MLOps · Lesson 3 · 25 min read
Train, save and reload the user-return model
Prepare historical user-return examples, fit and evaluate a baseline, then reload its saved scaler and model to predict in a fresh process.
Building MLOps · Lesson 4 · 25 min read
Choose a decision threshold using explicit error costs
Compare three thresholds on the same validation predictions while keeping the fitted model and final test set unchanged.
Building MLOps · Lesson 5 · 25 min read
Validate incoming events before preparing training data
Preserve original events, quarantine invalid records and block the entire training batch when field, identity or temporal checks fail.
Building MLOps · Lesson 6 · 25 min read
Reconstruct the feature used by an earlier prediction
Store feature publication history and reconstruct the count available to an earlier return prediction, without applying later corrections.
Building MLOps · Lesson 7 · 25 min read
Compare historical and current feature calculations
Compare the same feature version, cutoff and arrival policy, then distinguish a calculation mismatch from stale or unavailable feature data.
Building MLOps · Lesson 8 · 25 min read
Version the dataset and feature contract together
Bind data, schemas and feature definitions to explicit versions in SQLite; refuse identity conflicts and roll back a partial binding attempt.
Building MLOps · Lesson 9 · 30 min read
Track a training run and reload its model
Connect the dataset, source, fitting settings and validation result to one MLflow run, then retrieve the model another process can use.
Building MLOps · Lesson 10 · 30 min read
Connect preparation, training and evaluation with Prefect
Automate the manual return-model workflow while keeping the accepted events, historical features and fitted model connected.
Building MLOps · Lesson 11 · 30 min read
Retry a failed step without repeating the experiment
Recover a failed write of the completion record without repeating training; reuse a completed attempt only when its inputs and artifacts still match.
Building MLOps · Lesson 12 · 30 min read
Test pipeline changes before producing a candidate
Run unit and integration checks through one local CI command, retain discovered test counts and diagnostics, and propagate a failed result.
Building MLOps · Lesson 13 · 30 min read
Evaluate a candidate against a declared release policy
Recompute validation from the saved model, bind the decision to a policy and keep failed candidates available for inspection.
Building MLOps · Lesson 14 · 30 min read
Register and select an explicit model version
Package the fitted return model with its contract and gate decision, then select a checked version through a local MLflow alias.
Building MLOps · Lesson 15 · 30 min read
Produce daily predictions and expose an optional HTTP interface
Use one validated predictor for the analyst’s batch and a loopback HTTP endpoint, with the selected bundle attached to every prediction.
Building MLOps · Lesson 16 · 30 min read
Stage a candidate with an explicit traffic decision
Route a repeatable subset of observation IDs to a candidate bundle, retain routing generations and reject stale configuration updates.
Building MLOps · Lesson 17 · 30 min read
Roll back to a compatible model bundle
Observe a controlled candidate failure, restore a checked earlier routing generation and confirm predictions use the stable bundle.
Building MLOps · Lesson 18 · 30 min read
Monitor prediction requests and input failures
Collect bounded request counts, validation failures and local latency measurements; keep these service signals separate from prediction quality.
Building MLOps · Lesson 19 · 30 min read
Evaluate predictions after return labels become final
Join predictions to their original observations, keep unfinished outcomes pending and report quality by the bundle that produced them.
Building MLOps · Lesson 20 · 30 min read
Investigate changed inputs before choosing a response
Compare a retained feature distribution, separate invalid data from a genuine change and consult finalized outcomes before proposing retraining.
Building MLOps · Lesson 21 · 30 min read
Recover the input path and evaluate a new candidate
Return to the valid source after the controlled data fault, run the checked pipeline again and keep traffic unchanged until a release decision.
Build a Small Language Model From Scratch · Lesson 1 · 25 min read
Build one training step by hand
Build a 20-parameter next-token model in plain Python, compute every gradient by hand, check them against finite differences and apply one update.
Build a Small Language Model From Scratch · Lesson 2 · 25 min read
Build a byte-pair encoding tokenizer
Train a byte-pair encoding tokenizer on a small synthetic story corpus in plain Python, save it as a versioned file and test what it cannot encode.
Build a Small Language Model From Scratch · Lesson 3 · 25 min read
Build a next-token prediction baseline
Score uniform, unigram and bigram models on held-out stories with cross-entropy, and record the prediction a model that sees one token back cannot make.
Build a Small Language Model From Scratch · Lesson 4 · 30 min read
Build causal self-attention and inspect intermediate outputs
Implement causal self-attention and its backward pass in plain Python. Inspect intermediate tensors and test that future tokens remain hidden.
Build a Small Language Model From Scratch · Lesson 5 · 30 min read
Build a transformer block with positional information
Combine causal attention, normalization, skip paths and a feed-forward network. Add position embeddings and check the complete block’s gradients.
Build a Small Language Model From Scratch · Lesson 6 · 30 min read
Build a small language-model training pipeline
Train a one-block transformer on bundled stories using batches and Adam. Inspect loss and compare it with a bigram baseline on held-out stories.
Build a Small Language Model From Scratch · Lesson 7 · 30 min read
Build checkpoints and resumable training
Save checkpoints bound to training inputs, select parameters by development loss and test that an interrupted run resumes to the same result.
Build a Small Language Model From Scratch · Lesson 8 · 25 min read
Build text generation with sampling controls
Generate text from the trained model with greedy choice, temperature and top-k. Define stop rules and compare settings on development openings.
Build a Small Language Model From Scratch · Lesson 9 · 25 min read
Build a KV cache for LLM generation
Reuse attention keys and values during generation. Test cached and uncached output equivalence, and count the computation avoided by the cache.
Build a Small Language Model From Scratch · Lesson 10 · 30 min read
Build a local server for the trained model
Serve the trained model through a validated local HTTP interface. Compare served and direct generation, and evaluate on held-out story tasks.
Build a Small Language Model From Scratch · Lesson 11 · 30 min read
Compare a handwritten transformer with PyTorch
Port the existing one-block transformer to CPU tensors, then compare logits, loss and every parameter gradient with explicit attention and PyTorch SDPA.
Agent Design, Optimization and Harnesses · Lesson 1 · 25 min read
Compare a workflow with a bounded policy
Compare a keyword route, fixed search/read workflow and scripted decision loop on shared documentation tasks. Measure outcomes and tool work.
Agent Design, Optimization and Harnesses · Lesson 2 · 25 min read
Run a search-and-read decision loop
Separate policy decisions from tool execution. Enforce action schemas, tool and turn limits, and citation provenance before checking the returned command.
Agent Design, Optimization and Harnesses · Lesson 3 · 25 min read
Delegate independent tasks with explicit worker state
Fan out two documentation requests into separate bounded runtimes. Gather results by task ID and account for dispatch, merge and incomplete-worker behavior.
Agent Design, Optimization and Harnesses · Lesson 4 · 25 min read
Curate traces before selecting an improvement
Deduplicate versioned questions, keep task families within one split and save the actual decisions and tool observations for each cleaned case.
Agent Design, Optimization and Harnesses · Lesson 5 · 25 min read
Tune retrieval policy on separated task families
Choose alias expansion and candidate count on development tasks. Freeze the selected configuration before measuring source recall on separate task families.
Agent Design, Optimization and Harnesses · Lesson 6 · 25 min read
Calibrate task graders before comparing policies
Expose false positives in a format-only grader, compare it with the task contract and calculate what any-success and repeated-success metrics actually mean.
Agent Design, Optimization and Harnesses · Lesson 7 · 25 min read
Bound a local repair process
Restrict a retry-condition patch, write each candidate into a fresh workspace and run independent behavioral checks in a separate process with a timeout.
Agent Design, Optimization and Harnesses · Lesson 8 · 25 min read
Build a coding-agent loop
Build a coding-agent loop that streams model messages, runs repository tools, checks a real test repair and stops at a fixed turn limit.
Agent Design, Optimization and Harnesses · Lesson 9 · 20 min read
Verify edits independently of completion claims
Run controlled repair candidates through the existing harness. Preserve completion claims as observations while grading the behavior of each fresh candidate.
Context and Memory Engineering for AI Agents · Lesson 1 · 30 min read
Assemble a model request within a context budget
Assemble instructions, tools, history and retrieved passages into one model request. Keep required sections whole and record optional content that does not fit.
Context and Memory Engineering for AI Agents · Lesson 2 · 28 min read
Build context compaction with information-loss tests
Replace removed conversation turns with cited notes. Test retained, lost and stale facts instead of assuming a shorter context preserves every fact.
Context and Memory Engineering for AI Agents · Lesson 3 · 26 min read
Build isolated contexts for users, tasks, and agents
Scope context to the requesting app, user, task or agent. Compare a leaking shared list with a scoped store and test restricted worker handoffs.
Context and Memory Engineering for AI Agents · Lesson 4 · 27 min read
Build a context-selection benchmark
Compare four history-selection strategies on shared cases, budgets and graders. Inspect retained facts, stale facts and strategy-specific failures.
Context and Memory Engineering for AI Agents · Lesson 5 · 26 min read
Build a memory service with explicit user and task scope
Store assistant memory in SQLite across restarts. Scope each read by user and task, then test that another scope cannot retrieve the stored facts.
Context and Memory Engineering for AI Agents · Lesson 6 · 30 min read
Build memory provenance and deletion
Track memory sources, corrections and expiry in SQLite. Delete forgotten content while retaining a text-free record, and test scope isolation.
Context and Memory Engineering for AI Agents · Lesson 7 · 28 min read
Build working, semantic, and episodic memory retrieval
Retrieve working notes, facts and past events with separate rules and token quotas. Compare this with a pooled ranking on the same memory tasks.
Context and Memory Engineering for AI Agents · Lesson 8 · 28 min read
Build memory consolidation with conflict tests
Merge duplicate memories and resolve conflicts using source and recency rules. Retain superseded facts with records of the consolidation decision.
Context and Memory Engineering for AI Agents · Lesson 9 · 30 min read
Compare memory compaction with fact-retention checks
Replay a conversation with changed and forgotten facts. Compare four context strategies under one budget and inspect current, stale and deleted facts.
Context and Memory Engineering for AI Agents · Lesson 10 · 26 min read
Build a memory usefulness eval
Measure needed facts, unnecessary memory, stale lines and forgotten content sent with requests. Compare usefulness with recall and storage growth.
LLM Inference Engineering · Lesson 1 · 25 min read
Trace a real inference request from prompt to first token
Trace tokenization, prefill and decode with a pinned open model. Compare actual cached and uncached token intervals from a local inference run.
LLM Inference Engineering · Lesson 2 · 25 min read
Stream model output and stop work when the client disconnects
Build a local streaming HTTP server with bounded admission and disconnect cleanup. Test SSE framing and iterator release over real sockets.
LLM Inference Engineering · Lesson 3 · 25 min read
Benchmark streaming inference under load
Measure offered load, completed streams, rejections and first-token latency. Use a real HTTP client and retain errors in the benchmark record.
LLM Inference Engineering · Lesson 4 · 25 min read
Budget model weights, KV cache, and runtime memory
Calculate weight and attention-cache payloads with consistent byte units. Compare grouped-query cache sizes and budget runtime memory separately.
LLM Inference Engineering · Lesson 5 · 25 min read
Choose hardware from the workload bottleneck
Use a roofline estimate to distinguish compute and bandwidth limits. Compare memory fit and explain why hardware choice depends on workload.
LLM Inference Engineering · Lesson 6 · 25 min read
Implement paged cache allocation and copy-on-write
Implement a paged cache allocator with reference counts and copy-on-write. Inspect ownership and fragmentation using concrete token markers.
LLM Inference Engineering · Lesson 7 · 25 min read
Explain tiled attention and verify its output
Implement tiled attention with online softmax on the CPU. Verify numerical agreement and distinguish storage savings from measured GPU runtime.
LLM Inference Engineering · Lesson 8 · 25 min read
Schedule requests between decode iterations
Compare fixed and changing batch membership with a request scheduler. Inspect actual local model interleaving and its latency tradeoffs.
LLM Inference Engineering · Lesson 9 · 25 min read
Balance long-prompt prefill against streaming latency
Schedule prompt chunks around active decode work. Compare modeled token budgets with a real cached-forward experiment and explain added overhead.
LLM Inference Engineering · Lesson 10 · 25 min read
Reuse prompt prefixes without overloading a warm replica
Implement radix-prefix matching, pinning and eviction. Compare cache affinity with queue waiting and inspect real reuse of model cache tensors.
LLM Inference Engineering · Lesson 11 · 25 min read
Quantize a model and evaluate the regression
Convert real model linear layers to INT8 and compare development likelihood. Inspect the observed regression before accepting a serving candidate.
LLM Inference Engineering · Lesson 12 · 25 min read
Check speculative decoding correctness and its cost
Implement speculative token acceptance and residual resampling. Verify the target distribution and separate correctness from assumed speedups.
LLM Inference Engineering · Lesson 13 · 25 min read
Choose a latency-throughput operating point
Choose a feasible latency and throughput operating point. Inspect memory limits, communication assumptions and efficiency per serving device.
LLM Inference Engineering · Lesson 14 · 25 min read
Investigate host overhead before changing GPU settings
Profile host operators around an actual Metal model forward. Read recorded events without treating CPU timings as GPU kernel measurements.
LLM Inference Engineering · Lesson 15 · 25 min read
Compare eager and compiled normalization on real tensors
Compare eager and compiled normalization on real Metal tensors. Check numerical agreement and synchronized timings across several input shapes.
LLM Inference Engineering · Lesson 16 · 25 min read
Investigate inference tail latency with request records
Aggregate request records to investigate tail latency. Keep timing boundaries, preemptions and admission outcomes distinct when testing hypotheses.
LLM Inference Engineering · Lesson 17 · 25 min read
Protect interactive requests from noisy neighbors
Implement tenant queues, token budgets and deficit round-robin scheduling. Inspect admission limits and the latency cost of protecting interactive work.
LLM Inference Engineering · Lesson 18 · 25 min read
Plan cold starts and gate model rollouts
Model replica startup and finite standby capacity, then evaluate canary gates. Distinguish requested capacity from ready capacity and compare tradeoffs.
LLM Inference Engineering · Lesson 19 · 25 min read
Budget cache transfer before splitting inference pools
Calculate cache-transfer payloads before separating prefill and decode. Explore bandwidth and expert-placement assumptions without claiming fleet benchmarks.
LLM Inference Engineering · Lesson 20 · 25 min read
Size serving capacity from accepted benchmark results
Size serving replicas from accepted workload-matched results. Convert request demand to peak capacity and include reserves and stated cost assumptions.