Agent Build智能体搭建 Tutor教程
Platforms各平台 / Self-hosted自托管

Another machine

The labs are plain Python. On a second machine you clone the repository, point two environment variables at a model endpoint, and use the operating system's own supervisor.lab 都是纯 Python。在第二台机器上,你只需克隆仓库、把两个环境变量指向模型端点,并使用操作系统自带的进程守护。

What you own归你负责的

Everything.全部。

What the platform runs由平台运行的

Nothing. The operating system supervises processes.没有。进程由操作系统守护。

Build steps搭建步骤

01Run the labs offline first先离线运行 lab

Do this操作

  1. Clone the repository and run every lab against the fake model.克隆仓库,用假模型运行所有 lab。
  2. This proves the Python environment before any model is involved.这一步在涉及任何模型之前,先验证 Python 环境没问题。
bash
git clone <your repository url> aitutor && cd aitutor
python3 -m labs.run_all --check
You are done when完成标志Every line reads ok. Optional labs may be skipped if their package is missing.每一行都显示 ok。缺少依赖包的可选 lab 可能被跳过。
02Serve a model and point the labs at it部署一个模型并让 lab 指向它

Do this操作

  1. On NVIDIA hardware use vLLM or llama.cpp. On Apple silicon use Ollama or MLX. Any OpenAI-compatible server works.NVIDIA 硬件用 vLLM 或 llama.cpp。Apple 芯片用 Ollama 或 MLX。任何 OpenAI 兼容的服务都可以。
  2. Write the memory budget for this machine first. The numbers differ.先为这台机器写好内存预算。数字会不一样。
  3. Export the two variables and re-run a lab.导出两个环境变量,然后重新运行一个 lab。
bash
export LAB_BASE_URL=http://127.0.0.1:8000/v1
export LAB_MODEL=<model name on this server>
python3 -m labs.m07_harness.demo
You are done when完成标志The answer now comes from the real model and still cites tool results.回答现在来自真实模型,并且仍然引用了工具结果。
03Start Postgres when you outgrow the lab database当 lab 数据库不够用时,启动 Postgres

Do this操作

  1. Run Postgres with the vector extension in a container, bound to localhost.在容器里运行带向量扩展的 Postgres,并绑定到 localhost。
  2. Create one schema per owner prefix.按归属前缀各建一个 schema。
bash
docker run -d --name agentdb -e POSTGRES_PASSWORD=change-me -p 127.0.0.1:5432:5432 pgvector/pgvector:pg17
psql -h 127.0.0.1 -U postgres -c "CREATE EXTENSION IF NOT EXISTS vector; CREATE SCHEMA kb; CREATE SCHEMA brain; CREATE SCHEMA mem;"
You are done when完成标志The concurrent-writer test from module 4 passes.第 4 模块的并发写入测试通过。
04Supervise with systemd用 systemd 守护进程

Do this操作

  1. Copy the unit file from the labs, replace the placeholders, enable it.复制 lab 里的 unit 文件,替换占位符,然后启用。
  2. Use absolute paths. Kill the process and confirm it returns.使用绝对路径。杀掉进程,确认它会自动恢复。
bash
sudo cp labs/m15_ops/units/agent-server.service /etc/systemd/system/
sudo systemctl daemon-reload && sudo systemctl enable --now agent-server
systemctl status agent-server
You are done when完成标志The service is active after a reboot.重启机器后服务处于 active 状态。
05Schedule the nightly window and send backups elsewhere安排夜间时间窗,并把备份送到别处

Do this操作

  1. Install the timer. In the window run backup, the retrieval eval, and the learning loop in report mode.安装 timer。在时间窗内运行备份、检索评估和报告模式的学习循环。
  2. Copy one encrypted backup to a different machine or bucket.把一份加密备份复制到另一台机器或存储桶。
You are done when完成标志A morning report exists and the restore test passed.早上的报告已生成,并且恢复测试通过。

Sources来源

No vendor documentation is needed. The labs are the reference.不需要厂商文档。以 lab 为准。