openclaw message
向 Agent 发送消息。
概要
bash
openclaw message [文本] [选项]1
描述
openclaw message 命令用于通过命令行直接向 OpenClaw Agent 发送消息并获取回复。支持直接传入文本、指定会话、管道输入以及交互模式,适合自动化脚本和快速测试场景。
选项
| 选项 | 缩写 | 说明 | 默认值 |
|---|---|---|---|
--session <key> | -s | 指定会话 Key | 默认会话 |
--interactive | -i | 进入交互模式 | false |
--stream | 流式输出回复 | true | |
--no-stream | 禁用流式输出,等待完整回复 | false | |
--format <type> | 输出格式:text、json | text | |
--timeout <ms> | 超时时间(毫秒) | 30000 | |
--skill <id> | 指定使用的技能 | - |
交互模式
使用 --interactive 进入交互模式后,可以连续与 Agent 对话:
$ openclaw message --interactive
OpenClaw 交互模式 (输入 /exit 退出)
> 你好
Agent: 你好!有什么可以帮助你的吗?
> 帮我查看系统状态
Agent: 当前系统运行正常,所有通道已连接...
> /exit1
2
3
4
5
6
7
2
3
4
5
6
7
管道输入
支持通过管道将文本内容传入:
bash
echo "总结这段文字" | openclaw message
cat report.txt | openclaw message --session task_review1
2
2
示例
bash
# 发送简单消息
openclaw message "你好"
# 指定会话发送
openclaw message "请继续上次的任务" --session ses_abc123
# 进入交互模式
openclaw message --interactive
# 管道输入文件内容
cat document.txt | openclaw message
# 以 JSON 格式输出
openclaw message "当前时间" --format json
# 指定技能处理
openclaw message "生成周报" --skill weekly_report
# 禁用流式,等待完整回复
openclaw message "分析这个数据" --no-stream1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
相关命令
openclaw sessions- 会话管理openclaw tui- 终端 UI 交互openclaw memory- 记忆管理
