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.10+

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
  • link(node_a_id, node_b_id, ...) -> dict
  • neighbors(node_id, limit=None) -> list[dict]
  • recent_queries(session_id=None, limit=20) -> list[dict]
  • recent_sessions(limit=20) -> list[dict]
  • recent_outcomes(session_id=None, limit=20) -> list[dict]
  • kv_set(key, value, metadata=None, ttl=None, namespace=None) -> None
  • kv_get(key, namespace=None) -> Any | None
  • kv_search(query, limit=10, namespace=None, filters=None) -> list[KeyValueItem]
  • kv_delete(key, namespace=None) -> bool
  • kv_clear(namespace=None) -> int (supports namespace "*" for global clear)
  • store_session(session) -> session (optimistic version checks)
  • retrieve_session(session_id) -> session | dict | None
  • update_session(session) -> session

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.
  • Framework adapters are intentionally external to this package.
  • Axis interoperability is supported through the external AXIS-MEMORY-PROVIDER-V1 contract implemented by Axis-owned adapter code.

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.2.0.tar.gz (88.0 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.2.0-py3-none-any.whl (90.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: synaptic_core-0.2.0.tar.gz
  • Upload date:
  • Size: 88.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.18

File hashes

Hashes for synaptic_core-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8b2eb7c9bbd63afae325ae3c62485cc9ce04a9bcbb915a2cfa365c1c57535d41
MD5 d282f085c42f92d03823296a9562727a
BLAKE2b-256 67d83b05273e9a561e25fbf9aba7675bc3d6146da5ea831062db50813b1b34dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synaptic_core-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60399ec60776865410ee311b820fbd00e92420797527ad34fc9cd78a28cbd8fd
MD5 74723f6220f879568685da9b05ce1bc8
BLAKE2b-256 9f4f752190ff3b05f9994ca9ab7f74749fb268babf315871ea75f8635dff3ae1

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