openclaw agent
管理 Agent 实例的生命周期,包括启动、停止、状态查看和交互式运行。
命令签名
bash
openclaw agent <子命令> [选项]子命令
| 子命令 | 说明 |
|---|---|
start | 在后台启动 Agent 实例 |
stop | 停止正在运行的 Agent |
status | 查看 Agent 当前状态 |
list | 列出所有 Agent 实例 |
run | 交互式单轮运行 Agent |
openclaw agent start
在后台启动一个 Agent 实例。
bash
openclaw agent start [选项]| 选项 | 类型 | 说明 |
|---|---|---|
--name <name> | string | Agent 名称(默认 default) |
--config <path> | string | 指定 Agent 配置文件 |
--detach | boolean | 以分离模式运行 |
openclaw agent stop
停止指定的 Agent 实例。
bash
openclaw agent stop [--name <name>] [--all]| 选项 | 类型 | 说明 |
|---|---|---|
--name <name> | string | 要停止的 Agent 名称 |
--all | boolean | 停止所有运行中的 Agent |
openclaw agent status
查看 Agent 的运行状态。
bash
openclaw agent status [--name <name>]openclaw agent run
以交互模式运行 Agent,执行单轮对话后退出。适合快速测试和脚本调用。
bash
openclaw agent run [选项] [--message <prompt>]| 选项 | 类型 | 说明 |
|---|---|---|
--message <prompt> | string | 发送给 Agent 的消息 |
--name <name> | string | 使用指定的 Agent 配置 |
--timeout <ms> | number | 超时时间(毫秒) |
示例
bash
# 启动默认 Agent
openclaw agent start
# 启动指定名称的 Agent
openclaw agent start --name customer-support
# 查看运行状态
openclaw agent status
# 交互式运行单条消息
openclaw agent run --message "今天天气怎么样?"
# 停止所有 Agent
openclaw agent stop --all另请参阅
openclaw agents— 列出所有已配置的 Agentopenclaw config— 管理 Agent 配置openclaw daemon— 守护进程管理
