Module Overview
This module covers the foundations of agentic systems: reliably structuring and validating model outputs, the mechanics of function calling across providers, and the Model Context Protocol that standardises how tools are exposed to and consumed by agents.
Learning Objectives
- Validate and structure agent outputs with Pydantic.
- Design function schemas and explain the request-response lifecycle.
- Use parallel calls and constrained tool choice, and contrast structured output with function calling.
- Build a provider-agnostic tool executor loop.
- Explain MCP architecture, primitives, transport, and trust boundaries.
Topics Covered
Pydantic — Data Validation & Structured Outputs
- Installation, models, fields, validators
- JSON parsing and type coercion
- Dataclasses and nested models
- Validation decorators and custom validators
- Settings management
Function Calling Fundamentals
- Why function calling exists — the LLM-to-tool communication problem
- Function schema design — JSON Schema, descriptions, parameter typing
- The function-calling request-response lifecycle
Parallel Calls, Constrained Choice & Structured Output
- Parallel function calling — multiple tool calls in one response
- Forced and constrained tool choice — required, none, and specific tool selection
- Structured output vs function calling — differences and when to use each
Tool Executor Loop & Cross-Provider Support
- Building a tool executor loop from scratch
- Function calling across providers — OpenAI, Anthropic, Google — and the universal contract
MCP (Model Context Protocol)
- Why MCP exists — the tool fragmentation problem
- MCP architecture — hosts, clients, and servers
- MCP primitives — tools, resources, and prompts
- MCP transport layer — stdio and SSE
- Building an MCP server and client
- MCP security — authentication, authorization, and trust boundaries
- MCP in production — multi-server orchestration
Key Concepts & Terminology
Schema-constrained generation, type coercion, tool executor loop, universal tool contract, MCP host/client/server, stdio vs SSE transport, trust boundary.
Tools & Frameworks Referenced
Pydantic, OpenAI/Anthropic/Google function-calling APIs, Model Context Protocol (MCP), FastMCP.
Prerequisites
Module 15 (LangChain) helps; general LLM application experience.