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

Open in Claude
Open in ChatGPT

Import Agent

agents.import_file(AgentImportFileParams**kwargs) -> AgentImportFileResponse
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
file: FileTypes
Deprecatedappend_copy_suffix: Optional[bool]

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

env_vars_json: Optional[str]

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

override_embedding_handle: Optional[str]

Override import with specific embedding handle.

override_existing_tools: Optional[bool]

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: Optional[str]

If provided, overrides the agent name with this value.

project_id: Optional[str]

The project ID to associate the uploaded agent with.

strip_messages: Optional[bool]

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

x_override_embedding_model: Optional[str]
ReturnsExpand Collapse
class AgentImportFileResponse:

Response model for imported agents

agent_ids: List[str]

List of IDs of the imported agents

Import Agent
from letta_client import Letta

client = Letta(
    api_key="My API Key",
)
response = client.agents.import_file(
    file=b"raw file contents",
)
print(response.agent_ids)
{
  "agent_ids": [
    "string"
  ]
}
Returns Examples
{
  "agent_ids": [
    "string"
  ]
}