Skip to main content
The AgentFS Python SDK provides an async interface for building AI agents with persistent storage.

Installation

Quick Start

Opening a Filesystem

By Agent ID

Creates database at .agentfs/{id}.db:

By Path

Specify a custom database path:

Context Manager

Automatically closes the database:

Key-Value Store

Simple key-value storage with JSON serialization.

Set a Value

Get a Value

List Keys

Delete a Key

Filesystem

POSIX-like filesystem operations.

Write a File

Creates parent directories automatically:

Read a File

List Directory

Get File Stats

Delete a File

Create Directory

Tool Calls

Track and analyze tool/function calls for debugging and auditing.

Start and Complete

Record Completed Call

If you have start and end times:

Query Tool Calls

Get Statistics

Complete Example

API Reference

AgentFS

AgentFSOptions

KvStore

Filesystem

ToolCalls

Next Steps

OpenAI Agents

Using AgentFS with OpenAI Agents SDK

LlamaIndex

Using AgentFS with LlamaIndex