Skip to main content
This guide explains how to migrate agents from one Langdock workspace to another using the Agents API. This is useful when you want to replicate agent configurations across different workspaces, move agents during organizational restructuring, or create backup copies of your agents.

Before You Start

  • Agents API: This is the Agents API with native Vercel AI SDK compatibility.

Overview

The migration process involves two main steps:
  1. Export: Retrieve the agent configuration from the source workspace using the Agent Get API
  2. Import: Create a new agent in the target workspace using the Agent Create API

Prerequisites

Before you begin, ensure you have:
  1. Two API keys with the Agent API scope:
    • One API key for the source workspace (where the agent currently exists)
    • One API key for the target workspace (where you want to migrate the agent)
  2. Access to the agent: Your source workspace API key must have access to the agent you want to migrate
  3. Matching resources in target workspace (if applicable):
    • If the target workspace does not have access to the same model, set model in the script to an available deployment name before migration
    • If the agent uses custom actions, those integrations must be enabled in the target workspace
    • Attachments need to be re-uploaded separately (they are not transferred automatically)
    • Skills need to exist in the target workspace. Skill UUIDs from the source workspace are not transferred
    • Subagents and workflows need to exist in the target workspace. Their UUIDs from the source workspace are not transferred

Step 1: Export the Agent from Source Workspace

Use the Agent Get API to retrieve the settings available for your agent:

Understanding the Response

The Get API returns the following agent settings:
  • name, description, instruction - The agent’s identity and system prompt
  • emojiIcon - The emoji icon displayed for the agent
  • model - Identifier of the model being used (e.g., gpt-5-mini-eu)
  • temperature - Creativity setting (0-1)
  • conversationStarters - Suggested prompts for users
  • inputType - The configured input type
  • inputFields - Form fields, including slug, options, fileTypes, and emailDomain
  • webSearchEnabled, imageGenerationEnabled, canvasEnabled - Capability flags
  • extendedThinking - Whether extended thinking is enabled
  • actions - Custom integration actions
  • attachments - UUIDs of attached files
  • knowledgeFolderIds - UUIDs of connected Folders
  • skillIds - UUIDs of attached Skills
  • subAgents - Attached subagents, each with agentId and requiresConfirmation
  • workflowIds - UUIDs of attached workflows
  • owner - current owner ({ id, name, email }), or null if unassigned
  • access - current sharing when the key has a direct editor or owner grant. See Agent Get API
canvasEnabled is read-only in these endpoints and is not transferred by this migration. owner is not transferred either. access uses ids from the source workspace and is not copied. The key owner becomes the owner in the target workspace.

Step 2: Transform the Configuration

The Get API response uses slightly different field names than the Create API expects. You need to map the fields:

Field Mapping Reference

Step 3: Create the Agent in Target Workspace

Use the Agent Create API to create the agent in the target workspace:

Complete Migration Script

Here’s a complete script that combines all steps:

Handling Special Cases

Form Fields

Each field includes slug, options, fileTypes, and emailDomain. Copy inputFields into the Create API request, and omit description when it is null. The Create API rejects null for description. options is [] when a field has no choices, and fileTypes and emailDomain may be null.

Actions (Custom Integrations)

Actions reference integrations that must be enabled in the target workspace. Action UUIDs are specific to each workspace’s integration setup.
Exclude actions from the initial migration and manually configure them in the target workspace after the agent is created.

Attachments

Attachment UUIDs reference files stored in the source workspace. These files are not automatically transferred. To migrate attachments:
  1. Download the files from the source workspace
  2. Re-upload them to the target workspace using the Upload Attachment API
  3. Update the agent with the new attachment UUIDs

Skills

Create or import the Skills in the target workspace with the Skills API, then set skillIds on the new agent. Skill IDs from the source workspace are not reused.

Subagents and workflows

Create the subagents and workflows in the target workspace, then set subAgents and workflowIds on the new agent. IDs from the source workspace are not reused. You can copy requiresConfirmation onto each subagent. An agent set to Direct only cannot be attached, and each workflow must be active.

OAuth Connections

Pre-selected OAuth connections are not supported via the API. Users must configure OAuth connections through the Langdock UI after migration.

Migrating Multiple Agents

To migrate multiple agents, simply loop through a list of agent IDs:

Post-Migration Checklist

After migrating an agent, verify the following in the target workspace:
  • Agent appears in the Agents list with correct name and emoji
  • Description and instructions are correctly transferred
  • Model is available in the target workspace
  • Conversation starters are present
  • Capabilities (web search, image generation, etc.) are correctly enabled
  • Input fields are properly configured (for STRUCTURED input type)
  • Manually configure any OAuth connections through the UI
  • Re-upload and attach any necessary files
  • Attach Skills using IDs from the target workspace
  • Attach subagents and workflows using IDs from the target workspace
  • Configure custom actions/integrations if needed
  • Test the agent by sending a message

Limitations

Keep these limitations in mind when planning your migration:
  1. Attachments are not transferred - Files must be re-uploaded to the target workspace
  2. Actions may need reconfiguration - Integration action UUIDs are workspace-specific
  3. OAuth connections require manual setup - Cannot be configured via API
  4. Model access must match - The Create API rejects a model that is not available in the target workspace. Set an available deployment name before migration
  5. Conversation history is not migrated - Only the agent configuration is transferred
  6. Skills are not transferred - Create the Skills in the target workspace, then attach them with skillIds
  7. Subagents and workflows are not transferred - Create them in the target workspace, then attach them with subAgents and workflowIds
Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on API Key Best Practices.