Skip to main content

kore-stack

Complete cognitive middleware stack for LLMs. One install, everything connected.

Memory + Identity + Cache + Routing + Observability + A/B Testing.

The difference with LangChain/LlamaIndex: kore's routing is based on formal proof complexity theory (Selector Complexity), not heuristics.

Install

pip install kore-stack               # core (Ollama-ready)
pip install kore-stack[openai]       # + OpenAI
pip install kore-stack[anthropic]    # + Anthropic
pip install kore-stack[all]          # everything

Quick start

from kore_stack import Mind, Bridge, OllamaProvider

mind = Mind("agent.db")
llm = OllamaProvider(model="llama3.2")
bridge = Bridge(mind=mind, llm=llm, cache_ttl=3600.0)

response = bridge.think("Help me with my proof", user="carlos")

What's new in v0.1.2

  • kore-mind>=0.4.0: persistent SQLite embedding cache, float16 quantization, async embeddings (ollama_embed_async), streaming batch (stream_batch / astream_batch), dimension validation in cosine_similarity
  • kore-bridge>=0.3.2: dependency bump

v0.1.1

  • kore-mind>=0.3.1: optimized Ollama embeddings — connection reuse, LRU cache, batch embedding, fallback warnings
  • kore-bridge>=0.3.1: dependency bump

What's in the stack

kore-mind — Persistent memory engine

from kore_stack import Mind

mind = Mind("agent.db", enable_traces=True)
mind.experience("User likes Python", source="carlos")
memories = mind.recall("Python", source="carlos")

# Scoped views per user
alice = mind.scoped("alice")
alice.experience("Prefers Rust")

kore-bridge — LLM cognitive middleware

from kore_stack import Bridge, OllamaProvider

bridge = Bridge(
    mind=mind,
    llm=OllamaProvider(),
    cache_ttl=3600.0,    # smart cache
    rate_limit=3,         # cognitive rate limiting
    rate_window=3600.0,
)

# Cache hit → no LLM call. Rate limited → respond from memory.
response = bridge.think("What is P vs NP?", user="carlos")

sc-router — Routing based on Selector Complexity

from kore_stack import (
    SCRouterProvider, ToolCatalog, Tool,
    OllamaProvider, Bridge, Mind,
)
from kore_bridge.providers import OpenAIProvider

# Define your tool catalog
catalog = ToolCatalog()
catalog.register(Tool(
    name="calculator",
    description="Arithmetic calculations",
    input_types={"expression"},
    output_types={"number"},
    capability_tags={"math", "calculate"},
))

# SC routing: simple queries → local Ollama, complex → GPT-4
router = SCRouterProvider(
    providers={
        "fast": OllamaProvider(model="llama3.2"),
        "quality": OpenAIProvider(model="gpt-4o"),
    },
    catalog=catalog,
)

bridge = Bridge(mind=Mind("agent.db"), llm=router)
bridge.think("What is 2+2?")        # SC(0) → Ollama
bridge.think("Analyze market trends, cross-reference sentiment, build prediction model")
                                      # SC(2-3) → GPT-4
print(router.last_sc_level)          # 0, 1, 2, or 3

A/B Testing

from kore_stack import Experiment, OllamaProvider, Mind

exp = Experiment(
    Mind("test.db"),
    variant_a=OllamaProvider(model="llama3.2"),
    variant_b=OllamaProvider(model="mistral"),
)

result = exp.run("Explain recursion")
print(f"A: {result.time_a_ms:.0f}ms, B: {result.time_b_ms:.0f}ms, faster: {result.faster}")

Architecture

┌─────────────┐
│   Your App  │
└──────┬──────┘
       │
┌──────▼──────┐
│ kore-bridge │  Cache → Rate Limit → SC Route → LLM
│  (Bridge)   │
└──────┬──────┘
       │
┌──────▼──────┐     ┌───────────┐
│  kore-mind  │     │ sc-router │
│   (Mind)    │     │  SC(0-3)  │
│   SQLite    │     └───────────┘
└─────────────┘

Packages

Package PyPI What it does
kore-mind pip install kore-mind Memory, identity, traces, cache storage
kore-bridge pip install kore-bridge LLM integration, cache logic, rate limiting, A/B
sc-router pip install sc-router Query routing by Selector Complexity
kore-stack pip install kore-stack All of the above, one install

License

MIT

Metadata

Release files for kore-stack 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kore-stack 0.1.3
File Size Uploaded
kore_stack-0.1.3.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kore-stack 0.1.3
File Interpreter ABI Platform
kore_stack-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / kore_stack-0.1.3.tar.gz

Download URL kore_stack-0.1.3.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5a0d736b41733ef5949a561ee179a52ecede0e9b154b923766c12d5860587045
BLAKE2b-256 checksum
How to use checksums
1fe8bf1cf0a4bf673d6a80d9c00b34c345fc2771ba9a92ed3b74d1bbb71549c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / kore_stack-0.1.3-py3-none-any.whl

Download URL kore_stack-0.1.3-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b7218320ece21456f36ca3912c842c6380de9eb2b6267f437a5dee61da1c394c
BLAKE2b-256 checksum
How to use checksums
66be9e6d98d94ef9c9ac3d529d6643563d2c76d98732c3bf94454670bfe8f89f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page