---
docId: doc_5d2a75807868403b876d3c694afff863
title: Agent templates
description: Install a ready-to-use agent from the template catalog and resolve its pending items before publishing it.
---

<script>
  import { Ways, Collapsible } from '$lib/components';
</script>

# Agent templates

Create an agent from a template for sales, support, appointments or another use. [Choose a template](/api-reference/agent-templates/list), [install it](/api-reference/agent-templates/install) and [check the pending items](/api-reference/agent-templates/setup/get) to adapt it to your business.

The agent starts as a **draft**. [Publish it](/api-reference/agents/publications/publish) when you are done so it can begin replying.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
# 1. Install a template (creates a new agent and returns setup.slots)
curl -X POST https://api.platic.ai/v1/agent-templates/atencion-a-clientes/install \
  -H "Authorization: Bearer $PLATIC_API_KEY"

# 2. Check the pending items and close the list when ready is true
curl https://api.platic.ai/v1/agents/$AGENT_ID/template-setup \
  -H "Authorization: Bearer $PLATIC_API_KEY"

curl -X POST https://api.platic.ai/v1/agents/$AGENT_ID/template-setup \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"action": "complete"}'
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
// 1. List templates and install one
const [template] = await platic.agentTemplates.list();
const { agent, setup } = await platic.agentTemplates.install(template.slug);

// 2. Resolve pending items (draft, files, tools, channels) or skip optional ones
for (const slot of (setup?.slots ?? []).filter((s) => s.state === "pending" && !s.required)) {
  await platic.agents.templateSetup.update(agent.id, { action: "skip", slotId: slot.id });
}

// 3. Close the list when ready === true and publish
const current = await platic.agents.templateSetup.get(agent.id);
if (current.setup?.ready) {
  await platic.agents.templateSetup.update(agent.id, { action: "complete" });
  await platic.agents.publish(agent.id);
}
```

</Ways.Way>
</Ways>

## What you need to know

- **They are marked done on their own:** each pending item (`variable`, `tool`, `channel` or `knowledge`) is resolved with the agent's normal endpoints; when you read `template-setup`, Platica detects what you already completed and moves it to `done`.
- **Optional items and closing:** only pending items with `required: false` can be skipped (`action: "skip"`). `complete` closes the list when `ready` is `true`; `dismiss` closes it as is.
- **Permissions and credits:** it requires the **Agents** permission. Installing consumes creation credits if applicable (`402 CREDIT_LIMIT_REACHED` if there is no credit). With OAuth the agent is placed under the person's name; with an API key it is born without an owner.

## Endpoints

| Method | Endpoint | What it does |
|--------|----------|--------------|
| `GET` | [`/v1/agent-templates`](/api-reference/agent-templates/list) | List the available templates |
| `POST` | [`/v1/agent-templates/{slug}/install`](/api-reference/agent-templates/install) | Install a template and create a new agent |
| `GET` | [`/v1/agents/{agentId}/template-setup`](/api-reference/agent-templates/setup/get) | See the agent's pending items |
| `POST` | [`/v1/agents/{agentId}/template-setup`](/api-reference/agent-templates/setup/update) | Skip a pending item, finish (`complete`) or dismiss (`dismiss`) |

## The list (`setup`)

Installing and reading the pending items return the same `setup` object:

| Field | Description |
|-------|-------------|
| `template` | The template the agent comes from: `slug`, `name` and `version` |
| `status` | `in_progress`, `completed` or `dismissed` |
| `ready` | `true` when every required item is done: only then does `complete` work |
| `done`, `total` | Items done or skipped, and items in total |
| `slots` | The pending items. See [the pending items](#the-pending-items) |

`setup` is `null` on an agent that doesn't come from a template.

## The pending items

Each item in `slots` has an `id`, a `kind`, a `label`, a `detail`, `required`, a `state` and an `openUrl` (the page in Platica where it can also be resolved, or `null`).

| `kind` | What it asks for | Extra fields |
|--------|------------------|--------------|
| `variable` | Replace the `{{variables}}` in the draft's instructions with your business data | `variables`: `key`, `label` and `placeholder` of each one |
| `tool` | Connect and activate a tool for this agent | `provider`: `type` and `id` |
| `channel` | Give the agent a channel | `channels`: `id` and `name` of the ones the template is made for |
| `knowledge` | Add files to the agent | `hint`: what to add |

`state` is `pending`, `done` or `skipped`. Skipped items count in `done`.

## API key or OAuth

<Collapsible summary="Agent ownership and creator chat">

With an OAuth token, the agent is placed under the person's name and their creator chat in Platica starts with the template. With an API key there is no person: the agent has no owner and no creator chat.

</Collapsible>

## Common errors

| Status | `details.code` | When |
|--------|----------------|------|
| `402` | `CREDIT_LIMIT_REACHED` | The workspace has no credit. Nothing was created |
| `403` | `FORBIDDEN` | Your token only sees your assigned agents and this one isn't yours |
| `404` | `AGENT_NOT_FOUND` | The agent doesn't exist in this workspace |

The rest are listed on each endpoint's page and in [Errors](/api-reference/errors#agent-templates). AI tools are in the [Agents MCP tools](/mcp/tools#agents).
