


本文将详细介绍 OpenClaw 在本地环境部署的完整流程,适用于:
Mac
Windows
Linux
本地开发环境
AI Agent开发测试
整个部署流程大约 10-15分钟即可完成。
OpenClaw 是一个 AI Agent 自动化平台,用于构建智能代理系统。
类似项目:
AutoGPT
OpenDevin
CrewAI
LangGraph
核心功能:
AI Agent任务执行
Skills技能系统
多模型支持
Web管理界面
API调用
自动化工作流
常见用途:
自动写代码
自动写文档
自动分析数据
自动执行脚本
AI办公助手
推荐配置:
|
项目 |
推荐 |
|---|---|
|
CPU |
4核 |
|
内存 |
8GB |
|
硬盘 |
10GB |
|
Node |
18+ |
|
Python |
3.10+ |
推荐使用 Node 18 或 Node 20
官网:
https://nodejs.org
检查版本:node -v
OpenClaw Agent 依赖 Python。
克隆仓库:
git clone https://github.com/openclaw/openclaw.git
进入项目:
cd openclaw
项目结构:
openclaw
├── backend
├── frontend
├── agent
├── skills
├── configs
├── scripts
└── docker-compose.yml
目录说明:
|
目录 |
作用 |
|---|---|
|
frontend |
Web界面 |
|
backend |
API服务 |
|
agent |
AI执行引擎 |
|
skills |
技能库 |
|
configs |
配置 |
进入 backend:
cd backend
安装依赖:
npm install
返回根目录:
cd ..
cd frontend
npm install
进入 agent:
cd ../agent
创建虚拟环境:
python3 -m venv venv
激活环境:
Mac / Linux
source venv/bin/activate
Windows
venv\Scripts\activate
安装依赖:
pip install -r requirements.txt
复制配置文件:
cp .env.example .env
编辑:
OPENAI_API_KEY=sk-xxxx
LLM_PROVIDER=openai
APP_PORT=3000
API_PORT=8000
如果使用 DeepSeek
OPENAI_BASE_URL=https://api.deepseek.com
如果使用 Claude
ANTHROPIC_API_KEY=xxxx
OpenClaw 需要:
PostgreSQL
Redis
推荐使用 Docker。
启动:
docker run -d \
-p 5432:5432 \
-e POSTGRES_PASSWORD=postgres \
postgres
Redis:
docker run -d -p 6379:6379 redis
进入 backend:
cd backend
运行:
npm run dev
成功日志:
Server started at http://localhost:8000
打开新终端:
cd frontend
运行:
npm run dev
成功:
即可进入 OpenClaw 控制台。
进入 agent:
cd agent
启动:
python main.py
日志:
Agent runtime started
Skills 是 OpenClaw 的能力扩展。
进入 skills 目录:
cd skills
安装官方 skills:
git clone https://github.com/skills/registry
常用 skills
|
Skill |
功能 |
|---|---|
|
browser |
浏览器操作 |
|
filesystem |
文件管理 |
|
git |
Git操作 |
|
shell |
执行命令 |
|
web_search |
联网搜索 |
打开:
http://localhost:3000
进入:Dashboard
点击:Create Agent
填写:Agent名称:AutoDev
描述:自动编程助手
选择 skills:
•filesystem
•git
•shell
保存。
创建任务:
示例任务:
生成一个 Vue3 博客模板
Agent 将自动:
1 搜索资料
2 编写代码
3 执行命令
4 输出结果