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 session state and long-term 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
Building Agents with Google ADK 2.0 · Lesson 15 · 20 min read
Iterative refinement
Building Agents with Google ADK 2.0 · Lesson 16 · 25 min read
Parallel fan-out and gather
Building Agents with Google ADK 2.0 · Lesson 17 · 25 min read
Hierarchical task decomposition
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
Keep long sessions in budget with compaction and context caching
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
Inspect cosine distance under the hood
Building Agentic RAG Applications · Lesson 1 · 6 min read
How RAG works
Building Agentic RAG Applications · Lesson 2 · 25 min read
Build a RAG pipeline
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 · 25 min read
Serve the RAG application with FastAPI
Building Agentic RAG Applications · Lesson 27 · 25 min read
Build a retrieval inspector
Building Agentic RAG Applications · Lesson 28 · 25 min read
Connect retrieval tools through MCP
Building Agentic RAG Applications · Lesson 29 · 20 min read
Authorize collection searches
Building Agentic RAG Applications · Lesson 30 · 20 min read
Cache retrieval results
Building Agentic RAG Applications · Lesson 31 · 25 min read
Trace RAG requests
Building Agentic RAG Applications · Lesson 32 · 25 min read
Limit concurrent RAG requests
Building Agentic RAG Applications · Lesson 33 · 20 min read
Run RAG evals on an updated corpus
Building Agentic RAG Applications · Lesson 34 · 25 min read
Evaluate scripted retrieval tasks
Building Agentic RAG Applications · Lesson 35 · 25 min read
Release the RAG application
Building Agentic RAG Applications · Lesson 36 · 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 using the existing eval runner
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 repeated-trial benchmark that records failures and incomplete runs
Building AI Systems · Lesson 8 · 22 min read
Build a paired comparison report with uncertainty and slice-level results
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
Build authentication and authorization boundaries for users and tools
Building AI Systems · Lesson 12 · 22 min read
Build a policy boundary for untrusted notes, tool outputs, and 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
Profile KV-cache work across serving workloads
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
Train a baseline model
Building MLOps · Lesson 2 · 20 min read
Measure the cost of prediction errors
Building MLOps · Lesson 3 · 25 min read
Choose evaluation splits
Building MLOps · Lesson 4 · 25 min read
Handle late data and delayed labels
Building MLOps · Lesson 5 · 25 min read
Validate incoming data
Building MLOps · Lesson 6 · 25 min read
Build historical feature snapshots
Building MLOps · Lesson 7 · 25 min read
Check features before serving
Building MLOps · Lesson 8 · 30 min read
Version the data and feature contract
Building MLOps · Lesson 9 · 25 min read
Capture the training configuration
Building MLOps · Lesson 10 · 30 min read
Record and select a training run
Building MLOps · Lesson 11 · 25 min read
Export a full-precision inference bundle
Building MLOps · Lesson 12 · 25 min read
Gate a model candidate on validation results
Building MLOps · Lesson 13 · 25 min read
Register and select a content-addressed model
Building MLOps · Lesson 14 · 25 min read
Serve a versioned predictor through batch and HTTP
Building MLOps · Lesson 15 · 25 min read
Shadow predictions without changing live responses
Building MLOps · Lesson 16 · 25 min read
Route a sticky canary and compare cohort outcomes
Building MLOps · Lesson 17 · 25 min read
Roll back a model with feature-contract checks
Building MLOps · Lesson 18 · 25 min read
Distinguish schema, freshness and distribution signals
Building MLOps · Lesson 19 · 25 min read
Join delayed outcomes and review retraining
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
Build a context assembler for instructions, history, tools, and retrieved passages
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
Build a 50-turn memory-compaction benchmark 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
Run a language model one token at a time, record the top candidates it scores at each step, and see how the docs in the context change every choice.
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
Set temperature and seed, cap the output with num_predict, stream the reply and time its first chunk, and handle a reply that was cut off or timed out.
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 acts on discovery, refuses bad calls before sending them, classifies every outcome and traces each call with OpenTelemetry.
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 session state and long-term 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
Guard a Google ADK 2.0 agent with a plugin that strips AWS key IDs before Gemini sees them and a callback that keeps a file tool inside its workspace.
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
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
Iterative refinement
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
Parallel fan-out and gather
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
Hierarchical task decomposition
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
Keep long sessions in budget with compaction and context caching
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 see which survive a restart.
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 code-review agent as a LangGraph StateGraph with a ToolNode and tools_condition, run it on Gemini, and handle tool errors and the step limit.
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
Split internal developer documentation with LangChain, embed chunks through Ollama, and keep the model and chunk settings beside the vectors.
Retrieval-Augmented Generation (RAG) · Lesson 2 · 24 min read
Build a PostgreSQL vector store with LangChain
Use PGVectorStore to insert, replace, filter and delete internal documentation chunks, then test retries and a partially written batch.
Retrieval-Augmented Generation (RAG) · Lesson 3 · 26 min read
Compare exact, HNSW and IVFFlat search in pgvector
Compare pgvector exact, HNSW and IVFFlat results through PGVectorStore, check the query plan, and measure overlap on saved developer questions.
Retrieval-Augmented Generation (RAG) · Lesson 4 · 28 min read
Build a RAG pipeline with citations
Retrieve internal developer documentation with PGVectorStore, ask Gemini for source IDs and quotes, and reject citations outside the supplied chunks.
Retrieval-Augmented Generation (RAG) · Lesson 5 · 26 min read
Build multimodal RAG with chart source references
Retrieve chart descriptions with PGVectorStore, send selected PNGs to Gemini, and check image identity separately from quoted source text.
Retrieval-Augmented Generation (RAG) · Lesson 6 · 16 min read
Inspect cosine distance under the hood
Use NumPy and saved real embeddings to inspect cosine distance, reject invalid vector shapes, and see why metadata filters still matter.
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
Build a RAG pipeline
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
Create eight source-bound developer questions, label relevant passages by documentation version, and validate answerability and frozen held-out targets.
Building Agentic RAG Applications · Lesson 4 · 28 min read
Record a RAG baseline
Record a fixed RAG pipeline on eight versioned questions, separate retrieval from answer checks, and preserve missing answers without retries.
Building Agentic RAG Applications · Lesson 5 · 20 min read
Load developer documentation
Load a pinned local UTF-8 documentation snapshot into records that keep the source identity, version, URL and text together.
Building Agentic RAG Applications · Lesson 6 · 20 min read
Track passage sources
Bind an exact passage to its source path, byte hash and line span, then reject stale or altered records before displaying the text.
Building Agentic RAG Applications · Lesson 7 · 20 min read
Handle ingestion failures
Keep accepted documents and explicit failure records together, and return an incomplete batch status when a source cannot be loaded.
Building Agentic RAG Applications · Lesson 8 · 25 min read
Version documents and chunks
Create source and chunk revisions from pinned documentation, compare text and metadata changes, and reject inconsistent saved snapshots.
Building Agentic RAG Applications · Lesson 9 · 25 min read
Resume document ingestion
Resume a pinned SQLite ingestion job after an injected interruption, checking committed sources, chunk rows and atomic completion checkpoints.
Building Agentic RAG Applications · Lesson 10 · 25 min read
Update and delete indexed content
Update or delete source and chunk rows with a SQLite FTS5 index in one transaction, then check actual search results and rollback behavior.
Building Agentic RAG Applications · Lesson 11 · 25 min read
How BM25 ranks documents
Inspect native SQLite FTS5 BM25 scores, indexed terms and document lengths, and keep matching passages separate from answer validation.
Building Agentic RAG Applications · Lesson 12 · 25 min read
Add vector retrieval
Query an actual LangChain vector store with preserved Qwen embeddings, refuse unrecorded inputs, and inspect scores without new model calls.
Building Agentic RAG Applications · Lesson 13 · 25 min read
Apply filters across retrievers
Apply one version policy to SQLite lexical and LangChain vector retrieval before top-k, and compare eligible candidates and post-filter underfill.
Building Agentic RAG Applications · Lesson 14 · 25 min read
Build hybrid retrieval
Combine native BM25 and preserved-vector retrieval with reciprocal rank fusion, inspect each contribution, and retain filtering and failure records.
Building Agentic RAG Applications · Lesson 15 · 25 min read
Rerank retrieved passages
Compare coverage, Gemini relevance and a pinned cross-encoder on frozen candidates, preserving passage identity and honest ranking limits.
Building Agentic RAG Applications · Lesson 16 · 25 min read
Compare retrieval configurations
Compare frozen lexical, vector, fused and coverage-reranked configurations on preserved development questions, with exact target mapping and retained misses.
Building Agentic RAG Applications · Lesson 17 · 25 min read
Choose chunk boundaries
Compare fixed-character, paragraph and heading-aware chunk boundaries on a synthetic developer document, with exact source spans and stable identity checks.
Building Agentic RAG Applications · Lesson 18 · 25 min read
Retrieve surrounding context
Expand explicit seed chunks into bounded source-local context windows, merge overlaps, and preserve section, revision and seed provenance before assembly.
Building Agentic RAG Applications · Lesson 19 · 25 min read
Assemble context within a token budget
Fit validated RAG windows into a complete templated request using the pinned local tokenizer, with whole-window admission, output reserve and failure records.
Building Agentic RAG Applications · Lesson 20 · 25 min read
Stream RAG answers
Compare preserved answer replay with actual Gemini SSE events, keep partial output provisional, and validate completion and context-bound source IDs.
Building Agentic RAG Applications · Lesson 21 · 25 min read
Handle conflicting documentation
Filter synthetic developer documentation by the requested version, compare explicit contract directives, and withhold answer requests when claims conflict.
Building Agentic RAG Applications · Lesson 22 · 25 min read
Add search and read tools
Expose bounded documentation search and passage reads, bind handles to a pinned corpus and exact request, and inspect provenance before accepting tool output.
Building Agentic RAG Applications · Lesson 23 · 25 min read
Refine queries with a scripted policy
Run a scripted retrieval controller that observes source passages, revises a query under an explicit rule, and retains its attempts and stopping reasons.
Building Agentic RAG Applications · Lesson 24 · 25 min read
Bound scripted retrieval runs
Bound a scripted retrieval run with action and source-byte admission checks, retain denied and failed attempts, and separate limits from task completion.
Building Agentic RAG Applications · Lesson 25 · 25 min read
Compare fixed, scripted and Gemini retrieval policies
Compare fixed, scripted and Gemini-selected retrieval policies on frozen questions, enforce tool limits, and retain invalid proposals and incomplete outcomes.
Building Agentic RAG Applications · Lesson 26 · 25 min read
Serve the RAG application with FastAPI
Serve the existing retrieval core through FastAPI, validate bounded requests, preserve source metadata and response hashes, and inspect local HTTP failures.
Building Agentic RAG Applications · Lesson 27 · 25 min read
Build a retrieval inspector
Build a same-origin retrieval inspector, verify response bytes and request identity before rendering, and inspect real loading, empty, limited and error states.
Building Agentic RAG Applications · Lesson 28 · 25 min read
Connect retrieval tools through MCP
Expose pinned documentation tools through an actual MCP stdio server, initialize an SDK client, preserve issued read handles and inspect real tool failures.
Building Agentic RAG Applications · Lesson 29 · 20 min read
Authorize collection searches
Resolve synthetic fixture identities, filter granted collections before top-k, and recheck issued passage handles before returning source text.
Building Agentic RAG Applications · Lesson 30 · 20 min read
Cache retrieval results
Cache completed retrieval sources with principal, policy, corpus and normalized-request binding, bounded TTL/LRU retention and explicit failure bypass.
Building Agentic RAG Applications · Lesson 31 · 25 min read
Trace RAG requests
Trace actual local retrieval executions with isolated context IDs, fixed-field redacted spans, bounded retention and reproducible failure diagnostics.
Building Agentic RAG Applications · Lesson 32 · 25 min read
Limit concurrent RAG requests
Bound active retrieval and waiting work in one process; inspect actual FIFO promotion, queue refusals, wait deadlines and cancellation-safe lease cleanup.
Building Agentic RAG Applications · Lesson 33 · 20 min read
Run RAG evals on an updated corpus
Compare fixed development retrieval cases across a synthetic corpus update, refuse stale target hashes, and retain deleted targets outside paired means.
Building Agentic RAG Applications · Lesson 34 · 25 min read
Evaluate scripted retrieval tasks
Evaluate deterministic retrieval policies with separate execution and source checks, exact target joins, repeated trials and an explicit fixture release gate.
Building Agentic RAG Applications · Lesson 35 · 25 min read
Release the RAG application
Stage the existing retrieval service locally, bind its files to a retained release identity, block failed task checks, and test artifact-pointer rollback.
Building Agentic RAG Applications · Lesson 36 · 35 min read
Build the developer knowledge assistant
Build a local docs assistant with a browser UI, CLI, versioned retrieval, collection permissions, cited answers and application 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 multi-turn user-simulated traces with agents-cli eval dataset synthesize, cluster losses with eval analyze, and diff runs with eval compare.
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 5 · 22 min read
Provision Terraform infrastructure and deploy with agents-cli
Separate Terraform infrastructure from code rollouts, validate Agent Runtime and Cloud Run rollouts with agents-cli deploy --dry-run, and inspect metadata.
Building, Evaluating, and Deploying Agents with Google Agents CLI · Lesson 6 · 20 min read
Publish to Gemini and configure agent observability
Register a deployed agent with Gemini Enterprise in ADK or A2A mode using agents-cli publish gemini, and query two-tier GCS and BigQuery telemetry.
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 using the existing eval runner
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 repeated-trial benchmark that records failures and incomplete runs
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
Build a paired comparison report with uncertainty and slice-level results
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
Build authentication and authorization boundaries for users and tools
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
Build a policy boundary for untrusted notes, tool outputs, and 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
Profile KV-cache work across serving workloads
Implement one causal attention layer, reuse previous keys and values, and compare equivalent outputs, counted work and local CPU timings.
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
Compute last-position logits for unequal-length prefixes in one padded tensor batch. Execute a focused local CPU experiment and inspect its raw result.
Building AI Systems · Lesson 20 · 30 min read
Inspect a direct preference optimization update
Align completion-token scores with their preceding prompt positions. Execute a focused local CPU experiment and inspect its raw result.
Building AI Systems · Lesson 21 · 30 min read
Run group-relative policy updates on sampled completions
Sample completions from a tiny CPU policy, compute group-relative rewards, and inspect clipped updates with fixed old scores and a frozen reference.
Building MLOps · Lesson 1 · 25 min read
Train a baseline model
Train a rice-variety classifier with stable data splits and training-only preprocessing. Compare it with a majority rule and investigate changed results.
Building MLOps · Lesson 2 · 20 min read
Measure the cost of prediction errors
Compare two classifiers on the same validation cases and show how explicit costs change the consequences of their errors.
Building MLOps · Lesson 3 · 25 min read
Choose evaluation splits
Split repeated-user observations by user, time or both. Choose evaluation windows that match the population your predictor will serve.
Building MLOps · Lesson 4 · 25 min read
Handle late data and delayed labels
Reconstruct the inputs available for each prediction. Account for late events and wait for outcome labels before assembling training rows.
Building MLOps · Lesson 5 · 25 min read
Validate incoming data
Validate an event batch, preserve rejected records and block the batch when parsing or schema checks fail. Inspect the rejection reasons.
Building MLOps · Lesson 6 · 25 min read
Build historical feature snapshots
Keep original and corrected feature values. Reconstruct historical training rows using only the values available at each prediction time.
Building MLOps · Lesson 7 · 25 min read
Check features before serving
Check whether a feature is available and recent enough, then compare historical and current reads using identical inputs.
Building MLOps · Lesson 8 · 30 min read
Version the data and feature contract
Tie dataset, schema and feature versions to their contents. Detect silent changes before computing feature values from the selected manifest.
Building MLOps · Lesson 9 · 25 min read
Capture the training configuration
Check whether a declared 300-epoch recipe would actually run for 300 epochs. Capture the inputs and Python runtime without launching training.
Building MLOps · Lesson 10 · 30 min read
Record and select a training run
Inspect a completed training run and verify its retained inputs, logs and results. Select its exact evaluation report without rerunning the trainer.
Building MLOps · Lesson 11 · 25 min read
Export a full-precision inference bundle
Keep the trained scaler and classifier together without rounding serving parameters. A local Rice-classifier lab with explicit failure checks.
Building MLOps · Lesson 12 · 25 min read
Gate a model candidate on validation results
Make a quality decision about the exact exported candidate using explicit count-based checks. A local Rice-classifier lab with explicit failure checks.
Building MLOps · Lesson 13 · 25 min read
Register and select a content-addressed model
Bind a local model selection to separately retained expected bytes. A local Rice-classifier lab with explicit failure checks.
Building MLOps · Lesson 14 · 25 min read
Serve a versioned predictor through batch and HTTP
Reuse one validated preprocessing and prediction function across two adapters. A local Rice-classifier lab with explicit failure checks.
Building MLOps · Lesson 15 · 25 min read
Shadow predictions without changing live responses
Route a request to the live model while recording a separate candidate prediction. A local executable Rice rollout and monitoring continuation.
Building MLOps · Lesson 16 · 25 min read
Route a sticky canary and compare cohort outcomes
Assign repeated caller IDs to a stable canary cohort with an explicit salt and allocation. A local executable Rice rollout and monitoring continuation.
Building MLOps · Lesson 17 · 25 min read
Roll back a model with feature-contract checks
Select a prior model by its retained digest, refuse incompatible feature contracts, and verify the local serving selection over actual HTTP.
Building MLOps · Lesson 18 · 25 min read
Distinguish schema, freshness and distribution signals
Validate event fields and feature values before considering freshness. A local executable Rice rollout and monitoring continuation.
Building MLOps · Lesson 19 · 25 min read
Join delayed outcomes and review retraining
Join finalized labels to predictions by identity rather than list position. A local executable Rice rollout and monitoring continuation.
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
Build a context assembler for instructions, history, tools, and retrieved passages
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
Build a 50-turn memory-compaction benchmark 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.