- English (EN) β
main(this branch) - Π ΡΡΡΠΊΠΈΠΉ (RU) β Russian version
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.
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.
π 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
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.
Recommended Path:
-
Read the handbook: Open
book/README.mdand study the theory. This will take 1-2 hours but will give you a fundamental understanding. -
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
-
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.mdwith the assignment - Open
main.go, where the code skeleton is already written - Implement missing parts marked with
// TODOcomments - If stuck β check
SOLUTION.md(but try yourself first!)
- Navigate to the lab folder (e.g.,
-
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
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.
| 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 |
- Go 1.21+
- Local LLM (recommended) or OpenAI API Key.
- Docker (optional)
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 emptyai-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
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! π