Agent Serialization: Download and Upload APIs

We’ve added new APIs that allow you to download an agent’s serialized JSON representation and upload it to recreate the agent in the system. These features enable easy agent backup, transfer between environments, and version control of agent configurations.

Import Agent Serialized

Import a serialized agent file and recreate the agent in the system.

1from letta_client import Letta
2client = Letta(
3 token="YOUR_API_KEY",
4)
5agent = client.agents.import_agent_serialized(
6 file=open("/path/to/agent/file.af", "rb"),
7)

Export Agent Serialized

Export the serialized JSON representation of an agent, formatted with indentation.

1from letta_client import Letta
2client = Letta(
3 token="YOUR_API_KEY",
4)
5agent_json = client.agents.export_agent_serialized(
6 agent_id="AGENT_ID",
7)

Use Cases

  • Environment Migration: Transfer agents between local, desktop, and cloud environments
  • Version Control: Save agent configurations before making significant changes
  • Templating: Create template agents that can be quickly deployed for different use cases
  • Sharing: Share agent configurations with team members or across organizations