Skip to content

Integrations

Client libraries

Use the typed Klyro clients for TypeScript, Python, and Go, or connect through any Redis client. Both paths use the same RESP wire protocol.

Verified clients

These were run against Klyro over its real socket, and all of them pass:

ClientLanguageRESP2RESP3
redis-py 8.1PythonYesYes
go-redis v9GoYesYes
ioredis 5Node.jsYesn/a

Others — Jedis, Lettuce, StackExchange.Redis, redis-rs — should work too; they are simply untested here.

Typed client basics

Each Klyro client keeps its ecosystem's standard Redis API and adds a typed memory surface. These examples connect to the default address, execute ordinary commands, and close the connection cleanly.

from klyro_db import Klyro

db = Klyro()
db.set("greeting", "hello")
print(db.get("greeting").decode())

db.close()

What the typed clients provide

ClientStandard commandsMemory commandsConnection lifecycle
TypeScript / JavaScriptThe returned ioredis instancememory and memoryBufferconnect (with lazyConnect), quit, disconnect
PythonKlyro subclasses redis.Redismemoryclose, connection_pool.disconnect
GoClient embeds redis.UniversalClientMemoryClose

The wrappers do not start the server. By default they connect to 127.0.0.1:7171. Connection, retry, timeout, TLS, and pool settings are passed to ioredis, redis-py, or go-redis respectively; only use settings that the Klyro server supports.

Using generic Redis clients

Generic Redis clients do not know Klyro's memory family. Use the raw-command call each client provides for MEM.*. Standard commands such as GET, HSET, and LPUSHuse the client's normal methods.

ClientMemory command call
redis-pyr.execute_command("MEM.SEARCH", "notes", "database")
ioredisr.call("MEM.SEARCH", "notes", "database")
go-redisr.Do(ctx, "MEM.SEARCH", "notes", "database")
redis-rsredis::cmd("MEM.SEARCH").arg("notes").arg("database").query(&mut con)

The typed equivalents are db.memory.search in TypeScript,db.memory.search in Python, and db.Memory.Search in Go. The complete method mapping is in SDKs and packages.

Sending vectors

VEC expects raw little-endian float32 bytes, four per dimension. Every language already has that shape; it just needs handing over without being decoded as text.

import struct

def vec(values):
    return struct.pack(f"<{len(values)}f", *values)

# Note: decode_responses=True would mangle a binary reply, so use a
# separate raw client when you read vectors back with WITHVEC.
raw = redis.Redis(host="localhost", port=7171)
raw.execute_command("MEM.ADD", "user:123", "TEXT", text, "VEC", vec(embedding))

Command line

redis-cli works if you have it:

terminal
redis-cli -p 7171 set greeting hello
redis-cli -p 7171 get greeting
redis-cli -p 7171 MEM.INFO user:123

Without it, nc still works, because Klyro accepts Redis’s inline command form. Replies come back in RESP, so they carry type markers:

nc localhost 7171
PING
+PONG
SET greeting "hello there"
+OK
GET greeting
$11
hello there
LPUSH mylist a
:1

Protocol details

Klyro negotiates RESP3 when a client sends HELLO 3, and answers RESP2 otherwise. The type-shape differences are implemented, so a client gets the same shapes it would from Redis: maps for HGETALL and CONFIG GET, sets for SMEMBERS and SINTER, doubles for ZSCORE, and nested pairs for WITHSCORES.