跳到正文
FunCoding

Agents and Templates

When to make a new agent, how to give it a job, and how to package it as a Template

An agent is something you give a job to. Each agent has its own workspace, instructions, and session history, so it can keep doing that job without you explaining it again.

A Template is that agent packaged so someone else can start with it. It carries the setup for the job and leaves your history behind.

This page is a short guide to both. Each section links to the reference page that has the full details.

When to make a new agent

OpenClaw starts with one agent, and one agent can do a wide range of work. A second agent is worth making when a piece of work stands apart:

  • You keep asking for the same work, and you explain it again each time.
  • The work has its own instructions, tools, or schedule that the rest of your work does not need.
  • You want the agent to build up context on one job. Each agent keeps its own workspace, memory files, and sessions, so what it learns about the job stays with the job instead of mixing into your main agent's context.

Jobs from engineering and developer relations that fit this description include:

  • Working through contributor pull requests and leaving a first review.
  • Watching a project's dependencies for new security advisories.
  • Monitoring mentions of a project and summarizing what needs a reply.
  • Turning a recording into clips and show notes.

A one-off task does not need its own agent. Ask the agent you already have.

To make an agent in the Control UI, choose Create new agent in the agent selector and give it a name. From the command line:

openclaw agents add pr-review --workspace ~/.openclaw/workspace-pr-review

An agent can also serve a separate person, persona, or channel account. See Multi-agent routing for that setup, and openclaw agents for every creation option.

Give the agent its job

A new agent has a name and a workspace, but no job yet. Four things define the job:

  • Instructions say what the job is and where it stops. They are Markdown files in the agent's workspace: AGENTS.md holds operating instructions, and SOUL.md holds persona, tone, and boundaries. Describe what the agent should produce, what it must leave alone, and when it should ask you first. See Agent workspace.
  • Skills are the steps the agent should follow each time. A skill is a folder with a SKILL.md file, and a skill in the workspace skills/ directory is visible only to that agent. See Skills and Creating skills.
  • Plugins and MCP servers are the tools and services the job needs, such as a chat channel, web search, or a third-party service. They are installed on the Gateway and shared between agents, and per-agent tool policy can restrict what each agent may use. See Plugins, Connect MCP servers, and Multi-agent sandbox and tools.
  • Automations are when the agent runs without being asked. An automation is a scheduled job assigned to an agent. See Automations.

For example, this automation asks the pr-review agent to do its job every weekday at 09:00:

openclaw automations create "0 9 * * 1-5" \
  "Review contributor pull requests opened since the last run." \
  --name "Pull request review" \
  --agent pr-review

It helps to run a job by hand a few times before scheduling it, so you know what the output looks like. When you ask for the same job several times, the agent can offer to turn it into an automation.

Package it as a Template

Once an agent does its job well, you can package it so other people can start from the same setup. Templates are available by default, without a Labs opt-in. An existing advanced gateway.controlUi.experimental.templates: false still disables them; see Templates.

A Template can include agent instructions, workspace files, skills, plugins, MCP servers, and automations. It does not include your memories, conversations, or credentials. A setting that needs a secret, such as an MCP server token, is declared as an environment variable reference and never as a value.

The agent can prepare the Template itself. The review opens in the Control UI and needs an administrator connection.

  1. In the agent's chat, ask it to "create a new template from this agent." The agent drafts a private proposal and opens a review card in the same conversation. It writes the proposal for a new owner instead of copying your workspace.
  2. If the card asks you to Sign in, approve ClawHub access in your browser. When the draft is ready, its card appears in the same chat. Select Preview to inspect the exact files, skills, plugins, MCP servers, and automations. The preview is read-only, so ask the agent to revise the proposal when something should change. Known private paths and credential-like text are rejected, but read the remaining text for personal details yourself.
  3. To share the Template, select Publish on the card or in the preview. The agent cannot publish for you. The card shows Pending while ClawHub checks the submission and Published once the Template is available, with a link you can share.

You can also write a Template by hand. See Templates for the package format.

Start from someone else's Template

Published Templates live on ClawHub. Open Customize → Templates to browse and search them. If Customize is not pinned, find it in Pages. You can also add a Template from the command line when someone shares its ClawHub reference:

openclaw templates add @<publisher>/<slug>

Adding a Template creates an ordinary agent that is yours to change. Add is a one-way action: there is no installed Template to update or remove afterward, and adding the same Template again creates another agent. Edit the new agent's instructions, skills, and automations as you would for an agent you made yourself, and delete it like any other agent.

Review what a Template installs before you add it, because its instructions and requirements come from another author. In the Control UI, open the Template to read its workspace files and see its skills, plugins, MCP servers, and automations. Add creates the agent right away, so read those details first. A Template that ClawHub flagged for review shows a warning and asks you to confirm. From the command line, preview without creating anything:

openclaw templates add @<publisher>/<slug> --dry-run --json

When you add from the Control UI, the new agent's first reply lists what still needs you, such as signing in to an MCP server or enabling an automation.