Create autonomous AI agents for OpenClaw through an intelligent guided process.
When the user wants to create a new agent, you MUST follow the Discovery Flow below to gather requirements before running any creation scripts. Do NOT immediately ask for all parameters at once — guide the user through a natural conversation to understand what they truly need.
Start by understanding the agent's core purpose. Ask ONE question at a time and build on answers:
1. What problem does this agent solve?
2. Derive identity from purpose:
research-bot, health-tracker)3. Choose the right model based on workload:
| Use Case | Recommended Model | Why |
|---|---|---|
| ---------- | ------------------ | ----- |
| Deep research, complex reasoning, coding | anthropic/claude-opus-4-6 | Most capable, best for complex tasks |
| General tasks, balanced cost/quality | anthropic/claude-sonnet-4-6 | Good balance of speed and capability |
| Fast responses, simple tasks, high volume | anthropic/claude-haiku-4-5 | Fastest and cheapest |
| Image generation/understanding | google/gemini-2.5-flash | Strong multimodal capabilities |
| Budget-friendly, coding-focused | deepseek/deepseek-chat | Cost-effective for code tasks |
Ask the user about their priorities (quality vs cost vs speed) to recommend the right model.
4. Define personality traits:
5. Define boundaries:
6. What is the agent's main workflow?
Walk through a typical interaction:
7. What tools does this agent need?
Available built-in tools:
read, write, edit, apply_patch — file operationsexec — shell command executionbrowser — web browsing and automationweb_search — search the web (multiple providers)web_fetch — fetch URL contentimage_generate — create imagesimage — analyze/understand imagesmemory_search, memory_get — semantic memory recallsessions_list, sessions_send, sessions_history — inter-agent communicationsessions_spawn — spawn sub-agent taskscanvas — display UI on mobile nodesnodes, nodes.run — execute on connected devicescron_list, cron_add, cron_remove — manage scheduled tasksShould any tools be denied for security? (e.g., deny exec, write for a read-only agent)
8. Does this agent need specific skills?
~/.openclaw/skills/?/skills/ directory?9. How will users interact with this agent?
Options:
10. Multi-agent coordination:
If channels are needed, you'll need to set up bindings to route messages to this agent. Example:
{
bindings: [
{ agentId: "agent-id", match: { channel: "telegram", accountId: "agent-bot" } }
]
}
11. Does this agent need scheduled tasks?
Two options — explain the difference:
| Feature | Heartbeat | Cron |
|---|---|---|
| --------- | ----------- | ------ |
| Runs in | Main session (shared context) | Isolated or main session |
| Timing | Periodic interval (e.g., every 30m) | Exact schedule (cron expression) |
| Best for | Monitoring, checking inbox, context-aware tasks | Reports, reminders, exact-time tasks |
| Cost | Lower (batched checks) | Per-job cost |
Heartbeat setup (recommended for monitoring agents):
Cron setup (recommended for scheduled tasks):
12. Memory configuration:
memory/YYYY-MM-DD.md)MEMORY.md for long-term curated memory?13. Security posture:
| Mode | Description | Use Case |
|---|---|---|
| ------ | ------------- | ---------- |
off | No sandboxing, full host access | Trusted personal agents |
non-main | Sandbox non-main sessions only | Mixed trust environments |
all | Full sandbox for all sessions | Untrusted inputs, shared agents |
After gathering all requirements, create the agent using this process:
openclaw agents add <agent-id>
This creates the proper directory structure under ~/.openclaw/agents/.
Run the creation script with gathered parameters:
{baseDir}/scripts/create-agent.sh \
--name "Agent Name" \
--id "agent-id" \
--emoji "🤖" \
--specialty "What this agent does" \
--model "provider/model-name" \
--workspace "/path/to/workspace" \
--personality "Communication style and traits" \
--boundaries "What the agent should not do" \
--workflow "Step-by-step workflow description" \
--tools-allow "tool1,tool2,tool3" \
--tools-deny "tool4,tool5" \
--autonomy "tier1|tier2|tier3" \
--heartbeat-every "30m" \
--heartbeat-target "last" \
--heartbeat-active-hours "08:00-22:00" \
--sandbox "off|non-main|all"
The script creates these workspace files:
The script automatically:
agents.list in gateway configIf the agent needs channel routing, apply a config patch:
openclaw gateway config.patch --raw '{
"bindings": [
{
"agentId": "<agent-id>",
"match": { "channel": "<channel>", "accountId": "<account>" }
}
]
}'
openclaw cron add \
--name "<Job Name>" \
--cron "<cron expression>" \
--tz "<timezone>" \
--session "<agent-id>" \
--system-event "<instruction>" \
--wake now
For agent-specific skills, create them in :
mkdir -p <workspace>/skills/<skill-name>
# Create SKILL.md in the skill directory
For shared skills:
openclaw skills install <skill-slug>
# Verify agent is registered
openclaw agents list --bindings
# Check gateway status
openclaw gateway status
# Test the agent
openclaw agent --agent <agent-id> --message "Hello! Introduce yourself."
# Or via session tools
sessions_send({ label: "<agent-id>", message: "Hello!" })
After the agent is created, help the user refine:
User: "I want an agent that does deep research for me"
Discovery:
anthropic/claude-opus-4-6 (needs complex reasoning)web_search, web_fetch, browser, read, write, memory_searchexec, image_generatesessions_sendoff (trusted personal agent)User: "I need a bot for my family WhatsApp group"
Discovery:
anthropic/claude-sonnet-4-6 (balanced cost/quality)read, web_search, sessions_listwrite, edit, exec, browser, apply_patchall (handles untrusted group messages)User: "I want an agent to track my health and remind me of medications"
Discovery:
anthropic/claude-sonnet-4-6read, write, memory_search, cron_addoff (personal trusted agent)After creating an agent, explain how it fits into the user's multi-agent system:
sessions_list({ kinds: ["agent"], limit: 10, messageLimit: 3 })
sessions_send({
label: "agent-id",
message: "Your task description here"
})
sessions_spawn({
agentId: "agent-id",
task: "Complex task description",
model: "anthropic/claude-opus-4-6",
runTimeoutSeconds: 3600,
cleanup: "delete"
})
sessions_history({ sessionKey: "agent-session-key", limit: 50 })
"Agent not appearing after creation"
openclaw gateway restartopenclaw agents list --bindings"Agent not responding to messages"
openclaw gateway config.get --format json | jq '.bindings'openclaw sessions list --agent "Model errors"
provider/model-nameopenclaw models list"Heartbeat not running"
openclaw gateway config.get --format json | jq '.agents'"Cron job not firing"
openclaw cron listjq for JSON processing共 1 个版本