Skip to content

Hands-on course for building autonomous AI agents in Go: LLM fundamentals, tool/function calling, RAG, evals, multi-agent, safety, and observability

Notifications You must be signed in to change notification settings

kshvakov/ai-agent-course

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

63 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI Agent Course πŸ€–

Translations

  • English (EN) β€” main (this branch)
  • Русский (RU) β€” Russian version

Why This Course?

Welcome to a practical course on building autonomous AI agents in Go!

This course is designed for programmers who want to understand how modern LLM agents work "under the hood" and learn how to apply them to solve real-world problems.

Real-World Case Study

Situation: You've created a chatbot for DevOps. A user writes: "We have database issues, investigate"

Problem: A regular chatbot can only respond with text. It can't actually check metrics, read logs, or apply fixes.

Solution: An AI agent with tools can independently check metrics β†’ read logs β†’ form hypotheses β†’ apply fixes β†’ verify results. This course teaches you how to build such agents.

Theory

πŸ“š Required Reading Before Starting:

πŸ‘‰ HANDBOOK: Designing Autonomous AI Agents
A complete handbook with theory, examples from different domains (DevOps, Support, Data, Security, Product), diagrams, and practical advice. The handbook is divided into chapters for easy study.

What You'll Find in the Handbook:

  • LLM Physics β€” how the agent's "brain" works
  • Prompting as Programming β€” controlling behavior through prompts
  • Agent Architecture β€” components and their interactions
  • Tools and Function Calling β€” the agent's "hands"
  • Autonomy and Loops β€” ReAct Loop
  • Safety and Human-in-the-Loop β€” protection from dangerous actions
  • RAG and Knowledge Base β€” working with documentation
  • Multi-Agent Systems β€” a team of specialized agents
  • Evals and Reliability β€” testing agents
  • Real-World Case Studies β€” examples of successful agents
  • Best Practices β€” best practices for creating and maintaining agents

Advanced Study

If you want to transition from a "learning agent" to a "production agent," study Chapter 25: Production Readiness Index in the handbook.

There you'll find a practical guide to production readiness: observability and tracing, cost & latency engineering, workflow and state management, security and governance, prompt management, data/privacy, RAG in production, evals in CI/CD, and other practical topics with step-by-step implementation recipes tied to your code from the laboratory assignments.

How to Take the Course

Recommended Path:

  1. Read the handbook: Open book/README.md and study the theory. This will take 1-2 hours but will give you a fundamental understanding.

  2. Start with Lab 00: Check if your model is suitable for the course.

    cd labs/lab00-capability-check
    # Read MANUAL.md before starting
    go run main.go
  3. Complete labs in order:

    • Navigate to the lab folder (e.g., cd labs/lab01-basics)
    • Read MANUAL.md β€” this is a study guide with theory, algorithms, and common mistakes
    • Read README.md with the assignment
    • Open main.go, where the code skeleton is already written
    • Implement missing parts marked with // TODO comments
    • If stuck β€” check SOLUTION.md (but try yourself first!)
  4. Run and test: After each lab, run the code and verify it works.

Important: Each laboratory assignment has its own MANUAL.md β€” a study guide that you must read before starting. It contains:

  • Why this is needed (real-world case)
  • Theory in simple terms
  • Execution algorithm
  • Common mistakes and solutions
  • Mini-exercises
  • Completion criteria

Theory and Practice Connection:

  • After each handbook chapter, complete the corresponding laboratory assignment
  • Use the handbook as a reference when working on projects
  • Return to relevant sections when questions arise

Course Structure

The course consists of a preparatory stage (Lab 00) and 12 main laboratory assignments (Lab 01-12), plus 2 optional labs (Lab 13-14).

Diagnostics. Before starting, verify whether your model (especially a local one) is suitable for the course. Run a series of tests on JSON, Instruction Following, and Function Calling.

Basics and Memory. You'll learn how to programmatically communicate with LLMs, manage context (memory), and configure the agent's role through system prompts.

Function Calling. Learn how to turn Go functions into tools that an LLM can call. Implement the Tool Execution mechanism.

Infrastructure as Code Integration. Connect real APIs (Proxmox, Ansible) to your agent.

The Agent Loop. Implement the ReAct pattern (Reason + Act). The agent learns to independently make decisions, execute actions, and analyze results in a loop.

Dialogue and Safety. The agent will learn to ask clarifying questions ("In which region should I create the server?") and request confirmation before dangerous actions ("Are you sure you want to delete the database?").

