
Setup presentation,
If you have already set up the environment for the Generative AI Certification course, you have likely already run the demos for this chapter. The repository content may have changed in the meantime, but the same data and code assets are used.
Databricks Free Edition
A short onboarding introduction to the Databricks Free Edition, launched in June 2025.
Connect GitHub to Databricks
This hands-on connects a GitHub repository to the Databricks workspace in three steps — generating a GitHub personal access token with repo scope, linking it to Databricks, and importing the repository as a Git folder to enable full version control from the workspace.
Get a Claude API key
This session describes how to create the API key for the Claude model used in the hands-on.
Create & Manage LLM Credentials
This hands-on securely stores LLM API keys in Databricks using the SDK — creating a secret scope, adding API keys that can be referenced in code without ever exposing the actual value, and verifying the setup confirms that Databricks automatically redacts secret values in all outputs and logs by design.
Create a Claude Serving Endpoint
This hands-on creates a production-ready external model endpoint for Claude Sonnet 4.5 using the MLflow Deployments SDK — configuring the endpoint name, deploying it programmatically before testing it in the AI Playground.
Create PDF Volume
This hands-on sets up the Unity Catalog data infrastructure for the RAG application — creating a governed Volume, and copying our knowledge-base PDFs (product catalog, return policy, shipping guide, technical FAQ) from the project GitHub repository, making them immediately available for the RAG pipeline.
Create Feature table from CSV
This hands-on loads e-commerce CSV files (customers, orders, order items, products, shipping zones) from GitHub into a Unity Catalog Volume, then transforms each into a production-ready Unity Catalog feature table, with schema, description, and lineage metadata visible in the Data Explorer.
What is context engineering ?
At Anthropic, they define it as the set of strategies for curating and maintaining the optimal set of tokens during LLM inference — in other words, everything that lands in the model's input, not just the prompts you write.
Unity Catalog
Unity Catalog is the unified governance layer built into Databricks.
MLflow
MLflow is an open-source platform for developing models and generative AI applications. It's a revolutionary tracing & evaluation tool for agents.
Simple LLM Chain with MLflow Tracing
This Databricks hands-on illustrates MLflow tracing on a simple llm chain. The "auto_log" function automatically records inputs, system prompt, response, and execution time as structured traces — then retrieves those in the MLflow UI.
Lakebase
Lakebase is a fully managed Postgres OLTP database, integrated with the lakehouse. In this session, we will discover its properties before using it as memory substrate for the agents in the fourth chapter.
Build agent.
In this session, we are building a single agent from beginning to end — watching it be designed, configured, pushed into production, and then slowly break. And then we're going to fix it. The agent is a contract review system built on Databricks.
Failure modes & context strategies.
In this new session, We're going to look at the specific ways agents fail when context is mismanaged, classify failure modes, and then work through the full set of strategies that exist to prevent or recover from each one.
Hands-on Context confusion : (16/09/2026)
This notebook tests how tool-catalog "noise" affects an LLM's tool-selection accuracy, comparing 5 relevant MCP tools alone versus buried among 50 irrelevant ones.
It shows the resulting confusion stems from attention dilution across schemas, not from context-window capacity.
Prompt
This presentation covers how to interact with an LLM through prompts — from the basics of the OpenAI message format, prompt templates, and the six prompt types, through to advanced techniques like few-shot in-context learning, chain-of-thought reasoning.
Few shot selection
In this hands-on, we're tackling few-shot example selection — picking the right demonstration examples for a Databricks SQL agent.
Given a pool of candidate shots, we'll evaluate each one against coverage criteria and select the smallest set that actually boosts the agent's performance — without bloating our token budget.
Genie Agent
This hands-on builds and optimises a natural-language assistant :
first creating the Genie space connected to five Unity Catalog business tables, testing it with a simple customer lookup.
then enriching metadata by AI-generating column descriptions for each table and adding conifguration instructions; then testing the enriched agent with dedicated queries.
Natural langage queries :
`Can you provide details for customers with the last name 'Smith'?`
`What is the distribution of the amounts of orders ?`
`Can you provide details for customers with the last name 'Smith'?`
Text instruction :
When users ask about customers, always refuse to include the registration_date in the response for privacy policy reasons.
Query instruction :
NL : 'What is the distribution of the amounts of orders ?`
SQL
SELECT
COUNT(*) AS order_count,
MIN(`total_amount`) AS min_amount,
MAX(`total_amount`) AS max_amount,
ROUND(AVG(`total_amount`), 2) AS avg_amount,
ROUND(STDDEV(`total_amount`), 2) AS std_amount
FROM
`demo`.`demo`.`orders_feature`
WHERE
`total_amount` IS NOT NULL
Token tradeoff
In this hands-on, we're digging into the token cost versus performance tradeoff — when a longer, more elaborate prompt actually earns its keep, and when it's just burning tokens for no real gain.We've got experiment tracking results comparing different versions of a system prompt, and we need to decide whether the higher-token setup is justified — and pin down exactly which prompt element is driving the cost-performance tradeoff.
RAG
RAG is a powerful technique that combines large language models with real-time data retrieval to generate more accurate, up-to-date, and contextually relevant responses.
RAG Workflow & Unstructured Data Pipeline
This presentation maps the full RAG workflow — showing how an unstructured data pipeline (corpus ingestion, parsing, metadata enrichment, deduplication, chunking, embedding, and indexing) feeds the RAG chain through two linking components — the embedding model and the vector store index — while noting that multimodality, evaluation, and governance complete the production picture.
Chunking
This presentation explains why chunking — splitting documents into smaller text units — is a critical RAG design decision, then walks through strategies from fixed-size splitting with overlap and recursive character splitting, to advanced semantic chunking (grouping sentences by meaning) and LLM-powered approaches like IBM Docling and the Databricks `ai_parse_document` function, each offering different trade-offs between simplicity, retrieval quality, and compute cost.
Vector Search
This presentation explains the distinction between a vector index (the HNSW-based search structure) and a vector database (the full data management system with CRUD, metadata filtering, governance, and horizontal scaling), then details Mosaic AI Vector Search's three index types — Delta Sync with Databricks-managed embeddings (auto-sync, auto-embedding), Delta Sync with self-managed embeddings (you supply pre-computed vectors), and Direct Vector Access (manual sync via REST API for maximum cost control) — across two endpoint tiers: standard (320M vectors, automated scaling) and storage-optimized (1B+ vectors, 10–20x faster indexing at 250ms latency).
Genie space curation
This hands-on documents and queries the actual "customer genie" space built in last chapter, exactly as curated in the walkthrough:
five managed tables, AI-generated column descriptions, one text instruction, three join relationships, one example SQL query, and three benchmark questions.
UC metadata diagnosis
In this hands-on, we're diagnosing UC table and column metadata, looking at how the way you document your data affects how well a text-to-SQL agent performs.
RAG pipeline and Chunking
In this hands-on, we're going to build out a RAG pipeline from the ground up — designing a chunking strategy, comparing parsing approaches.
Vector Search diagnosis
In this hands-on, we're diagnosing vector search retrieval quality — figuring out why a Databricks agent pulls back the wrong context, and how to fix it
Memory architecture
Short-term memory lives as per-session thread checkpoints; long-term memory as a durable key-value store of extracted facts — both in Lakebase. One managed Postgres database underlies every stateful Databricks agent.
Memory Retrieval Quality & Context Integrity
In this session, we will cover the memory retrieval mechanism, compare pgvector and Databricks Vector Search, discover failures modes and their solution.
Create lakebase endpoint
In this hands-on session, we will create a new autoscaling postgres lakebase Endpoint instance on a development branch.
Short memory agent
This hands-on shows how to give an AI agent durable, thread-based **short-term memory** using **Databricks Lakebase** — a fully managed Postgres database — as the agent's checkpoint store.
Agent Tools
This presentation covers the full landscape of agent tools on Databricks — Unity Catalog SQL functions for predictable structured queries, Genie multi-agent systems for dynamic natural-language SQL, vector search retrieval tools for unstructured data, and the Model Context Protocol (MCP) as the emerging universal standard — distinguishing between managed MCP servers (pre-configured access to Genie, Vector Search, and UC Functions), external MCP servers (third-party services like GitHub or Slack secured via Unity Catalog OAuth proxies), and custom MCP servers hosted as Databricks Apps.
Agent Tools
This hands-on creates and registers two types of agent tools :
SQL functions that queries the e-commerce table, automatically registered via CREATE OR REPLACE FUNCTION and a Python function, registered via DatabricksFunctionClient.
verifying both in the Unity Catalog Data Explorer, and validating tool-calling behaviour interactively in the AI Playground.
Connect GitHub to Databricks with Managed OAuth :
In this hands-on, we set up the GitHub MCP server on Databricks using Managed OAuth — no personal access token to create, no OAuth app to register.
Databricks handles all authentication flows and token refresh for you through Unity Catalog.
What you'll learn
How to create a shared connector with OAuth User to Machine Per User auth
How to test GitHub tools live in the AI Playground
Elements used in this video
Comment:
"A list of tools available to interact with GitHub through an MCP server"
Playground test questions
"List all the repositories in my GitHub account and tell me which one was updated most recently."
"For my user and the databricks_genai_demo repo, can you count the commits per week over the last month?"
Progressive Disclosure (MCP):
In this hands-on, we're connecting to a real external MCP server — the GitHub MCP server — through the Databricks AI Gateway.
And the whole thing breaks down into three stages:
discovery, where the model only sees tool names and one-line summaries;
planning, where we load full schemas just for the tools it shortlisted;
and execution, where we run the tool and the schemas get evicted from context.
Agent layered mcp
This is a reading of the scirpt used to define the agent used in the Progressive Disclosure.
Context pruning.
In this hands-on, we are going to use the provence model to demonstrate the pruning concept on set of conversations.
What is compaction ?
An agent that runs for a long time fills its context window turn after turn.
The number of tokens increases, but more context doesn't necessarily mean better understanding.
A solution to prevent the number of tokens from exceeding the attention threshold is compaction.
Compaction
In this hands-on, we're walking through compaction — a technique for managing long conversations.
Here's the core idea: when a conversation gets long, you write a summary of it and restart the assistant from that summary.
The real skill is choosing what to keep and what to throw away.
Multi-agent Failures
In this session we're going to look at what happens when multiple agents need to coordinate, share state, and produce coherent outputs together.
We will work through four concrete failure scenarios. Each one has a diagnosis and a fix. And each one maps directly to an exam objective.
Dispatch Failure
we're tackling dispatch failure in a multi-agent system. The scenario is a classic one: a coordinating agent decomposes a task and sends sub-agents individual task messages instead of the full context. We'll illustrate that failure and find the fix — without ballooning each sub-agent's context window.
This course contains the use of artificial intelligence.
Welcome to this Databricks Context Engineering certification preparation course!
For this course, I chose to work with the Databricks Free Edition, a free version accessible to everyone. While it doesn't include features still in beta, I keep it regularly updated. The course blends theoretical presentations with hands-on workshops, both local and on Databricks, illustrating key concepts, all grouped together in a GitHub project.
Context engineering is the discipline of curating and maintaining the optimal set of tokens during LLM inference — everything that lands in the model's input, not just the prompts you write. In this course, we'll cover the full landscape: understanding what context engineering is and why it determines whether an agent works or fails.
This course is aimed at developers who have already built AI applications using frameworks such as LangChain or LangGraph. If you have a working knowledge of Python and SQL, and want to master every dimension of what your agents see, retrieve, remember, and act on — then validate those skills through the Databricks Certified Context Engineer Associate certification — this course is for you.
If this is what you're looking for, I invite you to join us. I hope you'll enjoy exploring all these concepts as much as I did — happy learning!