Python SDK for the Synalinks Memory API
Project description
Synalinks Memory Python SDK
Synalinks Memory is the knowledge and context layer for AI agents. It lets your agents always have the right context at the right time. Unlike retrieval systems that compound LLM errors at every step, Synalinks uses logical rules to derive knowledge from your raw data. Every claim can be traced back to evidence, from raw data to insight, no more lies or hallucinations.
This SDK provides a Python client to interact with the Synalinks Memory API, so your agents can store, query, and reason over their knowledge base programmatically.
Installation
pip install synalinks-memory
Or with uv:
uv add synalinks-memory
Quick Start
A Synalinks API key is required to authenticate with your knowledge base.
When you create a knowledge base on app.synalinks.com, a default API key is generated automatically with read/write access and no predicate restrictions — you can use it right away.
To create a key with granular access, go to Profile icon (in the header) > API Keys > Create API Key.
Set your API key as an environment variable:
export SYNALINKS_API_KEY="synalinks_..."
Then query your data:
from synalinks_memory import SynalinksMemory
with SynalinksMemory() as client:
# List all available tables, concepts, and rules
predicates = client.list()
for table in predicates.tables:
print(f"{table.name}: {table.description}")
# Fetch rows from a table
result = client.execute("Users", limit=10)
for row in result.rows:
print(row)
# Search with keywords (fuzzy matching)
result = client.search("Users", "alice")
for row in result.rows:
print(row)
# Upload a CSV or Parquet file
upload = client.upload("data/sales.csv", name="Sales", description="Monthly sales data")
print(f"Uploaded {upload.predicate} ({upload.row_count} rows)")
# Insert a row
client.insert("Users", {"name": "Alice", "email": "alice@example.com"})
# Update rows matching a filter
result = client.update("Users", filter={"name": "Alice"}, values={"email": "alice@new.com"})
print(f"Updated {result.updated_count} row(s)")
# Export data as a file (CSV, Parquet, or JSON)
client.execute("Users", format="csv", output="users.csv")
client.execute("Users", format="parquet", output="users.parquet")
# Chat with the agent (multi-turn)
answer = client.chat("What were the top 5 products by revenue last month?")
print(answer)
# Follow-up question (uses conversation context automatically)
answer = client.chat("Show me just the top 3")
print(answer)
# Reset conversation history
client.clear()
You can also pass the key directly:
client = SynalinksMemory(api_key="synalinks_...")
Error Handling
from synalinks_memory import (
SynalinksMemory,
AuthenticationError,
NotFoundError,
RateLimitError,
)
with SynalinksMemory() as client:
try:
result = client.execute("MyTable")
except AuthenticationError:
print("Invalid API key")
except NotFoundError as e:
print(f"Not found: {e.message}")
except RateLimitError as e:
print(f"Rate limited, retry after {e.retry_after}s")
API Reference
SynalinksMemory(api_key=None, base_url=None, timeout=30.0)
| Parameter | Description |
|---|---|
api_key |
Your API key. If omitted, reads from SYNALINKS_API_KEY env var. |
base_url |
Override the API endpoint (defaults to https://app.synalinks.com/api). |
timeout |
Request timeout in seconds. |
Methods
| Method | Description |
|---|---|
list() |
List all tables, concepts, and rules |
execute(predicate, *, limit=100, offset=0, format=None, output=None) |
Fetch rows (or export as json/csv/parquet file when format is set) |
search(predicate, keywords, *, limit=100, offset=0) |
Search rows by keywords (fuzzy matching) |
upload(file_path, *, name=None, description=None, overwrite=False) |
Upload a CSV or Parquet file as a new table |
insert(predicate, row) |
Insert a single row into a table |
update(predicate, filter, values) |
Update rows matching a filter with new values |
chat(question) |
Chat with the agent (multi-turn), returns the answer string |
clear() |
Reset conversation history for a fresh chat |
close() |
Close the HTTP client (not needed with with statement) |
License
Licensed under Apache 2.0. See the LICENSE file for full details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file synalinks_memory-0.0.4.tar.gz.
File metadata
- Download URL: synalinks_memory-0.0.4.tar.gz
- Upload date:
- Size: 35.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a9e65ce4b92131ba05bde966c195dc1bb0e1eda934f17ed41f3ebe7003ee161
|
|
| MD5 |
057eeccca0cc0ce7895241daaef67b74
|
|
| BLAKE2b-256 |
6df853e7883efc6178b5e3820d384bb8378cb8ebbd704a2de2108dfe9ffe3545
|
File details
Details for the file synalinks_memory-0.0.4-py3-none-any.whl.
File metadata
- Download URL: synalinks_memory-0.0.4-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34828fd2d56b4fb99c7abd427fea830b6c819ecbb6ef245beb15501bd16a608a
|
|
| MD5 |
07db99170d3434c564802a37c383eeda
|
|
| BLAKE2b-256 |
c38c87b185c245037e516d6d1a7d21f7b3e9cc059246d7ae986f0ef39f1a9c48
|