---
docId: doc_ff351de0373f4c63b5cfcddecf92480c
title: Agents
description: Create and manage AI agents with a draft, versions, publishing, files, tools, escalations and evals.
---

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

# Agents

Create an agent to answer your contacts through Platica channels. Start with [Create an agent](/api-reference/agents/create) and define its instructions in the [configuration](/api-reference/agents/configuration).

To change its behavior, edit the **draft**. Each saved change creates an immutable **version**. [Publish](/api-reference/agents/publications/publish) the version you want to use with your contacts. The API uses `/v1/clients` for contacts.

## Example

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

```bash
# 1. Create an agent (it is born published as v1)
curl -X POST https://api.platic.ai/v1/agents \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Sales", "instructions": "Answer pricing questions briefly."}'

# 2. Edit the draft (creates v2 without publishing), then publish
curl -X PATCH https://api.platic.ai/v1/agents/$AGENT_ID/draft \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"instructions": "Answer in under 80 words."}'

curl -X POST https://api.platic.ai/v1/agents/$AGENT_ID/publication \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

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

```ts
// 1. It is born published as v1
const agent = await platic.agents.create({
  name: "Sales",
  instructions: "Answer pricing questions briefly.",
});

// 2. Edit the draft (creates v2 without affecting production) and publish
await platic.agents.draft.update(agent.id, {
  instructions: "Answer in under 80 words. Never make up prices.",
});
await platic.agents.publish(agent.id);
```

</Ways.Way>
</Ways>

## What you need to know

<Collapsible summary="What changes when you save, publish or connect resources">

- **What is versioned (applies when you publish):** the agent's [configuration](/api-reference/agents/configuration) (instructions, model, guardrails, follow-up, schedule, assistance and [subagents](/api-reference/agents/subagents/link)).
- **What applies live (without creating a version):** name, photo, status and owners ([Update an agent](/api-reference/agents/update)), connected [files](/api-reference/files), [tools](/api-reference/tools) and [channels](/api-reference/channels).
- **Escalations (human assistance):** the [rules](/api-reference/escalations) that tell the agent when to hand a conversation to your team and open a [case](/api-reference/cases). They live inside the configuration, but [connecting](/api-reference/agents/escalations/connect) or [disconnecting](/api-reference/agents/escalations/disconnect) one creates and publishes a new version right away.
- **Going back:** [Restore](/api-reference/agents/drafts/restore) copies an earlier version into the draft without touching production; [Rollback](/api-reference/agents/publications/rollback) publishes a previously published version again without touching the draft.

</Collapsible>

## Endpoints

### Agent, draft, versions and publication

| Method | Endpoint | What it does |
|--------|----------|--------------|
| `GET` / `POST` | [`/v1/agents`](/api-reference/agents/list) | List agents or [create one](/api-reference/agents/create) (published as `v1`) |
| `GET` / `PATCH` / `DELETE` | [`/v1/agents/{agentId}`](/api-reference/agents/get) | Get, [update](/api-reference/agents/update) name, photo, status or owners, or [delete](/api-reference/agents/delete) |
| `POST` | [`/v1/agents/{agentId}/copies`](/api-reference/agents/copy) | Copy an agent from a version (with or without files) |
| `GET` / `PATCH` / `PUT` | [`/v1/agents/{agentId}/draft`](/api-reference/agents/drafts/get) | Read, [edit](/api-reference/agents/drafts/update) or [replace](/api-reference/agents/drafts/replace) the draft |
| `POST` | [`/v1/agents/{agentId}/draft/validate`](/api-reference/agents/drafts/validate) | Validate changes without saving |
| `POST` | [`/v1/agents/{agentId}/draft/restore`](/api-reference/agents/drafts/restore) | Restore an old version into the draft |
| `GET` | [`/v1/agents/{agentId}/versions`](/api-reference/agents/versions/list) | List versions, [get one](/api-reference/agents/versions/get) or [compare two](/api-reference/agents/versions/compare) |
| `GET` / `POST` | [`/v1/agents/{agentId}/publication`](/api-reference/agents/publications/get) | See the current publication or [publish](/api-reference/agents/publications/publish) |
| `POST` | [`/v1/agents/{agentId}/publication/rollback`](/api-reference/agents/publications/rollback) | Go back to a previous publication |
| `GET` | [`/v1/agents/{agentId}/publications`](/api-reference/agents/publications/list) | History of publications and rollbacks |

### Resources connected to the agent

| Area | Main routes |
|------|-------------|
| **Subagents** | [Create](/api-reference/agents/subagents/create), [link](/api-reference/agents/subagents/link) and [unlink](/api-reference/agents/subagents/unlink) under `/draft/subagents` |
| **Files** | [List](/api-reference/agents/files/list), [connect](/api-reference/agents/files/connect), [pause/schedule](/api-reference/agents/files/schedule), [disconnect](/api-reference/agents/files/disconnect) and [processing](/api-reference/agents/files/processing) |
| **Tools** | [List](/api-reference/agents/tools/list), [available](/api-reference/agents/tools/available), [connect](/api-reference/agents/tools/connect), [pause](/api-reference/agents/tools/pause) and [disconnect](/api-reference/agents/tools/disconnect) |
| **Escalations** | [List](/api-reference/agents/escalations/list), [connect](/api-reference/agents/escalations/connect) and [disconnect](/api-reference/agents/escalations/disconnect) |
| **Templates** | [Templates ready to install](/api-reference/agent-templates) |
| **Evals and Chat** | [Test versions with evals](/api-reference/evals) and [talk to an agent in Chat](/api-reference/chat) |

General format in [Responses](/api-reference/responses), errors in [Errors](/api-reference/errors) and AI tools in the [Agents MCP tools](/mcp/tools#agents).
