Skip to main content

Use GitHub Gists as a persistent key-value filesystem — ideal for AI agent memory

Project description

gistfs

Use GitHub Gists as a persistent key-value filesystem — ideal for AI agent memory.

Install

pip install gistfs

With optional integrations:

pip install gistfs[llamaindex]   # LlamaIndex KVStore
pip install gistfs[langgraph]    # LangGraph BaseStore
pip install gistfs[all]          # everything

Quick start

Creating a new gist

No need to create a gist manually — bootstrap one from code:

from gistfs import GistFS

gfs = GistFS.create(description="my agent memory")
print(gfs.gist_id)  # save this for later

# Or with GistMemory:
from gistfs import GistMemory
mem = GistMemory.create(description="my agent memory")

As a filesystem (context manager)

from gistfs import GistFS

with GistFS(gist_id="your_gist_id") as gfs:
    gfs.write("config.json", {"model": "gpt-4", "temperature": 0.7})
    config = gfs.read("config.json")
    print(gfs.list_files())
    gfs.delete("config.json")

File-like interface

with GistFS(gist_id="your_gist_id") as gfs:
    with gfs.open("notes.txt", "w") as f:
        f.write("hello world")

    with gfs.open("notes.txt", "r") as f:
        content = f.read()

    with gfs.open("notes.txt", "a") as f:
        f.write("\nappended line")

As AI agent memory

from gistfs import GistMemory

with GistMemory(gist_id="your_gist_id") as mem:
    mem.put("conversation_1", {"messages": [{"role": "user", "content": "hi"}]})
    history = mem.get("conversation_1")
    all_data = mem.get_all()
    mem.delete("conversation_1")

LlamaIndex integration

from gistfs.integrations.llamaindex import GistKVStore

store = GistKVStore(gist_id="your_gist_id")
store.put("doc1", {"text": "hello world"}, collection="docstore")
doc = store.get("doc1", collection="docstore")

LangGraph integration

from gistfs.integrations.langgraph import GistStore

store = GistStore(gist_id="your_gist_id")
store.put(("user", "prefs"), "theme", {"value": "dark"})
item = store.get(("user", "prefs"), "theme")

Authentication

Set the GITHUB_TOKEN environment variable with a GitHub personal access token that has gist scope. Read-only operations on public gists work without a token.

export GITHUB_TOKEN=ghp_your_token_here

Or pass it directly:

gfs = GistFS(gist_id="abc123", token="ghp_...")

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

gistfs-0.1.0.tar.gz (216.6 kB view details)

Uploaded Source

Built Distribution

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

gistfs-0.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file gistfs-0.1.0.tar.gz.

File metadata

  • Download URL: gistfs-0.1.0.tar.gz
  • Upload date:
  • Size: 216.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gistfs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7335bddaf17953ee6af253dc31eb9f8015a22c367491912383297cc273b0bc97
MD5 fe505e82c86e27f365b7446e4a106c69
BLAKE2b-256 ba8817b0eb91957a4ca2b2eb3e36c0109e732bd625e38e72d18f2a42bfb69fcc

See more details on using hashes here.

File details

Details for the file gistfs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gistfs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gistfs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c357edc4b9a3e784758384e443f1efd7f1e45bfbc540fc6c82e0cf987d7523cb
MD5 521e43eff24e439fe5324b172a413aab
BLAKE2b-256 480b7ec2f439a62cfffcd273bd7fc255a436052216d461d95bb251f2a86b9cc3

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 Pingdom Monitoring Sentry Error logging StatusPage Status page