Skip to main content
FileSystem gives an agent a durable text store for working notes it writes and maintains.
filesystem_agent.py
Install the dependencies, set OPENAI_API_KEY, and run the file twice:
The first process writes notes/decisions.md. The second process connects to the same SQLite database and reads the decision from the same namespace.

How FileSystem Works

  1. FileSystem connects a storage backend to one namespace.
  2. fs.tools() gives the agent file tools.
  3. fs.instructions() provides conventions for maintaining durable notes.
  4. Files remain available to later FileSystem instances that reopen the same persistent storage and normalized namespace.
Compose fs.instructions() with your application instructions as shown above. fs.tools() leaves instruction placement under your control. Set add_instructions=True on the toolkit when automatic placement fits your application. The agent retrieves files on demand with search_content and read_file. File content enters model context only through tool results.

Choose a Backend

SQLite and Postgres store one row per namespace and path. Postgres uses the fs schema and agno_fs table by default.

Isolate or Share Files

FileSystem instances can isolate and group files by namespaces. The default namespace is "default". Use a templated namespace for user-facing agents:
{user_id} resolves from run_context.user_id. {agent_id} and {team_id} resolve from the injected agent and team IDs. A missing value blocks the file operation. Model-supplied tool arguments cannot select another namespace. Namespaces are lowercased and encoded as URL-safe identifiers. Map each identity to a stable ID that does not differ only by case, such as an internal UUID. Use the same static namespace to share files deliberately:
read_only=True limits the tools available to the model. Direct Python methods on the FileSystem object remain available to application code.
Namespaces scope files inside a backend. Enforce user authorization and backend access in your application.

Operational Defaults

Set max_file_bytes and max_namespace_bytes on FileSystem to change the storage limits. Coordinate concurrent read-modify-write edits to the same file. append(unique=True) filters duplicate lines within one check-and-append flow. The check and append are not atomic against concurrent writers, including writers in the same process. Namespace usage checks and writes are also separate operations, so strict quota enforcement requires application-level coordination between concurrent writers. Keep secrets, passwords, and API keys out of FileSystem content.

Use One File Toolkit

FileSystem shares tool names such as read_file, write_file, and list_files with other file-oriented toolkits. Agno keeps the first registration for each tool name and logs a warning for later duplicates. Remember to only attach one file-like toolkit to an agent. Wrap one toolkit in a sub-agent when an application needs both FileSystem and a local workspace.

Developer Resources

Getting Started

Attach FileSystem, use it from Python, and switch storage backends.

Durable Records

Deduplicate recurring work with exact processed-record sets.

Working State

Resume long-running work from durable checkpoints.

Namespaces

Isolate users and share one store between agents.