skopik

Agent Templates

Agent templates package a starting profile, brain files, and settings for repeatable agent creation. Every template carries an editable draft file tree; publishing freezes the draft into a numbered version, and use() creates a new agent from a version.

The methods on this page live on client.agents.templates, which scopes every call to agent-kind templates. The same methods exist on client.teams.templates for team-kind templates — but team-kind templates are instantiated with teams.createFromTemplate() on the Teams page, while use() applies to agent-kind templates only.

Quick Links

Action Description
agents.templates.list() List agent templates.
agents.templates.create() Create a template with a draft file tree.
agents.templates.get() Fetch a single template.
agents.templates.update() Update template details.
agents.templates.archive() Archive a template.
agents.templates.publish() Publish the draft as a new version.
agents.templates.duplicate() Copy a template and its files.
agents.templates.use() Create an agent from a template.
agents.templates.files.list() List files in a template tree.
agents.templates.files.read() Read a template file.
agents.templates.files.write() Write a file in the draft tree.
agents.templates.files.delete() Delete a file from the draft tree.
agents.templates.files.move() Move or rename a draft file.

Example

Create an agent from a published template:

const { agent } = await client.agents.templates.use(templateId, {
	name: 'Support Analyst',
})

Reference

agents.templates.list(params?)

List agent templates. The sub-client sets kind=agent on the query automatically.

const { data: templates } = await client.agents.templates.list({ source: 'curated' })

Parameters

Field Type Required Notes
kind string No Set to agent automatically by this sub-client.
source string No Filter by user or curated.
tags string[] No Filter by tags.

Returns ListResponse<Template> = { data: Template[], page? } — see Template.

agents.templates.create(input)

Create an agent template. files seeds the draft tree, which you can keep editing with files.write() before publishing.

const { template } = await client.agents.templates.create({
	name: 'Support Analyst',
	description: 'Triages inbound support threads and drafts replies.',
	files: [
		{ path: 'instructions.md', content: 'Always link the relevant ticket.' },
	],
})

Parameters

Field Type Required Notes
name string Yes Template name.
description string No Template description.
tags string[] No Tags.
icon string No Icon.
color string No Accent color.
role string No Role label for agents created from the template.
metadata object No Customer metadata.
files { path, content }[] No Seeds the draft file tree.

Returns { template: Template } — see Template.

agents.templates.get(templateId)

Fetch a single template.

const { template } = await client.agents.templates.get(templateId)

Returns { template: Template } — see Template.

agents.templates.update(templateId, input)

Update template details. All fields are optional; only the fields you pass change.

const { template } = await client.agents.templates.update(templateId, {
	description: 'Triages support threads, drafts replies, and escalates bugs.',
	tags: ['support'],
})

Parameters

Field Type Required Notes
name string No Template name.
description string No Template description.
tags string[] No Tags.
icon string No Icon.
color string No Accent color.
role string No Role label for agents created from the template.
metadata object No Customer metadata.
files { path, content }[] No File entries written to the draft tree.

Returns { template: Template } — see Template.

agents.templates.archive(templateId)

Archive a template.

await client.agents.templates.archive(templateId)

Returns nothing — resolves when the API confirms the archive (HTTP 204).

agents.templates.publish(templateId)

Publish the draft file tree as a new template version. Publishing is asynchronous — the returned operation tracks it.

const { template, operation } = await client.agents.templates.publish(templateId)

Returns { template: Template, operation: Operation } — see Template and Operation.

agents.templates.duplicate(templateId, input?)

Copy a template, including its files, into a new template you own.

const { template: copy, copiedFiles } = await client.agents.templates.duplicate(templateId, {
	name: 'Support Analyst (EU)',
})

Parameters

Field Type Required Notes
name string No Name for the copy.
description string No Description for the copy.
tags string[] No Tags for the copy.
metadata object No Customer metadata.

Returns { template: Template, copiedFiles: number } — see Template.

agents.templates.use(templateId, input?)

Create an agent from an agent-kind template. Setup is asynchronous — the returned operation tracks it. Team-kind templates are instantiated with teams.createFromTemplate() instead.

const { agent, operation } = await client.agents.templates.use(templateId, {
	name: 'Support Analyst',
	displayName: 'Support Analyst (EU)',
})

Parameters

Field Type Required Notes
name string No Override the agent name.
userId string No User id to associate with the new agent.
slug string No Agent slug.
displayName string No Override the display name.
avatarUrl string No Avatar image URL.
version string | number No Which tree to instantiate from: published (default), draft, or a version number.

Returns { agent: Agent, operation: Operation } — see Agent and Operation.

agents.templates.files.list(templateId, params?)

List files in a template tree.

const { data: files } = await client.agents.templates.files.list(templateId)

Parameters

Field Type Required Notes
version number No Published version to list. Omit for the draft tree.

Returns { version, data: CatalogFileEntry[] } — see CatalogFileEntry.

agents.templates.files.read(templateId, filePath, params?)

Read a single template file.

const { file } = await client.agents.templates.files.read(templateId, 'instructions.md')

Parameters

Field Type Required Notes
version number No Published version to read from. Omit for the draft tree.

Returns { file: CatalogFile } — see CatalogFile.

agents.templates.files.write(templateId, filePath, input)

Write a file. Writes always target the draft tree — publish the template to make them live.

const { file } = await client.agents.templates.files.write(templateId, 'instructions.md', {
	content: 'Always link the relevant ticket. Escalate anything involving billing.',
})

Parameters

Field Type Required Notes
content string Yes File content.

Returns { file: CatalogFileEntry } — see CatalogFileEntry.

agents.templates.files.delete(templateId, filePath)

Delete a file from the draft tree.

await client.agents.templates.files.delete(templateId, 'instructions.md')

Returns nothing — resolves when the API confirms deletion (HTTP 204).

agents.templates.files.move(templateId, input)

Move or rename a file in the draft tree.

const { data: files } = await client.agents.templates.files.move(templateId, {
	from: 'instructions.md',
	to: 'docs/instructions.md',
})

Parameters

Field Type Required Notes
from string Yes Current file path.
to string Yes New file path.

Returns { data: CatalogFileEntry[] } — see CatalogFileEntry.

Types

Template

Field Type Notes
templateId string Template id.
orgId string Workspace id.
kind string agent or team.
name string Template name.
description string Template description.
tags string[] Tags.
currentVersion number Latest published version.
draftVersion number Draft version.
hasUnpublishedDraft boolean Whether a draft differs from published.
source string user or curated source.
metadata object Customer metadata.
createdAt string ISO timestamp.
updatedAt string ISO timestamp.

CatalogFile

Field Type Notes
path string File path within the tree.
content string File content.

CatalogFileEntry

Field Type Notes
path string File path within the tree.
dir boolean Whether the entry is a directory.
size number File size in bytes.