Skip to main content

Official Python SDK for Suprflo — the memory layer for AI agents.

Project description

Suprflo Python SDK

Official Python client for Suprflo — the memory layer for AI agents.

Installation

pip install suprflo

With the optional LangChain integration:

pip install "suprflo[langchain]"

Quickstart

from suprflo import MemoryClient

client = MemoryClient(api_key="sk-...")  # base_url defaults to https://api.suprflo.com

# Add a memory (a string, a {role, content} dict, or a list of either)
client.add(
    [
        {"role": "user", "content": "I'm vegetarian and allergic to peanuts"},
        {"role": "assistant", "content": "Got it — I'll keep that in mind."},
    ],
    user_id="alice",
)

# Search for relevant memories
results = client.search("what can this person eat?", user_id="alice", top_k=5)
for m in results["results"]:
    print(m["memory"], m.get("score"))

client.close()

MemoryClient also works as a context manager:

with MemoryClient(api_key="sk-...") as client:
    client.add("Prefers window seats", user_id="alice")

Available methods

Method Description
add(messages, *, user_id=None, agent_id=None, run_id=None, app_id=None, metadata=None, infer=True, async_mode=False, timestamp=None) Add memories from a message or conversation
search(query, *, top_k=10, filters=None, threshold=None, rerank=None, memory_types=None, as_of=None, user_id=None, ...) Semantic search
get(memory_id) Fetch one memory
get_all(*, user_id=None, agent_id=None, run_id=None, app_id=None, limit=100, offset=0, memory_types=None) List memories
update(memory_id, data) Replace a memory's text
delete(memory_id) Delete one memory
delete_all(*, user_id=None, agent_id=None, run_id=None, app_id=None) Delete a scope of memories
history(memory_id) Change history of a memory
users() Distinct memory subjects

Non-2xx responses raise suprflo.APIError (with .status_code and .message); SuprfloError is the base exception class.

LangChain integration

from suprflo import MemoryClient
from suprflo.integrations.langchain import (
    SuprfloMemory,
    SuprfloRetriever,
    create_memory_tools,
)

client = MemoryClient(api_key="sk-...")

# 1. Drop-in conversational memory
memory = SuprfloMemory(client=client, user_id="alice", memory_key="history")

# 2. A retriever for RAG chains
retriever = SuprfloRetriever(client=client, user_id="alice", top_k=5)
docs = retriever.invoke("dietary restrictions")

# 3. Agent tools: save_memory + search_memory
tools = create_memory_tools(client, user_id="alice")

The integration imports langchain-core lazily — the base SDK works without it, and importing the integration without LangChain installed raises a clear ImportError telling you to pip install "suprflo[langchain]".

License

MIT

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

suprflo-0.1.0.tar.gz (43.3 kB view details)

Uploaded Source

Built Distribution

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

suprflo-0.1.0-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: suprflo-0.1.0.tar.gz
  • Upload date:
  • Size: 43.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for suprflo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2a54ba3f12387f01536acae2522db30aed025f3f1b8aacc494226904a0706ba8
MD5 f39c21e0c76c803b84556fd14768d4ce
BLAKE2b-256 43c86bd673254647e5f741dc1d7b63736cf528395e098af33abe638425ce9be6

See more details on using hashes here.

Provenance

The following attestation bundles were made for suprflo-0.1.0.tar.gz:

Publisher: publish.yml on Baaz-Enterprise/suprflo-pip

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

File details

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

File metadata

  • Download URL: suprflo-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for suprflo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a6e53c65ce83e9c29890d5f78464a1730bf1bd18bf6155e46f071058405f21b
MD5 e244a14176200bbb55449685dbfac3e1
BLAKE2b-256 b9f736e9b246ee07f9151d1d3355402ba3cc4efa3c607205509161397d0998c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for suprflo-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Baaz-Enterprise/suprflo-pip

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