Build an agent framework from scratch, in Go, on purpose
A twelve-chapter tutorial that teaches backend engineers how agents actually work by making them write one themselves.
What it does
BabyAgent is a teaching repo, not a framework. It walks Go backend developers — no LLM background assumed — through building an agent layer by layer: raw chat/completions calls and SSE parsing first, then Function Calling, the ReAct loop, MCP, context engineering, memory, RAG, guardrails, and finally observability and automated evals. Every chapter ships runnable code, and the README is refreshingly blunt that this is not production-ready and shouldn’t be forked into your product.
The interesting bit
The curriculum order is the value. Instead of starting with a framework that hides the mechanics, chapter one peels back the SDK to raw HTTP so you see what a model call actually is. Later chapters tackle the parts most tutorials skip — context truncation/offloading/summarization strategies, a two-layer memory system, and Docker-sandboxed tool execution with human-in-the-loop confirmation.
Key highlights
- Twelve chapters, all with runnable code, from raw HTTP to LLM eval pipelines with mock models
- Covers MCP integration, Agentic RAG (pgvector, embedding, rerank), and a skills-as-prompts plugin system
- Full observability chapter: Trace/Span model, first-token latency, tokens-per-minute, OpenTelemetry + Grafana
- Ch10 turns the CLI agent into an HTTP service with SSE streaming and SQLite-backed tree-shaped conversation history
- Uses a forked
openai-goSDK with nativereasoning_contentsupport, wired in via a singlego.modreplace
Caveats
- Explicitly not production-grade; the authors position it as a principles reference and prototyping starting point
- Requires Go 1.25+, an LLM API key, and for ch07 a PostgreSQL + pgvector setup plus embedding/rerank services
- The README is in Chinese; no English translation is mentioned
Verdict
If you’re a backend engineer who wants to understand agents from the metal up — and prefers Go’s type system to Python’s ecosystem — this is one of the more honest curricula out there. If you want a drop-in agent framework, this is deliberately not that.
Frequently asked
- What is baby-llm/baby-agent?
- A twelve-chapter tutorial that teaches backend engineers how agents actually work by making them write one themselves.
- Is baby-agent open source?
- Yes — baby-llm/baby-agent is open source, released under the Apache-2.0 license.
- What language is baby-agent written in?
- baby-llm/baby-agent is primarily written in Go.
- How popular is baby-agent?
- baby-llm/baby-agent has 500 stars on GitHub.
- Where can I find baby-agent?
- baby-llm/baby-agent is on GitHub at https://github.com/baby-llm/baby-agent.