#Can i create agent from template
1 messages · Page 1 of 1 (latest)
Yes, but the command is openclaw agents add, not openclaw add agent.
There is no built-in --template flag right now. The usual pattern is:
- Prepare a workspace folder with your markdown files
(AGENTS.md,SOUL.md,TOOLS.md,IDENTITY.md,USER.md, optionalHEARTBEAT.md/MEMORY.md) - Copy that template folder to a new agent workspace
- Add the agent pointing at that workspace
Example:
cp -R ~/.openclaw/templates/my-agent ~/.openclaw/workspace-sales
openclaw agents add sales --workspace ~/.openclaw/workspace-sales --non-interactive
A nice detail: OpenClaw only creates bootstrap files if they are missing, so your prepared files should be kept as-is.
If you want OpenClaw to never auto-create those files, you can also set:
{
agents: {
defaults: {
skipBootstrap: true
}
}
}
Docs:
If you want, I can also show a clean “template repo/folder” layout for cloning new agents fast.
yes show
Yep, this is the clean pattern I’d use:
Template folder
~/.openclaw/templates/base-agent/
AGENTS.md
SOUL.md
TOOLS.md
IDENTITY.md
USER.md
HEARTBEAT.md # optional
MEMORY.md # optional
avatars/ # optional
Create a new agent from it
cp -R ~/.openclaw/templates/base-agent ~/.openclaw/workspace-sales
openclaw agents add sales --workspace ~/.openclaw/workspace-sales --non-interactive
If IDENTITY.md has the name/emoji/theme you want
openclaw agents set-identity --workspace ~/.openclaw/workspace-sales --from-identity
A few practical notes:
- Use one copied workspace per agent, not one shared workspace
- Your template can be partial. OpenClaw fills in missing bootstrap files only
- I’d usually leave out
BOOTSTRAP.mdunless you really want a first-run ritual/checklist
If you want to do this a lot, make a tiny shell script:
#!/usr/bin/env bash
set -euo pipefail
NAME="$1"
TEMPLATE="$HOME/.openclaw/templates/base-agent"
WORKSPACE="$HOME/.openclaw/workspace-$NAME"
cp -R "$TEMPLATE" "$WORKSPACE"
openclaw agents add "$NAME" --workspace "$WORKSPACE" --non-interactive
openclaw agents set-identity --workspace "$WORKSPACE" --from-identity || true
Docs:
If you want, I can also show a git-based template repo version, which is even nicer for managing many agents.
here is a script for the main agent. it generate a pre configured agent https://github.com/photon78/openclaw-docker-installer/blob/main/src/scripts/add_agent.py
Nice, thanks for sharing, that’s basically the pattern people want here: generate a workspace, prefill the .md files, then register the agent.
One caveat though: I’d trust the CLI for agent registration more than hand-patching openclaw.json, because config shape changes over time. Current docs/CLI path is:
openclaw agents add <name> --workspace <dir> --non-interactive
So the safest script shape is:
- create/copy the workspace template
- write your prepared
AGENTS.md/SOUL.md/ etc - call
openclaw agents add ... - optionally call
openclaw agents set-identity --from-identity
That avoids drift if config internals change.
Docs for the current supported path:
Honestly, this makes me think a native openclaw agents add --template <dir> would be pretty useful.
Yes, good idea