MoFA Tutorial: From Zero to Agent Builder
Notice: This tutorial was primarily generated by Claude Code and is pending review by MoFA architect @lijingrs. Content may be updated as the review progresses.
Welcome to the MoFA (Modular Framework for Agents) tutorial! This guide is designed for Google Summer of Code students and anyone who wants to learn how to build AI agents with Rust using MoFA’s microkernel architecture.
What You’ll Learn
By the end of this tutorial, you’ll understand MoFA’s architecture and be able to build, extend, and orchestrate AI agents confidently.
| Chapter | Title | Time | What You’ll Build |
|---|---|---|---|
| 01 | Introduction | ~20 min | Mental model of MoFA’s architecture |
| 02 | Setup | ~15 min | Working dev environment |
| 03 | Your First Agent | ~45 min | A GreetingAgent from scratch |
| 04 | LLM-Powered Agent | ~45 min | A streaming chatbot with memory |
| 05 | Tools & Function Calling | ~60 min | Agent with calculator & weather tools |
| 06 | Multi-Agent Coordination | ~45 min | Chain & parallel agent pipelines |
| 07 | Workflows with StateGraph | ~60 min | Customer support workflow |
| 08 | Plugins & Scripting | ~45 min | Hot-reloadable Rhai content filter |
| 09 | What’s Next | ~15 min | Your contribution roadmap |
Total estimated time: 4-6 hours
Prerequisites
- Rust (1.85+): Install via rustup
- An LLM provider (one of):
- OpenAI API key (
OPENAI_API_KEY), or - Ollama running locally (free, no API key needed)
- OpenAI API key (
- Git: For cloning the repository
- Basic familiarity with a terminal
New to Rust? Don’t worry. Each chapter includes “Rust tip” sidebars that explain key language concepts (traits, async/await,
Arc) as they come up. You don’t need to be a Rust expert to follow along.
Quick Links
- QuickStart Guide - Get running in under 10 minutes
- Architecture Reference - Deep architecture documentation
- Contributing Guide - How to contribute to MoFA
- Security Guide - Security best practices
- SDK README - SDK API reference
How to Use This Tutorial
- Follow the chapters in order - each builds on the previous one
- Type the code yourself - don’t just copy-paste (you’ll learn more)
- Run every example - seeing output builds intuition
- Read the “Architecture note” callouts - they connect code to design decisions
- Check the linked source files - real code is the best documentation
Ready? Let’s start with Chapter 1: Introduction.
English | 简体中文