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
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)")
# 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")
# Ask the agent a question
answer = client.ask("What were the top 5 products by revenue last month?")
print(answer)
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 |
ask(question) |
Ask the agent a question, returns the answer string |
close() |
Close the HTTP client (not needed with with statement) |
License
Apache 2.0
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.1.tar.gz.
File metadata
- Download URL: synalinks_memory-0.0.1.tar.gz
- Upload date:
- Size: 31.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bdc92a7e5c8443f6b7d7fd3d276d69c49d8bf7276394b51a1454ceaf678e60d
|
|
| MD5 |
9b104b78586589ddb5f38ca447030527
|
|
| BLAKE2b-256 |
9c303ce941982994213f2037b7187e87b46d7a8fe6dde1a6ebca6b85b7e40cfd
|
File details
Details for the file synalinks_memory-0.0.1-py3-none-any.whl.
File metadata
- Download URL: synalinks_memory-0.0.1-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
391fab716a9539d2248b93f6e3d1c6a9d67254f79bb88b81dbfe7ece8792c985
|
|
| MD5 |
6a3a7253aab138343186aca7417f5b55
|
|
| BLAKE2b-256 |
1693d17be3f67d90083d3ba4ea436c42c278d4a0a4725189788d2e22930be4b1
|