Skip to main content

tai42-storage-github

CI License: Apache 2.0

A GitHub-backed Storage provider for the TAI ecosystem. It stores content as files in a GitHub repository and serves the full tai42_contract.storage.Storage surface — the text methods (load / list / upload / delete / delete_dir) plus the binary/media methods (load_bytes / upload_bytes / stat).

The TAI ecosystem

TAI is an open-source runtime for MCP tools, agents, and workflows. A Storage backend is "where content physically lives" — a pluggable provider the runtime's ResourceManager loads and renders content over. This package is one such provider (GitHub); siblings back the same contract with S3 (tai42-storage-s3) and the local filesystem (tai42-storage-local). 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-github

Or from source — clone this repo and add it as an editable dependency. Clone tai-contract and tai-kit beside this repo first — [tool.uv.sources] resolves them from sibling paths.

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

Use

The backend is loaded by import side-effect: importing the tai42_storage_github package runs its @tai42_app.storage.register_storage decorator, making GithubStorage the active storage provider. Point a manifest's storage_module at the package:

# manifest.yml
storage_module: tai42_storage_github

Configuration

Configure through STORAGE_GITHUB_-prefixed environment variables:

Variable Default Description
STORAGE_GITHUB_USERNAME Repository owner (user or org).
STORAGE_GITHUB_REPO Repository name.
STORAGE_GITHUB_BRANCH main Branch to read/write.
STORAGE_GITHUB_TOKEN Access token; omit for a public repository.
STORAGE_GITHUB_TIMEOUT_TOTAL 15.0 HTTP timeout (seconds).
STORAGE_GITHUB_MAX_CONNECTIONS 200 Connection-pool ceiling.
STORAGE_GITHUB_MAX_KEEPALIVE_CONNECTIONS 50 Keep-alive pool size.
STORAGE_GITHUB_KEEPALIVE_EXPIRY 300.0 Keep-alive expiry (seconds).

The token is held as a SecretStr; it authenticates requests but never appears in a log line, repr, or error message.

Reads and writes

  • Reads (load, load_bytes) go through the raw endpoint (raw.githubusercontent.com), which serves files of any size. The Contents API is deliberately not used for reads: it silently returns an empty body for a file over 1 MiB, so a large object would read as empty bytes. The raw endpoint is CDN-cached, so a read shortly after a write may return the previous content for up to ~5 minutes.
  • Writes (upload, upload_bytes) go through the Contents API (base64) and are capped conservatively at 1 MiB. A larger payload raises ValueError before the request rather than truncating; the API's own 422 is the backstop.
  • Listing uses the recursive Git Trees API (one request) and raises loudly on a truncated response rather than acting on a partial listing.
  • stat infers content_type from the path suffix — GitHub stores no per-object content-type.

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_github-0.2.0.tar.gz (20.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_github-0.2.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file tai42_storage_github-0.2.0.tar.gz.

File metadata

  • Download URL: tai42_storage_github-0.2.0.tar.gz
  • Upload date:
  • Size: 20.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_github-0.2.0.tar.gz
Algorithm Hash digest
SHA256 61969a8a321f66acf347ec182309848cb588abb0720f58a516c46505fd08e9db
MD5 d584132bec66583fc49640b1b0bb13f9
BLAKE2b-256 c39c068b613a59b136ac81d17cf36138aef4b51fca66ef489c1810c5f5900e95

See more details on using hashes here.

File details

Details for the file tai42_storage_github-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tai42_storage_github-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 10d3ec09517e0d33322968f51c0f4d5529c341d3300bcd316699ffe63fde7e39
MD5 c2085a6e7f656fb45fc199dca0af2a1a
BLAKE2b-256 c8bf24c4c818d521e2282f2f37934f9998d38bc106e210543c1eec6a0445533b

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