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 an optional framework integration (an "extra"):

pip install "suprflo[langchain]"

Optional integrations (extras)

agno, autogen, crewai, langchain, langgraph, livekit, llamaindex, openai-agents, pipecat, pydantic-ai.

Note: suprflo[pipecat] requires Python ≥ 3.11 — it pulls pipecat-ai >= 1, which dropped 3.9/3.10. On Python 3.9/3.10 the install fails to resolve; use Python 3.11+ for that extra. All other extras support 3.9+.

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.1.tar.gz (43.4 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.1-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: suprflo-0.1.1.tar.gz
  • Upload date:
  • Size: 43.4 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.1.tar.gz
Algorithm Hash digest
SHA256 bf1e2af1970bc8fc0745151f7a799241798d465830aa2031733e3ae6d7d80642
MD5 3447e093fb65c6bdfc0cd52df9edfe61
BLAKE2b-256 6636d7a09767e6e4a48fc9b85be7da757c3d91487535159906c579273197c378

See more details on using hashes here.

Provenance

The following attestation bundles were made for suprflo-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: suprflo-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 33.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 633b3bad2c335fa634a1feec418e34e6d70b3040acf07131299686462458bb8f
MD5 b371ca88b82cd7a0822e2d7e60553b59
BLAKE2b-256 e043807bfa5a2a39a5d75d2c2dc5fac2efc43583360aeb4600943d8793cb6f88

See more details on using hashes here.

Provenance

The following attestation bundles were made for suprflo-0.1.1-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