Agent coordination
การส่งของเอเจนต์
openclaw agent เรียกใช้หนึ่งรอบการทำงานของเอเจนต์จากบรรทัดคำสั่ง โดยไม่ต้องมีข้อความแชทขาเข้า ใช้สำหรับเวิร์กโฟลว์แบบสคริปต์ การทดสอบ และการส่งมอบแบบโปรแกรมได้
เริ่มต้นอย่างรวดเร็ว
เรียกใช้รอบการทำงานของเอเจนต์แบบง่าย
openclaw agent --message "What is the weather today?"
คำสั่งนี้ส่งข้อความผ่าน Gateway และพิมพ์คำตอบออกมา
กำหนดเอเจนต์หรือเซสชันเฉพาะ
# Target a specific agent
openclaw agent --agent ops --message "Summarize logs"
# Target a phone number (derives session key)
openclaw agent --to +15555550123 --message "Status update"
# Reuse an existing session
openclaw agent --session-id abc123 --message "Continue the task"
ส่งคำตอบไปยังช่องทาง
# Deliver to WhatsApp (default channel)
openclaw agent --to +15555550123 --message "Report ready" --deliver
# Deliver to Slack
openclaw agent --agent ops --message "Generate report" \
--deliver --reply-channel slack --reply-to "#reports"
แฟล็ก
| แฟล็ก | คำอธิบาย |
|---|---|
--message \<text\> |
ข้อความที่จะส่ง (จำเป็น) |
--to \<dest\> |
สร้างคีย์เซสชันจากเป้าหมาย (โทรศัพท์, ID แชท) |
--agent \<id\> |
กำหนดเอเจนต์ที่ตั้งค่าไว้ (ใช้เซสชัน main ของเอเจนต์นั้น) |
--session-id \<id\> |
ใช้เซสชันที่มีอยู่ซ้ำตาม ID |
--local |
บังคับใช้รันไทม์แบบฝังในเครื่อง (ข้าม Gateway) |
--deliver |
ส่งคำตอบไปยังช่องทางแชท |
--channel \<name\> |
ช่องทางส่งมอบ (whatsapp, telegram, discord, slack ฯลฯ) |
--reply-to \<target\> |
เขียนทับเป้าหมายการส่งมอบ |
--reply-channel \<name\> |
เขียนทับช่องทางการส่งมอบ |
--reply-account \<id\> |
เขียนทับ ID บัญชีการส่งมอบ |
--thinking \<level\> |
ตั้งค่าระดับการคิดสำหรับโปรไฟล์โมเดลที่เลือก |
--verbose \<on|full|off\> |
ตั้งค่าระดับ verbose |
--timeout \<seconds\> |
เขียนทับระยะหมดเวลาของเอเจนต์ |
--json |
ส่งออก JSON แบบมีโครงสร้าง |
ลักษณะการทำงาน
- โดยค่าเริ่มต้น CLI จะทำงาน ผ่าน Gateway เพิ่ม
--localเพื่อบังคับใช้รันไทม์แบบฝังในเครื่องปัจจุบัน - หากเชื่อมต่อ Gateway ไม่ได้ CLI จะ ถอยกลับ ไปใช้การรันแบบฝังในเครื่อง
- การเลือกเซสชัน:
--toสร้างคีย์เซสชัน (เป้าหมายแบบกลุ่ม/ช่องทางจะรักษาการแยกไว้; แชทโดยตรงจะรวมเป็นmain) - แฟล็ก thinking และ verbose จะถูกคงไว้ในที่เก็บเซสชัน
- เอาต์พุต: ค่าเริ่มต้นเป็นข้อความธรรมดา หรือใช้
--jsonสำหรับเพย์โหลดแบบมีโครงสร้าง + เมทาดาทา
ตัวอย่าง
# Simple turn with JSON output
openclaw agent --to +15555550123 --message "Trace logs" --verbose on --json
# Turn with thinking level
openclaw agent --session-id 1234 --message "Summarize inbox" --thinking medium
# Deliver to a different channel than the session
openclaw agent --agent ops --message "Alert" --deliver --reply-channel telegram --reply-to "@admin"