快速开始

安装、配置并 smoke-test localmelo。

这页是从 checkout 到验证本地 agent loop 的最短路径,覆盖 direct CLI、gateway、 session 复用、backend setup 和 focused test suites。

安装

从仓库根目录以 editable mode 安装。

# Core + dev dependencies
pip install -e ".[dev]"

# Core + dev + gateway dependencies
pip install -e ".[dev,gateway]"

Direct CLI smoke

Direct mode 执行一次 query 后退出,是确认 chat backend 可用的最快路径。

melo "What is 6*7?"
通过标准:命令以 status 0 退出,答案提到 42,并且没有 traceback。

也可以临时覆盖 endpoint 和 model:

melo --base-url http://localhost:11434/v1 \
     --chat-model qwen3:8b \
     "What is 6*7?"

Gateway smoke

Gateway mode 在同一个 agent runtime 外面启动 HTTP API。一个 shell 启动服务,另一个 shell 调用。

melo --serve
curl http://127.0.0.1:8401/v1/health

curl -X POST http://127.0.0.1:8401/v1/agent/run \
  -H "Content-Type: application/json" \
  -d '{"query":"Say hello briefly"}'

Session 复用

传入稳定的 session_id 可以在多次 gateway 调用之间复用同一个 session。

curl -X POST http://127.0.0.1:8401/v1/agent/run \
  -H "Content-Type: application/json" \
  -d '{"query":"remember this is session test","session_id":"demo123"}'

curl -X POST http://127.0.0.1:8401/v1/agent/run \
  -H "Content-Type: application/json" \
  -d '{"query":"continue","session_id":"demo123"}'

curl http://127.0.0.1:8401/v1/sessions
curl -X DELETE http://127.0.0.1:8401/v1/sessions/demo123

Backend setup

localmelo 使用 split backend model:chat_backendembedding_backend 通过 melo --reconfigure 独立配置。

模式Chat backendEmbedding backend说明
Ollama localollamaollamanone连接用户自己管理的 Ollama server。
MLC localmlcmlcnone连接用户自己管理的 OpenAI-compatible MLC endpoint。
Other localvllmsglang同一个 local backend 或 noneruntime lifecycle 仍在 localmelo 外部。
Cloud chatopenaianthropicgemininvidialocal backend 或 none运行前设置对应 API key env var。

No-embedding mode

当不想运行 embedding server 时,把 embedding_backend 设为 "none"。Agent 仍支持 direct answer、tool use 和 history recording; 只有 long-term embedding retrieval 会被关闭。

melo --reconfigure
melo "What is 6*7?"

Tests

# Dev-safe core suites
python -m pytest tests/agent tests/checker tests/executor \
                 tests/cli tests/memory tests/integration -q

# Gateway suite
python -m pytest tests/gateway -q

# Full suite
python -m pytest tests/ -q

# Lint
python -m ruff check .