Skip to content

Agent File (.af): An open file format for serializing stateful AI agents with persistent memory and behavior. Share, checkpoint, and version control agents across compatible frameworks.

License

Notifications You must be signed in to change notification settings

letta-ai/agent-file

Repository files navigation

Agent File (.af): An open standard file format for stateful agents.


Agent File (.af): An open file format for stateful agents.

Discord License


Agent File (.af) is an open standard file format for serializing stateful AI agents. Originally designed for the Letta framework, Agent File provides a portable way to share agents with persistent memory and behavior.

Agent Files package all components of a stateful agent: system prompts, editable memory (personality and user information), tool configurations (code and schemas), and LLM settings. By standardizing these elements in a single format, Agent File enables seamless transfer between compatible frameworks, while allowing for easy checkpointing and version control of agent state.

πŸ‘Ύ Download Example Agents

Browse our collection of ready-to-use agents below. Each agent has a direct download link (to download the .af file) and a separate instructions README with a guide on how to use the agent. To contribute your own Agent File to the repo, simply open a pull request!

To use one of the agents, download the agent file (.af) by clicking the link below, then upload it to Letta or any other framework that supports Agent File.

Agent Type Description Download Instructions
🧠 MemGPT An agent with memory management tools for infinite context, as described in the MemGPT paper. Two example files: a fresh agent and one with an existing conversation history (pre-fill). Download (empty) Download (pre-fill) README
πŸ“š Deep Research A research agent with planning, search, and memory tools to enable writing deep research reports from iterative research
⚠️ NOTE: requires Tavily and Firecrawl keys
Download README
πŸ§‘β€πŸ’Ό Customer Support A customer support agent that has dummy tools for handling order cancellations, looking up order status, and also memory Download README
πŸ•ΈοΈ Stateless Workflow A stateless graph workflow agent (no memory and deterministic tool calling) that evaluates recruting candidates and drafts emails Download README
πŸ™ Composio Tools An example of an agent that uses a Composio tool to star a GitHub repository
⚠️ Note: requires enabling Composio
Download README

Using .af with Letta

You can import and export .af files to and from any Letta Server (self-deployed with Docker or Letta Desktop, or via Letta Cloud). To run the import and export commands, you can use the visual Agent Development Environment (ADE), or the REST APIs or developer SDKs (Python and TypeScript).

Importing Agents

Load downloaded .af files into your ADE to easily re-create your agent:

Importing Demo

cURL

# Assuming a Letta Server is running at http://localhost:8283
curl -X POST "http://localhost:8283/v1/agents/import" -F "file=/path/to/agent/file.af"

Node.js (TypeScript)

// Install SDK with `npm install @letta-ai/letta-client`
import { LettaClient } from '@letta-ai/letta-client'
import { readFileSync } from 'fs';
import { Blob } from 'buffer';

// Assuming a Letta Server is running at http://localhost:8283
const client = new LettaClient({ baseUrl: "http://localhost:8283" });

// Import your .af file from any location
const file = new Blob([readFileSync('/path/to/agent/file.af')])
const agentState = await client.agents.importAgentSerialized(file, {})

console.log(`Imported agent: ${agentState.id}`);

Python

# Install SDK with `pip install letta-client`
from letta_client import Letta

# Assuming a Letta Server is running at http://localhost:8283
client = Letta(base_url="http://localhost:8283")

# Import your .af file from any location
agent_state = client.agents.import_agent_serialized(file=open("/path/to/agent/file.af", "rb"))

print(f"Imported agent: {agent.id}")

Exporting Agents

You can export your own .af files to share (or contribute!) by selecting "Export Agent" in the ADE:

Exporting Demo

cURL

# Assuming a Letta Server is running at http://localhost:8283
curl -X GET http://localhost:8283/v1/agents/{AGENT_ID}/export

Node.js (TypeScript)

// Install SDK with `npm install @letta-ai/letta-client`
import { LettaClient } from '@letta-ai/letta-client'

// Assuming a Letta Server is running at http://localhost:8283
const client = new LettaClient({ baseUrl: "http://localhost:8283" });

// Export your agent into a serialized schema object (which you can write to a file)
const schema = await client.agents.exportAgentSerialized("<AGENT_ID>");

Python

# Install SDK with `pip install letta-client`
from letta_client import Letta

# Assuming a Letta Server is running at http://localhost:8283
client = Letta(base_url="http://localhost:8283")

# Export your agent into a serialized schema object (which you can write to a file)
schema = client.agents.export_agent_serialized(agent_id="<AGENT_ID>")

FAQ

Why Agent File?

The AI ecosystem is witnessing rapid growth in agent development, with each framework implementing its own storage mechanisms. Agent File addresses the need for a standard that enables:

  • πŸ”„ Portability: Move agents between systems or deploy them to new environments
  • 🀝 Collaboration: Share your agents with other developers and the community
  • πŸ’Ύ Preservation: Archive agent configurations to preserve your work
  • πŸ“ Versioning: Track changes to agents over time through a standardized format

What state does .af include?

A .af file contains all the state required to re-create the exact same agent:

Component Description
Model configuration Context window limit, model name, embedding model name
Message history Complete chat history with in_context field indicating if a message is in the current context window
System prompt Initial instructions that define the agent's behavior
Memory blocks In-context memory segments for personality, user info, etc.
Tool rules Definitions of how tools should be sequenced or constrained
Environment variables Configuration values for tool execution
Tools Complete tool definitions including source code and JSON schema

We currently do not support Passages (the units of Archival Memory in Letta/MemGPT), which have support for them on the roadmap.

You can view the entire schema of .af in the Letta repository here.

Does .af work with frameworks other than Letta?

Theoretically, other frameworks could also load in .af files if they convert the state into their own representations. Some concepts, such as context window "blocks" which can be edited or shared between agents, are not implemented in other frameworks, so may need to be adapted per-framework.

How can I add Agent File support to my framework?

Adding .af support requires mapping Agent File components (agent state) to your framework's equivalent featureset. The main steps include parsing the schema, translating prompts/tools/memory, and implementing import/export functionality.

For implementation details or to contribute to Agent File, join our Discord community or check the Letta GitHub repository.

How does .af handle secrets?

Agents have associated secrets for tool execution in Letta (see docs). When you export agents with secrets, the secrets are set to null.

🀝 Contributing

We're just launching Agent File and would love your help in shaping its future:

  • Share Example Agents: Contribute your own .af files by opening a pull request with your agent and usage instructions
  • Join the Discussion: Connect with other agent developers in our Discord server to share ideas and agent files
  • Provide Feedback: Open GitHub issues with suggestions, feature requests, or to report compatibility challenges
  • Help Refine the Format: As an emerging format, Agent File will evolve based on community input and real-world usage

Roadmap

  • Support MCP servers/configs
  • Support archival memory passages
  • Support data sources (i.e. files)
  • Migration support between schema changes
  • Multi-agent .af files
  • Converters between frameworks

Made with ❀️ by the Letta team and OSS contributors

Documentation β€’ Community β€’ GitHub

About

Agent File (.af): An open file format for serializing stateful AI agents with persistent memory and behavior. Share, checkpoint, and version control agents across compatible frameworks.

Resources

License

Stars

Watchers

Forks

Languages