---
title: "Clone an agent"
method: POST
path: "/v1/fleet/agents/{agent_id}/clone"
tags: ["agents"]
---

# Clone an agent

`POST /v1/fleet/agents/{agent_id}/clone`

Creates a new agent that mirrors the source agent's behaviour
but is owned by the calling identity. Creation is atomic — the
clone is either fully created or no state is persisted.

What is copied from the source:
* `description`
* `runtime` (model configuration)
* `backend` (backend type + sandbox configuration)
* `system_prompt`, `tools`, `subagents`, `skills`
* any leftover files outside the typed fields above (e.g.
`docs/README.md` attached via the escape `files` field)

What the caller can override (sent in the request body):
* `name` — defaults to `"<source name> (Copy)"`
* `permissions` — defaults to the source's `identity` with
`visibility=user` and `tenant_access_level=read`. When
supplied the object fully replaces the default; PATCH-style
merging does not apply.

What is always reset for the clone (you cannot override these):
* agent ID, agent version, owner, timestamps
* stamped user context (`user_email`, `user_name`,
`user_timezone` — taken from the calling identity + the
`X-User-Timezone` header)

What is never copied (start fresh on the clone):
* `extras` (caller-defined metadata bag, e.g. icon
customisations, template IDs)
* caller-defined `configurable` bag entries
* sharing state, tokens, triggers, and schedules

Cloning a built-in system template returns 422.

## Path parameters

- `agent_id` string, uuid, required

## Query parameters

- `include_files` boolean

## Request body

- AgentsCloneAgentRequest
  - `name` string
  - `permissions` AgentsAgentPermissions
    - `identity` 'personal' | 'shared'
    - `shared_users` AgentsSharedUsers
      - `read` string[] — User IDs allowed to read the agent.
      - `run` string[] — User IDs allowed to run the agent.
      - `update` string[] — User IDs allowed to update the agent.
    - `tenant_access_level` 'read' | 'run' | 'write'
    - `visibility` 'tenant' | 'user'

## Response `201`

Created

- AgentsAgent
  - `access_level` 'READ' | 'RUN' | 'WRITE'
  - `backend` AgentsAgentBackend
    - `sandbox` AgentsSandboxConfig
      - `delete_after_stop_seconds` integer — Time after a sandbox is stopped before it is deleted, in seconds.
      - `idle_ttl_seconds` integer — Idle timeout after which an unused sandbox is paused, in seconds.
      - `policy_ids` string[] — Sandbox policies governing tool execution.
      - `snapshot_id` string — Snapshot used when creating new sandbox-backed computers.
    - `type` 'default' | 'thread_scoped_sandbox' | 'agent_scoped_sandbox' — Execution backend type. Use a scoped sandbox backend for sandbox-backed agents.
  - `created_at` string, date-time
  - `description` string
  - `extras` object
  - `files` object — Raw file map. Returned only when `include_files=true`.
  - `id` string, uuid
  - `instructions` string — Deprecated: use `system_prompt`. Echoed alongside `system_prompt` with the same value for backwards compatibility.
  - `is_owner` boolean
  - `name` string
  - `owner_id` string, uuid
  - `permissions` AgentsAgentPermissions
    - `identity` 'personal' | 'shared'
    - `shared_users` AgentsSharedUsers
      - `read` string[] — User IDs allowed to read the agent.
      - `run` string[] — User IDs allowed to run the agent.
      - `update` string[] — User IDs allowed to update the agent.
    - `tenant_access_level` 'read' | 'run' | 'write'
    - `visibility` 'tenant' | 'user'
  - `revision` string
  - `runtime` AgentsAgentRuntime
    - `model` AgentsAgentModelConfig
      - `model_id` string — Model ID used to run the agent.
  - `skills` AgentsSkillSpec[] — Skills parsed from `skills/<name>/SKILL.md` and supporting files.
    - `description` string — Short human-readable description shown to the agent.
    - `files` object — Supporting files keyed by relative path. Each path becomes `skills/<name>/<path>`. Paths must be relative — no leading `/`, no `..` segments.
    - `instructions` string — Skill body. Written to `skills/<name>/SKILL.md`.
    - `name` string — Skill slug. Becomes `skills/<name>/SKILL.md`.
    - `type` 'inline' — Skill discriminator. Only `inline` is supported today.
  - `subagents` AgentsSubagentSpec[] — Subagents parsed from `subagents/<name>/AGENTS.md` + `subagents/<name>/tools.json`.
    - `description` string — Short human-readable description.
    - `instructions` string — Subagent system prompt. Written to `subagents/<name>/AGENTS.md`.
    - `model_id` string — Model ID for this subagent. Inherits the parent runtime when empty.
    - `name` string — Subagent slug. Becomes `subagents/<name>/AGENTS.md`.
    - `tools` AgentsToolsConfig
      - `interrupt_config` object — Per-tool interrupt rules keyed by tool name. Use `{}` for no interrupts.
      - `tools` AgentsToolSpec[] — MCP tools available to the agent. Serialised to `tools.json`.
        - `display_name` string — Display name for the tool. Defaults to the tool name when empty.
        - `mcp_server_name` string — Display name for the MCP server. Defaults to the URL when empty.
        - `mcp_server_url` string — URL of the MCP server hosting this tool.
        - `name` string — Tool name as exposed by the MCP server.
  - `system_prompt` string — Agent system prompt parsed from `AGENTS.md`.
  - `tools` AgentsToolsConfig
    - `interrupt_config` object — Per-tool interrupt rules keyed by tool name. Use `{}` for no interrupts.
    - `tools` AgentsToolSpec[] — MCP tools available to the agent. Serialised to `tools.json`.
      - `display_name` string — Display name for the tool. Defaults to the tool name when empty.
      - `mcp_server_name` string — Display name for the MCP server. Defaults to the URL when empty.
      - `mcp_server_url` string — URL of the MCP server hosting this tool.
      - `name` string — Tool name as exposed by the MCP server.
  - `updated_at` string, date-time

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `422` — Unprocessable Entity
- `500` — Internal Server Error
- `502` — Bad Gateway
- `503` — Service Unavailable

---

[API](https://skmtc.net/langchain-ai/apis/langsmith.md) · [All operations](https://skmtc.net/langchain-ai/apis/langsmith/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/langchain-ai/langsmith/versions/a0acb3a6a101/schema)
