Skip to main content

Session 01 · Building AI applications for research and data

90 minutes of slides and guided notebook demonstrations, followed by 15 to 30 minutes of questions.

The preface explains the problem addressed in the session and the ideas developed in its notebooks. It also describes how readers with different backgrounds and levels of technical experience can use the session.

Who it is for​

Two audiences at once:

  • Colleagues who will build AI applications and want to see each capability added to a working application, with code they can rerun.
  • Colleagues who commission, oversee, or evaluate such applications and need to know what each capability is for, what it costs, and how to tell whether the result is reliable.

Participants need no prior experience with language-model APIs. The notebooks run without an API key.

What participants can do afterwards​

  • Describe the components of an AI application and say which problem each one solves: instructions and context, prepared knowledge, retrieval, structured outputs and tools, workflows and agents, and verification.
  • Given a research or data question, choose an architecture and say what evidence would show that it works.
  • Rerun the six notebooks, change the question or the documents, and read the verifier's marks and the retrieval checks.

The worked example​

One question runs through the whole session:

How have internet access and economic development evolved in Rwanda and Kenya? Compare the recent available data, summarize the main patterns, and cite the sources.

The application starts as a model answering from its training data. Notebook by notebook it gains supplied context, a prepared corpus of documents, retrieval, structured outputs, a tool that queries authoritative indicator data, a bounded workflow that chooses between tools, and a verifier that checks every number in its answer against the data. The data are World Development Indicators values for Kenya and Rwanda retrieved from the World Bank API on 13 October 2026; the documents are short briefs written for the workshop from those values, plus one outdated summary and two distractors. See assets/README.md.

Four problems are planted so that each capability has a reason to exist: an ambiguous question, an irrelevant retrieval result, a request for data that does not exist, and a numerical claim that no source supports.

Timing​

SegmentSlidesDemonstrationMinutesNotebook
Introduction and the baseline application641001
Context, data, and metadata preparation781501, 02
Retrieval and retrieval-augmented generation5101503
Structured outputs and tools5101504
Workflows and agents5101505
Grounding and verification461006
Data360 Chat and questions5510demo
Total375390

Questions are taken at the notebook transitions as well as at the end. Notebooks 02 and 03 are demonstrated from one file to avoid a switch; they are distributed separately.

Open the notebooks in Colab​

NotebookOpen in Colab
01 · From a language model to an applicationOpen
02 · Preparing knowledge for an applicationOpen
03 · Retrieval-augmented generationOpen
04 · Tools and structured outputsOpen
05 · Workflows and agentsOpen
06 · VerificationOpen
07 · Lab: chat with your documentsOpen

Each notebook ends with a link to the next. Notebook 07 runs a small open model, so choose Runtime > Change runtime type > T4 GPU before you run it.

The eight documents of the worked example, with their metadata, their role in the session, and the chunks that notebook 02 makes of them, are shown on the Document collection page of the docs site. The page is generated from assets/documents/ when the site is built.

Materials​

DeliverableWhereState
Worked-example assets: question, documents, indicator data and metadata, evaluation questions, recorded model outputsassets/Drafted
Six notebooks with explanatory text, runnable code, cached outputs, and one exercise eachnotebooks/Drafted; outputs cached in fallback mode
A lab notebook (07) in which participants chat with their own documents, with a small open model that runs in Colabnotebooks/07-lab-chat-with-your-documents.ipynbDrafted; needs a Colab run on a CPU and a GPU runtime
Shared module the notebooks import: the worked-example data and tool, a recorded-output chat model, printing and evaluation helpers; the indicator MCP servernotebooks/workshop.py, notebooks/indicator_server.pyDrafted
Slide deck, about 22 slides, with the outline as reviewable textslides/Drafted
Data360 Chat demonstration: pretested queries and a fallbackdemo/Drafted; queries to pretest on the live application
Participant resources: setup, glossary, test questions, next stepsresources/Drafted

Technical choices​

Popular libraries wherever one exists, so that what participants learn transfers to their own work:

NeedLibrary
Documents, splitting, embeddings, vector store, prompts, tools, structured outputLangChain (langchain-core, langchain-text-splitters, langchain-huggingface, langchain-openai)
The agent loop, with a recursion limit and a traceLangGraph, through langchain.agents.create_agent
The tool server and client over the Model Context ProtocolFastMCP
Number verificationpcn-core, the Python core of the program's Proof-Carrying Numbers
Output schemasPydantic
Chat modelChatOpenAI over any OpenAI-compatible API, configured by WORKSHOP_API_KEY, WORKSHOP_BASE_URL, WORKSHOP_MODEL

What workshop.py adds: the worked-example data and the indicator tool over it (the committed CSV by default, the World Bank API on request), a chat model that replays recorded outputs when no key is configured, and printing and evaluation helpers. Embeddings come from a small sentence-transformer model downloaded on first use. Notebook 04 also lists the tools of the public Data360 MCP server and runs one search, guarded so that the session does not depend on the network.

Source files​

The session's slides, demonstration script, worked-example files, and notebook sources are in the session folder on GitHub.