# Templates: pre-configured agents

> Set up an agent once, turn it into a template, and start every new client or user from it.

**Ask your management agent:**

- "Create a template called sales-agent with an instructions file that says: You are the sales assistant of our client. Make the client's name a variable filled in when an agent is created from it."


A **template** is a reusable set of files and settings applied when an instance is created. It is how you
give every new client or user an agent that already knows its job: the same instructions, the same skills,
the same configuration, from the first minute.

## What a template contains

A template is a list of files, each with its path in the agent's home directory and its content, for example:

- the agent's **instructions** (who it works for, how it should behave, what it must never do);
- **skills**: step-by-step know-how the agent reads when a task needs it (how to use your product's API, how
  to write a quote, how to onboard a new user);
- **configuration** files of the runtime;
- the agent's **home screen and left bar**: the suggested missions under the message field, the pages shown
  and their order (Mue);
- **variables**: values filled in at creation (the client's name, a language) and **secrets** bound at
  creation (an API key), so the same template serves every client.

A file is either **replaced** or **merged** with what is already there (for JSON configuration).

## Making a template

The simplest way is to ask your [management agent](management-agent.md) to write it for you: tell it what
the template should contain (the instructions, the skills, the variables) and it creates the template.

You can also write a template yourself in **Templates** in the dashboard, or duplicate one of the built-in
templates to change it.

**Save as template**, in the instance list, copies an agent's runtime configuration files. On Mue, the
agent's instructions and skills live in its workspace and are not part of that copy: to reuse them, write them
into the template (or ask the management agent to do it, from the files you name).

## Creating instances from a template

Pick one or more templates when you create an instance, in the dashboard or with the API
(`templates` in `POST /v2/instances`). The files are in place when the agent starts. Ask the
[management agent](management-agent.md) to do it for you: "create an agent for Acme from my sales template".

A template can also be applied to an existing instance later.

## Good practices

- **Keep secrets out of template files.** Bind them at creation, so each client's agent gets its own key.
- **Keep memory and personal data out.** A template is a starting point, not a copy of your agent's life.
- **Write the instructions for the agent's real user**, not for you: their name, their business, their
  language, filled in by variables.
- **Version your templates.** Give a new name to a new version, so existing clients are not surprised.

## Templates and agents that build themselves

A template does not freeze the agent. It is where the agent starts: from there, each agent learns about its
own user, builds its own tools and routines, and becomes different from its siblings. That is the point.

> **With Enterprise, on request:** we can design and write your templates and skills with you, and package
> them as your own agent product. See [What Enterprise adds](enterprise.md#talk-to-us).