Complex Scenarios. Create an agent capable of independently investigating and resolving failures (e.g., service crashes) using a toolkit of tools.

Working with Knowledge. The agent learns to read internal documentation (Wiki/Man pages) before executing actions. Implement simple document search.

Supervisor Pattern. Create a system where a main agent (Orchestrator) manages highly specialized sub-agents (Network Admin, DB Admin).

Context Window Management. Learn how to count tokens, apply optimization techniques (truncation, summarization), and implement adaptive context management for long-lived agents.

Workflow Patterns. Implement a simple workflow runtime: plan β†’ steps β†’ retries β†’ state persistence (in-memory/file).

Memory Systems. Long-term memory store + retrieval + policy (what to store/how to forget) + summarization.

Tool Servers. Minimal "tool server" (stdio or HTTP) + client in agent runtime + schema versioning.

πŸ“‹ Laboratory Assignments Table

Lab Topic Key Skills Study Guide
Lab 00 Capability Check Model testing. Unit tests for LLMs. MANUAL.md
Lab 01 Basics OpenAI API, Chat Loop, Memory Management. MANUAL.md
Lab 02 Tools Function definitions (JSON Schema), parsing ToolCalls. MANUAL.md
Lab 03 Architecture Go interfaces, Registry pattern, Mocking. MANUAL.md
Lab 04 Autonomy (ReAct) Think-Act-Observe loop. Result processing. MANUAL.md
Lab 05 Human-in-the-Loop Interactivity. Clarifying questions. Safety. MANUAL.md
Lab 06 Incident (SOP) Advanced planning. SOP integration in prompts. MANUAL.md
Lab 07 RAG Working with documentation. Knowledge search before action. MANUAL.md
Lab 08 Multi-Agent Orchestration. Task delegation. Context isolation. MANUAL.md
Lab 09 Context Optimization Token counting, summarization, adaptive context management. MANUAL.md
Lab 10 Planning & Workflow Task decomposition, dependency resolution, plan execution with retries. MANUAL.md
Lab 11 Memory & Context Engineering Long-term memory, fact extraction, context layering. MANUAL.md
Lab 12 Tool Server Protocol stdio/HTTP protocols, schema versioning, tool server architecture. MANUAL.md
Lab 13 Agent Security Hardening (Optional) Allowlists, risk scoring, prompt injection protection, audit. MANUAL.md
Lab 14 Evals in CI (Optional) Eval runner, golden dataset, CI pipeline integration. MANUAL.md

Requirements

  • Go 1.21+
  • Local LLM (recommended) or OpenAI API Key.
    • Install LM Studio or Ollama.
    • Start a local server (usually on port 1234 or 11434).
  • Docker (optional)

Environment Setup

To work with a local model (e.g., in LM Studio):

export OPENAI_BASE_URL="http://localhost:1234/v1"
export OPENAI_API_KEY="any-string" # Local models usually don't need a key, but it shouldn't be empty

Project Structure

ai-agent-course/
β”œβ”€β”€ book/               # Handbook on agent design (English)
β”‚   β”œβ”€β”€ 01-llm-fundamentals/
β”‚   β”œβ”€β”€ 02-prompt-engineering/
β”‚   β”œβ”€β”€ ...             # Other chapters
β”‚   └── README.md
β”œβ”€β”€ translations/       # Translations
β”‚   └── ru/             # Russian translation
β”‚       β”œβ”€β”€ README.md   # Russian README
β”‚       β”œβ”€β”€ book/       # Russian handbook
β”‚       └── labs/       # Russian labs
β”œβ”€β”€ labs/               # Laboratory assignments (English)
β”‚   β”œβ”€β”€ lab00-capability-check/
β”‚   β”œβ”€β”€ lab01-basics/
β”‚   └── ...             # Other labs
└── README.md           # This file

What's Next?

After completing the course, you'll be able to:

  • βœ… Create autonomous AI agents in Go
  • βœ… Manage agent context and memory
  • βœ… Implement Function Calling and tools
  • βœ… Create safe agents with Human-in-the-Loop
  • βœ… Apply RAG for working with documentation
  • βœ… Create Multi-Agent systems
  • βœ… Test and optimize agents
  • βœ… Implement planning and workflow patterns
  • βœ… Build memory systems and context engineering
  • βœ… Create tool servers with protocols

Happy Learning! πŸš€

About

Hands-on course for building autonomous AI agents in Go: LLM fundamentals, tool/function calling, RAG, evals, multi-agent, safety, and observability

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published