Run OpenClaw Agent Commands: Execute Tasks via CLI
Managing agent interactions often feels like a chore when you have to switch between different interfaces or manually track session IDs. You want a way to trigger a turn, send a message, and get the job done without the friction of complex setups.
The openclaw agent command is your go-to tool for running agent turns via the Gateway. If you are working with embedded agents, you can just use the --local flag. It is the most direct way to talk to your configured agents.
Examples
Section titled “Examples”If you want to get moving quickly, these examples show how to use the command for different scenarios. You can target specific agents, manage sessions, or even route replies to Slack.
openclaw agent --to +15555550123 --message "status update" --deliveropenclaw agent --agent ops --message "Summarize logs"openclaw agent --session-id 1234 --message "Summarize inbox" --thinking mediumopenclaw agent --agent ops --message "Generate report" --deliver --reply-channel slack --reply-to "#reports"There are a few things you should know about how this command handles your configuration. When it triggers a models.json regeneration, it keeps your provider credentials safe. Instead of writing out your actual secrets in plaintext, it uses non-secret markers like secretref-env:ENV_VAR_NAME or secretref-managed.
OpenClaw treats your active source config as the authority. It persists these markers from the config snapshot rather than using the resolved values it uses at runtime. This keeps your environment clean and ensures your secrets stay protected.
Next Steps
Section titled “Next Steps”OpenClaw Expert
Still stuck?
If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.