Skip to main content

tai42-storage-local

License: Apache 2.0

Local-filesystem storage backend for the TAI ecosystem. It implements the tai42_contract.storage.Storage contract over a directory tree on the local disk, serving both text and binary content, and registers itself as the active storage provider when its package is imported.

The TAI ecosystem

TAI is an open-source runtime for MCP tools, agents, and workflows. A Storage backend answers the question of where content physically lives — a template, a document, or a media file loaded by id. This package is the local-filesystem implementation; siblings back the same contract with S3 (tai42-storage-s3) and GitHub (tai42-storage-github). The ecosystem is open-ended: any package can back the same contract, so this repo is this provider's own full doc home, and the documentation site covers the platform-level story:

Install

Requires Python 3.13+. Install from PyPI into the environment that runs the server:

uv add tai42-storage-local

Or from source — clone this repo and add it as an editable dependency; the tai42-* dependencies resolve in-tree from the workspace.

git clone https://github.com/tai42ai/tai42   # next to your app checkout
cd /path/to/your/app
uv add --editable ../tai42/plugins/storage-local

Discovery

A backend is activated by a manifest, not an entry point. Name this package in the manifest's storage_module field; the runtime imports it, and the @tai42_app.storage.register_storage decorator fires as an import side-effect to register LocalStorage as the active provider:

storage_module: tai42_storage_local

There is no auto-discovery — importing the package is the registration.

Configuration

Settings are read from the environment (or a .env file) with the STORAGE_LOCAL_ prefix:

Variable Default Description
STORAGE_LOCAL_ROOT_PATH ./templates The base directory every stored path is resolved under.
STORAGE_LOCAL_CREATE_DIRS true Create missing parent directories on write.

Contract surface

LocalStorage implements the full eight-method Storage contract:

  • Text: load (raises FileNotFoundError when missing), list, upload, delete, delete_dir.
  • Binary/media: load_bytes / upload_bytes read and write raw bytes directly (no encoding); stat inherits the contract's mimetypes-based path inference, since the local filesystem stores no content-type metadata.

Every path is resolved under the configured root and rejected if it escapes it (a path-boundary check, not a string prefix), and delete_dir refuses the storage root via the shared assert_not_root guard.

Development

uv venv --python 3.13
uv pip install --no-sources --group dev --editable .
uv run --no-sync pytest --cov --cov-report=term-missing
uv run --no-sync ruff check .
uv run --no-sync ruff format --check .
uv run --no-sync pyright

License

Apache-2.0. See LICENSE and NOTICE.

Download files

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

Source Distribution

tai42_storage_local-0.2.5.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

tai42_storage_local-0.2.5-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file tai42_storage_local-0.2.5.tar.gz.

File metadata

  • Download URL: tai42_storage_local-0.2.5.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for tai42_storage_local-0.2.5.tar.gz
Algorithm Hash digest
SHA256 b1fbf4fe7481f1ae980a03655cc81207822cc12c29a6fbcf937a48168571f9d5
MD5 4c0cfa5a6d67904e8d90a793e843a699
BLAKE2b-256 d51e544eece6736466a72b12daed7a4e0d22e6555bf6542b16421a8e80987a8f

See more details on using hashes here.

File details

Details for the file tai42_storage_local-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for tai42_storage_local-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7c0f3b514298c3e57e38b8866d081f236ddd76b8d0cc0e597a21e2f9cbd2a40c
MD5 d032716bf16da4aeda0baa6e21cc33a6
BLAKE2b-256 2e6a0f8db2bbbee96c7ceca5a2c4f00ccd9b0afbc8180e476c30333d861ac474

See more details on using hashes here.

Supported by

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