Skip to content
  • Auto
  • Light
  • Dark
DiscordForumGitHubSign up
View as Markdown
Copy Markdown

Open in Claude
Open in ChatGPT

Import Agent

client.agents.importFile(AgentImportFileParams { file, append_copy_suffix, env_vars_json, 6 more } params, RequestOptionsoptions?): AgentImportFileResponse { agent_ids }
post/v1/agents/import

Import a serialized agent file and recreate the agent(s) in the system. Returns the IDs of all imported agents.

ParametersExpand Collapse
params: AgentImportFileParams { file, append_copy_suffix, env_vars_json, 6 more }

Body param:

formatbinary
Deprecatedappend_copy_suffix?: boolean

Body param: If set to True, appends "_copy" to the end of the agent name.

env_vars_json?: string | null

Body param: Environment variables as a JSON string to pass to the agent for tool execution.

override_embedding_handle?: string | null

Body param: Override import with specific embedding handle.

override_existing_tools?: boolean

Body param: If set to True, existing tools can get their source code overwritten by the uploaded tool definitions. Note that Letta core tools can never be updated externally.

override_name?: string | null

Body param: If provided, overrides the agent name with this value.

project_id?: string | null

Body param: The project ID to associate the uploaded agent with.

strip_messages?: boolean

Body param: If set to True, strips all messages from the agent before importing.

xOverrideEmbeddingModel?: string

Header param:

ReturnsExpand Collapse
AgentImportFileResponse { agent_ids }

Response model for imported agents

agent_ids: Array<string>

List of IDs of the imported agents

Import Agent
import Letta from '@letta-ai/letta-client';

const client = new Letta({
  apiKey: 'My API Key',
});

const response = await client.agents.importFile({ file: fs.createReadStream('path/to/file') });

console.log(response.agent_ids);
{
  "agent_ids": [
    "string"
  ]
}
Returns Examples
{
  "agent_ids": [
    "string"
  ]
}