Skip to main content

Synaptic Core foundation and persistence layer for graph-backed memory.

Project description

synaptic-core

Graph-backed memory runtime for production AI applications.

synaptic-core provides an async memory engine with hybrid retrieval, associative activation, feedback-driven learning, and durable observability.

Why synaptic-core

  • Hybrid retrieval: combines keyword, semantic, and graph activation signals.
  • Tiered memory: supports short-term and long-term memory with automatic graduation.
  • Feedback learning: updates graph associations based on user/agent outcomes.
  • Operational visibility: includes graph health, per-session summaries, and weekly digest reporting.
  • Local-first default: ships with a SQLite backend and stable persistence semantics.

Installation

Requirements:

  • Python 3.11+

Install from source:

python -m pip install .

Optional extras:

python -m pip install ".[real_embedding]"

Quick Start

import asyncio

from synaptic_core import SynapticMemory
from synaptic_core.types import OutcomeSignalType


def embed(text: str) -> list[float]:
    normalized = text.lower().strip()
    return [
        float(len(normalized.split())),
        float(len(normalized)) / 100.0,
        float(sum(ord(ch) for ch in normalized) % 97) / 100.0,
    ]


async def main() -> None:
    memory = SynapticMemory(
        db_path="synaptic.db",
        embedding_fn=embed,
        deployment_id="prod-us-east-1",
    )

    await memory.store(
        "Customer requested monthly usage report with CSV export.",
        metadata={"tenant": "acme", "channel": "support"},
    )

    retrieval = await memory.retrieve(
        "How does Acme get their monthly usage report?",
        session_id="chat-42",
        top_k=5,
    )

    outcome = await memory.feedback(
        retrieval.query_id,
        outcome=OutcomeSignalType.EXPLICIT_POSITIVE,
        active_nodes=[node.id for node in retrieval.nodes],
        provider="assistant-api",
    )

    status = await memory.graph_status()
    session = await memory.session_summary("chat-42")
    digest = await memory.weekly_digest()

    print(retrieval.nodes[0].content if retrieval.nodes else "no matches")
    print(outcome.composite_score, status["graph_confidence"], session["query_count"], digest["summary"])


asyncio.run(main())

Core API

  • store(content, ...) -> Node
  • retrieve(query, ...) -> RetrievalResult
  • activate(node_ids, initial_energy=1.0, ...) -> RetrievalResult
  • feedback(query_id, outcome, ...) -> CompositeOutcome
  • graph_status() -> dict
  • session_summary(session_id) -> dict
  • weekly_digest(...) -> dict
  • stats() -> dict
  • delete(node_id) -> None

Production Notes

  • embedding_fn is required for store and retrieve; it may be sync or async.
  • Use stable session_id values to get accurate session analytics.
  • Use stable deployment_id values to keep telemetry attribution consistent.
  • Telemetry and background hardening paths are designed to be failure-isolated from hot request paths.
  • The default SQLite backend is appropriate for single-node/local deployments.

Extensibility

  • Backend abstraction is defined by MemoryBackend in src/synaptic_core/backends/base.py.
  • You can supply a custom backend by passing backend=... to SynapticMemory.
  • Axis-compatible provider method shapes are covered by integration tests (store, retrieve, feedback).

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

synaptic_core-0.1.0.tar.gz (69.9 kB view details)

Uploaded Source

Built Distribution

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

synaptic_core-0.1.0-py3-none-any.whl (76.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: synaptic_core-0.1.0.tar.gz
  • Upload date:
  • Size: 69.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for synaptic_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aa2727dedc2ca5adf7a01fcc1e5b1d11faa7328596b9eafc874c913a9b02bd9a
MD5 0fbdb4f76ecb49f9dccd4952b1698d31
BLAKE2b-256 faa4d261437c2c946843814882e7fb666a2e27734a312eae58e5931dd4bd5492

See more details on using hashes here.

File details

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

File metadata

  • Download URL: synaptic_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 76.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for synaptic_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c13c2ca4ccb4b98c916653e5bfcccf5ec6ef829e36360825d18fb7b3b899f92
MD5 f7f44858d765cc0d69858a3f6bcce0ea
BLAKE2b-256 6dec5d7bda4da609330dc3dbd357b190c07bef2832a918af42daaf1a1f64ce9f

See more details on using hashes here.

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