Skip to main content

Durable workspace folders for Python agents

Project description

SmolFS Python SDK

SmolFS gives Python agents a workspace folder that can survive after the agent process stops. You can create a volume, mount it like a normal directory, write files into it, flush important changes, unmount it, and mount the same files again later.

The Python package is a native SDK over the same Rust core as the smolfs command. It is useful when an agent runner or automation service wants to manage workspace volumes without shelling out for every operation.

Install

Install the Python SDK with uv:

uv add smolfs

Mounting volumes also needs SmolFS' managed storage backend on the machine. The installer sets up both the CLI and backend:

curl -fsSL https://raw.githubusercontent.com/CelestoAI/smolfs/main/scripts/install.sh | SMOLFS_INSTALL_PYTHON=1 sh

If you only need the Python package inside an existing project or virtual environment, uv add smolfs is enough.

Quickstart

Start with a local development volume:

from pathlib import Path

from smolfs import SmolFS, doctor

report = doctor()
if not report["storage_backend"]["found"] or not report["mount_support"]["found"]:
    raise RuntimeError(f"SmolFS is not ready: {report}")

fs = SmolFS.from_env()
volume = fs.ensure_volume("demo", dev=True)
mount = fs.mount(volume.name, "./workspace")

workspace = Path(mount.mountpoint)
(workspace / "hello.txt").write_text("hello from SmolFS\n")

try:
    fs.flush(volume.name)
finally:
    fs.unmount(volume.name)

dev=True creates a local-only volume. It is the easiest way to test SmolFS on a single machine before connecting shared metadata and object storage.

Cloud Volumes

Cloud volumes use the same API with explicit metadata and object storage settings:

from smolfs import SmolFS

fs = SmolFS.from_env()
fs.ensure_volume(
    "agent-workspace",
    metadata="redis://localhost:6379/1",
    storage="s3",
    bucket="https://my-bucket.s3.us-east-2.amazonaws.com",
)

Keep storage credentials in the environment used by SmolFS. Do not print them in logs or store them in source files.

API Overview

  • doctor() checks whether the machine can create and mount volumes.
  • SmolFS.from_env() creates a client using SMOLFS_HOME and the current environment.
  • ensure_volume(...) creates a volume if it does not exist and returns the existing volume if it does.
  • init(...) creates a new volume.
  • mount(name, path) mounts a volume at a local directory.
  • flush(name) asks SmolFS to sync important writes.
  • unmount(name) unmounts a mounted volume.
  • status(name=None) lists known volumes and mountpoints.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smolfs-0.1.1.tar.gz (20.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

smolfs-0.1.1-cp39-abi3-manylinux_2_39_x86_64.whl (522.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.39+ x86-64

smolfs-0.1.1-cp39-abi3-macosx_11_0_arm64.whl (471.5 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file smolfs-0.1.1.tar.gz.

File metadata

  • Download URL: smolfs-0.1.1.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for smolfs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3fec2b5b352095d73ec0da95c9396d3a0d5fd93d53773612d722dce16c1acdef
MD5 5f1d2073519785b5b783eb3fcc17fda1
BLAKE2b-256 c5aa990c164f0e17158183426301f4e7651cfb0c5f58ff36c47d533f831fbf92

See more details on using hashes here.

Provenance

The following attestation bundles were made for smolfs-0.1.1.tar.gz:

Publisher: publish-python.yml on CelestoAI/smolfs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smolfs-0.1.1-cp39-abi3-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for smolfs-0.1.1-cp39-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 f8ef322daa6c663251a5569c45ff338842b1ec7c023d041736c6cf82f4108fcd
MD5 68725e57fdbcc4b62b0e26a6394aed03
BLAKE2b-256 1c4445d0be85f0651b1c0f1116c61d3ed85219f5ca42c7a4b21696cbf543900a

See more details on using hashes here.

Provenance

The following attestation bundles were made for smolfs-0.1.1-cp39-abi3-manylinux_2_39_x86_64.whl:

Publisher: publish-python.yml on CelestoAI/smolfs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smolfs-0.1.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: smolfs-0.1.1-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 471.5 kB
  • Tags: CPython 3.9+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for smolfs-0.1.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7122e2c7d3354bdaf33b27c82394ff5ba05fdd63ff4f9f9ccda21cbf80c2ac99
MD5 38b1b096723a88ad60e4b23c84eb3ea1
BLAKE2b-256 356968fa6268a72ccd3d8bea71b2ebf2a31ce0a51e56ea7fd4d8c2fe4d831a4a

See more details on using hashes here.

Provenance

The following attestation bundles were made for smolfs-0.1.1-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: publish-python.yml on CelestoAI/smolfs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page