This release is a pre-release and may not be stable for production use.
Spector Python Client SDK (spector-client)
Lightweight, zero-dependency Python client for the Spector Cognitive Memory & Vector Search platform.
spector-client is generated from OpenAPI 3.1 with an ergonomic handwritten facade providing 1-to-1 cognitive verb parity (remember, recall, forget, inspect, reinforce) and real-time Server-Sent Events (SSE) streaming.
Highlights
- Zero Mandatory Dependencies: Built entirely on the Python standard library (
urllib.request,asyncio,json,dataclasses). - Zero Java Prerequisite for REST: Connects directly to Spector Synapse over HTTP REST on port
:7070with no JVM or incubator flags required. - Sync & Async (
asyncio): Dual clients (SpectorClientandAsyncSpectorClient) with identical cognitive signatures. - Real-Time Streaming: Stream live cognitive consolidation events, Hebbian graph co-activations, and recall telemetry over Server-Sent Events (SSE).
- Multi-Transport Support: Connect via HTTP REST (default), remote MCP over HTTP/SSE, or local standalone
spector.jarsubprocess.
Installation
# Install via pip
pip install spector-client
# Or install locally for development
cd sdks/python
pip install -e ".[dev]"
Quick Start (Synchronous)
from spector_client import SpectorClient, MemoryTier
# Connect to running Spector Synapse instance (default: http://localhost:7070)
client = SpectorClient.builder() \
.with_rest(base_url="http://localhost:7070", api_key="optional-api-key") \
.build()
# 1. Remember — Store with cognitive metadata
client.memory.remember(
text="User prefers concise answers and dark mode UI",
tier=MemoryTier.SEMANTIC,
tags=["preferences", "ui"],
interest=0.9,
valence=1,
)
# 2. Recall — Retrieve using multi-tier associative cognitive scoring
results = client.memory.recall("user preferences", top_k=5)
for record in results:
print(f"[{record.id}] score={record.score:.4f} | {record.text}")
# 3. Stream Events — Real-time Server-Sent Events (SSE)
for event in client.events.stream(topics=["memory", "cortex"]):
print(f"📡 Real-time event: {event.event} -> {event.data}")
Quick Start (Asynchronous asyncio)
import asyncio
from spector_client import AsyncSpectorClient, MemoryTier
async def main():
async with AsyncSpectorClient.builder().with_rest("http://localhost:7070").build() as client:
# Asynchronously remember
await client.memory.remember(
"Working memory context for active task",
tier=MemoryTier.WORKING,
tags=["task-42"]
)
# Asynchronously recall
memories = await client.memory.recall("active task context")
for mem in memories:
print(mem.text)
# Asynchronously stream events
async for event in client.events.stream(topics=["memory"]):
print(f"Stream: {event.event}")
asyncio.run(main())
Multi-Transport Modes
1. High-Throughput REST (Default)
client = SpectorClient.builder() \
.with_rest(base_url="http://localhost:7070", api_key="secret-key") \
.build()
2. Standalone Subprocess (spector.jar)
from spector_client.transports import StdioTransport
transport = StdioTransport(
jar_path="/path/to/spector.jar",
config_path="/path/to/spector.yml",
java_bin="java"
)
transport.start()
client = SpectorClient(transport=transport)
Cognitive Verbs API Reference
| Verb | Signature | Description |
|---|---|---|
remember() |
(text, tier, tags, interest, urgency, challenge, valence, arousal) |
Asynchronously store memory with cognitive tier hints. |
store() |
(text, tags) |
Synchronous store returning assigned memory ID. |
recall() |
(query, top_k, profile, min_salience, tags) |
Retrieve memories via fused cognitive scoring. |
search() |
(query, top_k) |
Pure dense vector semantic similarity search. |
get() / find() |
(id) |
Retrieve full memory record by ID. |
forget() |
(id, reason) |
Tombstone memory. |
reinforce() |
(id, valence) |
Hebbian Long-Term Potentiation (LTP). |
suppress() / unsuppress() |
(id, reason) |
Active recall inhibition / habituation. |
resolve() / unresolve() |
(id) |
Zeigarnik closure. |
status() |
() |
Real-time memory tier counts and index health. |
browse() |
(tags) |
Fast inverted tag index lookup. |
table() |
(page, page_size, tier) |
Paginated database records. |
vector() |
(id) |
INT8 quantized embedding vector retrieval. |
consolidate() |
() |
Trigger circadian sleep consolidation sweep. |
vacuum() |
(tier) |
Trigger vacuum compaction. |
Development & Testing
cd sdks/python
python -m unittest discover -s tests -t .
# Or if package is installed in editable mode:
# pip install -e ".[dev]" && pytest
License
Apache License, Version 2.0 — see LICENSE for details.
Metadata
Release files for spector-client 0.1.0a4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| spector_client-0.1.0a4.tar.gz | 125.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spector_client-0.1.0a4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 441.0 kB
Release files / spector_client-0.1.0a4.tar.gz
| Download URL | spector_client-0.1.0a4.tar.gz |
|---|---|
| Size | 125.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43058b5e511ac379a409633c1938356fd7f4a52b2fe7685c0c4ac89fd6eba5ea
|
|
BLAKE2b-256 checksum How to use checksums |
96ec8d01b021fa3dfdb12feb96287f60d4b707561a4b4ad18b2b9e8834cb57cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.
Transparency logRelease files / spector_client-0.1.0a4-py3-none-any.whl
| Download URL | spector_client-0.1.0a4-py3-none-any.whl |
|---|---|
| Size | 315.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
907a53f6bf33b83b53d4aeb8b44e3fef6e3f38ae067a0326acd22a4b70f40ced
|
|
BLAKE2b-256 checksum How to use checksums |
e1e5813ea75ff63d6d7605e7998fb8e8c5ca1cfd98cfab857901e997eb093de5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.
Transparency logSecurity for spector-client 0.1.0a4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for spector_client-0.1.0a4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.