Exporting & Importing Agents¶
Every agent's configuration can be downloaded as a single, readable definition file (YAML or JSON) and applied back to any agent — the same one (as a backup or to review changes in source control), a second agent in your account (to clone a setup), or an agent in a completely different account (to move or share an agent). This page explains the console workflow, what the file does and doesn't carry, and the CLI and API equivalents.
The model in one line. Export writes the agent's portable definition — everything you configure under Settings — to a file; import applies a definition file to an existing agent, section by section, leaving anything the file doesn't mention untouched.
Exporting an agent¶
In the console, open the agent and go to Settings · Export & import (under Maintenance). Choose Download YAML (recommended — it reads top-to-bottom in the same order as the console's settings pages) or Download JSON.
The document is two-layered, matching how the agent is organized:
- Header — the agent's name, description, template lineage, and model settings (LLM provider, model, temperature).
definition— the authored document, in reading order: identity, personality, guardrails, objectives, playbooks (each carrying its procedures), and message templates (each piece keeps its template lineage, so catalog updates keep working after an import).capabilities— capability configuration: scheduling (including representatives), people (fields and the update permission), knowledge (products), outreach settings, and custom integration contracts.
What the file never contains¶
The export is deliberately limited to the portable definition. It never includes credentials, account-specific links, or conversation data:
| Not exported | Why | After importing |
|---|---|---|
| Channel bindings | Channels (RCS, WhatsApp, SMS, …) are provisioned per account | Set up channels on the new agent |
| Tool bindings & secrets | Bindings carry per-account configuration; secrets (API keys, auth headers) are write-only | Re-enter tool configuration and credentials |
| OAuth connections | Google Calendar / Slack connections belong to the source account | Click Connect again on the new agent |
| Knowledge documents | Uploaded files live in your account's knowledge base | Re-upload documents (or re-run website import) |
| People, conversations, appointments | Customer data, not agent configuration | — |
Because there are no secrets inside, a definition file is safe to keep in source control or hand to another team.
Importing a definition¶
On the target agent, open Settings · Export & import, choose the file, review the list of sections it will overwrite, and confirm.
Import applies the file as a patch:
- Only the sections present in the file are written. A file whose
definitionlayer contains justguardrailschanges nothing else. - A section present with an empty value clears that section on the agent.
- Server-owned fields in the file (
id,framework, secrets, timestamps) are ignored and reported as skipped. - Validation matches the console's own rules — for example, playbooks must include exactly one default.
- Files exported before August 2026 use a retired flat layout and are rejected with a message asking for a re-export.
After the import the console shows exactly which sections were applied and which were skipped.
Imports overwrite
Importing replaces each section it touches wholesale — it doesn't merge item-by-item. If you're experimenting, download a backup export of the target agent first; re-importing that file restores what you had.
Moving an agent to another account¶
- Export the agent as YAML from the source account.
- Switch to the target account (or send the file to its operator) and create a new agent there — a blank one is fine.
- On the new agent, open Settings · Export & import and import the file.
- Reconnect what the file doesn't carry: channels, tool credentials, calendar/OAuth connections, and knowledge documents.
The new agent gets its own id, webhook credentials, and channel addresses — nothing references the source account.
From the CLI¶
The anychat CLI wraps the same endpoints:
# Download a definition
anychat agents export agent-acme-a1b2c3 --output acme.yaml
# Apply a definition to an existing agent
anychat agents import agent-other-d4e5f6 --input acme.yaml
# Create a brand-new agent from a definition in one step
anychat agents create --name "Acme (staging)" --input acme.yaml
Point the CLI at a different account's API key to import across accounts.
From the API¶
Two endpoints under the Agent API:
# Export (YAML by default; ?format=json for JSON)
curl -H "Authorization: Bearer $API_KEY" \
"https://api.anychat.ai/v1/orgs/$ORG/agents/$AGENT/export"
# Import (send the parsed document as JSON)
curl -X POST -H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d @acme.json \
"https://api.anychat.ai/v1/orgs/$ORG/agents/$AGENT/import"
Export needs the agents:read scope (viewer role); import needs
agents:write (editor role).