Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt

Use this file to discover all available pages before exploring further.

openclaw agent เรียกใช้เอเจนต์หนึ่งรอบจากบรรทัดคำสั่งโดยไม่ต้องมี ข้อความแชตขาเข้า ใช้สำหรับเวิร์กโฟลว์แบบสคริปต์ การทดสอบ และ การส่งแบบโปรแกรม

เริ่มต้นอย่างรวดเร็ว

1

Run a simple agent turn

openclaw agent --message "What is the weather today?"
คำสั่งนี้จะส่งข้อความผ่าน Gateway และพิมพ์คำตอบออกมา
2

Target a specific agent or session

# 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"
3

Deliver the reply to a channel

# 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\>สร้างคีย์เซสชันจากเป้าหมาย (โทรศัพท์, chat 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\>กำหนด timeout ของเอเจนต์แทนค่าเริ่มต้น
--jsonส่งออก JSON แบบมีโครงสร้าง

พฤติกรรม

  • โดยค่าเริ่มต้น CLI จะทำงาน ผ่าน Gateway เพิ่ม --local เพื่อบังคับใช้ รันไทม์แบบฝังในเครื่องปัจจุบัน
  • หากเข้าถึง Gateway ไม่ได้ CLI จะ fallback ไปใช้การรันแบบฝังในเครื่อง
  • การเลือกเซสชัน: --to สร้างคีย์เซสชัน (เป้าหมายแบบกลุ่ม/ช่องทาง จะคงการแยกกันไว้; แชตโดยตรงจะถูกรวมเป็น main)
  • แฟล็ก thinking และ verbose จะถูกเก็บต่อเนื่องไว้ใน session store
  • เอาต์พุต: ค่าเริ่มต้นเป็นข้อความธรรมดา หรือใช้ --json สำหรับ payload + metadata แบบมีโครงสร้าง
  • เมื่อใช้ --json --deliver JSON จะรวมสถานะการส่งสำหรับการส่งที่ส่งแล้ว, ถูกระงับ, บางส่วน และล้มเหลว ดู สถานะการส่ง 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"

ที่เกี่ยวข้อง

Agent CLI reference

เอกสารอ้างอิงแฟล็กและตัวเลือกทั้งหมดของ openclaw agent

Sub-agents

การสร้างเอเจนต์ย่อยเบื้องหลัง

Sessions

วิธีการทำงานของคีย์เซสชัน และวิธีที่ --to, --agent และ --session-id resolve คีย์เหล่านั้น

Slash commands

แค็ตตาล็อกคำสั่ง native ที่ใช้ภายในเซสชันของเอเจนต์