Course outline▾
Week 1 · The Foundations
- Day 1Demystifying AI — From Buzzword to Business Logic
- Day 2How Machines Actually Learn — Supervised, Unsupervised and Reinforcement Learning
- Day 3Inside Neural Networks — The Engine of Modern Deep Learning
- Day 4The AI Project Lifecycle — From Raw Data to Production Deployment
- Day 5The Math Behind the Magic — Why Linear Algebra and Probability Matter
- Day 6Data Preprocessing — Cleaning the Messy Reality of Enterprise Data
- Day 7Measuring Success — Understanding Accuracy, Precision, Recall and F1 Scores
Week 2 · Applied AI & APIs
- Day 8Introduction to LLMs & The Modern AI API Landscape
- Day 9Advanced Prompt Engineering — Few-Shot, Chain-of-Thought and Structured JSON
- Day 10Tokenization, Context Windows and Cost Optimization
- Day 11Embeddings and Vector Representations — How Machines Map Meaning
- Day 12Vector Databases — Storing and Searching Enterprise Knowledge
- Day 13Retrieval-Augmented Generation (RAG) — Chatting with Proprietary Documents
- Day 14RAG Evaluation and Hallucination Guardrails
Week 3 · Infrastructure & Hosting
- Day 15Introduction to AI Infrastructure — Hardware, Runtimes and Compute
- Day 16Local Model Execution — Running Open-Weight LLMs Securely with Ollama and vLLM
- Day 17Containerizing AI Workloads — Production Dockerfiles for Python APIs
- Day 18Docker Compose for Multi-Container AI Stacks
- Day 19Kubernetes for AI 101 — Pods, Deployments and Services for Model Serving
- Day 20Persistent Storage in Kubernetes — Managing State, Weights and Vector Indices
- Day 21High-Performance Networking — Ingress and Egress for AI Clusters
Week 4 · Enterprise Workflows
- Day 22Autonomous Agents — From Passive LLMs to Goal-Driven Execution
- Day 23Tool Use and Function Calling — Connecting LLMs to APIs, Databases and Shells
- Day 24Multi-Agent Orchestration: Supervisor, Worker, and Evaluator PatternsComing soon · 2026-10-24 · 7 PM IST
- Day 25Automated CI/CD: Automating the Software Lifecycle for AI ModelsComing soon · 2026-10-25 · 7 PM IST
- Day 26Zero-Trust Security for AI: Sandboxing Ephemeral Execution & Model EgressComing soon · 2026-10-26 · 7 PM IST
- Day 27Observability & Tracing for Agentic Systems (Telemetry, Logs, and Metrics)Coming soon · 2026-10-27 · 7 PM IST
- Day 28Human-in-the-Loop Architecture: Machine Second, Human First in PracticeComing soon · 2026-10-28 · 7 PM IST
- Day 29Managing Technical Debt, Drift, and Model Governance in Enterprise ITComing soon · 2026-10-29 · 7 PM IST
- Day 30The 10-Year Horizon: Architecting IT Strategy for the AI-Native EnterpriseComing soon · 2026-10-30 · 7 PM IST
Day 23: Tool Use and Function Calling — Connecting LLMs to APIs, Databases and Shells
2026-10-23 · 8 min read
Watch the video lesson, or subscribe on YouTube for a new lesson every day.
By default a language model is an isolated reasoning engine. It cannot read the current time, query your private database or run a command. Function calling, also called tool use, is the bridge that connects that engine to real systems, so the model becomes a router that decides what to call while your software does the calling.
In plain terms: The model is a manager who can write instructions but cannot touch anything. It hands a clear, structured request to an assistant (your application), who does the task and reports back.
The four-step protocol
A common misconception is that the LLM runs the code. It does not. Function calling is a deterministic, four-step exchange.
- Declare the tools. Your application sends the model a list of tools described with JSON schemas: the name, what it is for and its typed parameters.
- Model invocation. If the question needs outside data or an action, the model replies with a structured tool call (the function name and exact arguments) instead of ordinary text.
- Client-side execution. Your application intercepts that reply, validates it and runs the real code: a SQL query, a REST call, a script.
- Observation injection. Your application sends the result back as a tool message, and the model uses it to finish its answer.
Type safety and validation
Free text breaks software pipelines. Use structured arguments and validate them with JSON Schema or a library such as Pydantic, so a malformed value is rejected before it reaches your backend. Then add checks the model cannot override: an allow-list of tools and a permission check for the current user.
Here is the loop with an OpenAI-compatible API. Ollama and vLLM from Day 16 expose the same interface, so the pattern works with a local model too. It assumes a model that supports tool calling, and get_gpu_status is a stand-in for your own function.
import json
from openai import OpenAI
from pydantic import BaseModel
client = OpenAI() # or OpenAI(base_url="http://localhost:11434/v1", api_key="x")
class GpuArgs(BaseModel): # type-safe arguments
node: str
def get_gpu_status(node: str) -> dict:
return {"node": node, "status": "degraded"} # replace with a real lookup
TOOLS = [{"type": "function", "function": {
"name": "get_gpu_status",
"description": "Returns GPU health for a node",
"parameters": GpuArgs.model_json_schema(),
}}]
ALLOWED = {"get_gpu_status": (GpuArgs, get_gpu_status)}
messages = [{"role": "user", "content": "Is gpu-07 healthy?"}]
reply = client.chat.completions.create(model="gpt-4o-mini", messages=messages, tools=TOOLS)
msg = reply.choices[0].message
if msg.tool_calls:
messages.append(msg)
for call in msg.tool_calls:
schema, fn = ALLOWED[call.function.name] # allow-list
args = schema.model_validate_json(call.function.arguments) # validate
result = fn(**args.model_dump()) # execute
messages.append({"role": "tool", "tool_call_id": call.id,
"content": json.dumps(result)}) # observation
final = client.chat.completions.create(model="gpt-4o-mini", messages=messages)
print(final.choices[0].message.content)
Restricting the model to proposing structured arguments keeps execution under your control: authenticated, validated and logged inside your own application.
Coming Up Next
Day 24: Multi-agent orchestration: supervisor, worker and evaluator patterns.
#FunctionCalling #ToolUse #APIs #Pydantic #SoftwareArchitecture