COURSE · BLD · B015

Introduction to AI Agents

Learn introduction to ai agents through RunLocalAI's practical lens: agents, tools, function calling and react, hardware fit, runtime settings, verification habits and local-vs-cloud tradeoffs.

16 chapters8hBuilder trackBy Eruo Fredoline
PREREQUISITES
  • B002
  • B011

Course B015: Introduction to AI Agents

Why this course exists

Large language models alone can generate text, but they cannot interact with the world. They cannot check the weather, look up stock prices, run calculations, or read files on your filesystem. When you need an AI system that actually does things—not just talks about things—you need an AI agent.

This course solves the problem of bridging the gap between text generation and real-world action. Students learn to build systems where an LLM drives a loop of reasoning, decision-making, and tool execution. The course covers local inference with Ollama and vLLM, function calling protocols, tool definition, multi-tool orchestration, memory management, planning, error recovery, and evaluation.

By the end, students build a working research assistant that can search the web, summarize findings, and produce structured reports—all running locally on their own hardware.

What you will know after

  • Build a ReAct agent loop that reasons about tasks and calls tools in sequence
  • Define tools using OpenAI-compatible JSON schemas and integrate them with local models
  • Implement function calling in Ollama and vLLM using guided decoding
  • Manage conversation history and working memory to support multi-turn interactions
  • Design agents that plan, decompose tasks, recover from errors, and self-evaluate
CHAPTERS
  1. 01What is an AI Agent?An AI agent is an LLM running inside a reasoning-action loop, extending itself with tools to gather information and act in the real world.15 min
  2. 02Agent ArchitectureSeparating the orchestrator, tool layer, and memory plane makes it possible to swap each component independently and test them in isolation.15 min
  3. 03ReAct PatternReAct grounds reasoning in real observations by explicitly interleaving thought traces with tool calls and feedback loops.15 min
  4. 04Tool DefinitionThe tool description is the only ground truth the model has about when and how to use a tool. Write descriptions like you are writing documentation for a junior developer.15 min
  5. 05Function Calling in OllamaOllama's tool calling is an API-level feature. The server dispatches the model-generated calls to the client, which is responsible for execution and feeding results back into the next turn.20 min
  6. 06Function Calling in vLLMvLLM's guided decoding backend guarantees structured output at the cost of generation speed. Use it when reliable tool calling parsing matters more than token throughput.20 min
  7. 07Building a Web Search ToolRate limiting prevents API bans and ensures the agent degrades gracefully under load. Always wrap external HTTP calls in timeout blocks to prevent hanging.20 min
  8. 08Building a Calculator ToolSafe evaluation is non-negotiable. Never allow arbitrary Python execution from model output. Whitelist functions and block `__import__`, `eval`, `exec`, and attribute access to prevent code injection.15 min
  9. 09Multi-Tool AgentsMulti-tool agents require clear tool descriptions so the model can route tasks correctly. Parallel execution speeds up multi-tool calls but adds complexity to result handling.15 min
  10. 10Agent MemoryMemory is not just the conversation transcript. It includes compressed summaries, structured facts, and session state. Without active memory management, context windows fill up and older relevant facts become inaccessible.20 min
  11. 11Conversation HistoryConversation history is a resource with a hard limit. Use hierarchical memory to manage long sessions while preserving the most relevant information for each reasoning step.20 min
  12. 12Agent PlanningPlanning adds an initial reasoning overhead but prevents the agent from making impulsive tool calls in complex multi-step tasks. Combining planning with revision makes agents resilient to mid-execution surprises.20 min
  13. 13Task DecompositionTask decomposition converts overwhelming goals into manageable executables. Recursive decomposition handles complexity at depth, and dependency tracking ensures subtasks receive the information they need.20 min
  14. 14Error RecoveryError recovery is not optional in production. Wrap every tool call in retry logic, parse errors carefully, and build circuit breakers to prevent cascading failures from taking down the system.20 min
  15. 15Agent EvaluationAgent evaluation combines task completion checks (did it work?) with behavioral logging (how did it work?). Both are necessary—passing a result check while making 50 unnecessary tool calls signals a reasoning problem even if the final answer is correct.20 min
  16. 16Agent Project: Research AssistantThe research assistant demonstrates the full agent lifecycle: planning, multi-tool orchestration, memory management, and evaluation. Each chapter feeds into this project, and each extension connects back to a specific concept.20 min