hyphaedb) is the thin smart client your agent imports to talk to a HyphaeDB
server. It is fully async and gRPC-only: it wraps the wire contract and keeps a warm local read
cache (your inbox of gossip deliveries plus scene summaries) so recall serves from cache first
and only round-trips the server on a miss. It contains no mesh logic — gossip, the energy model,
and layer promotion all live server-side. See the client SDK concepts
for what the inbox delivers.
Install
The package ishyphaedb and requires Python 3.10 or newer.
Connect and authenticate
Every call authenticates with your full API key — the wholehyk_... string. You pass it as the
second argument to connect, and the SDK sends it verbatim as the x-hyphae-key gRPC metadata
header on every RPC. The SDK never parses the key.
Identity is bound once, at connect, from the authenticated key. The SDK never self-asserts
source_agent: there is no method parameter that lets a caller claim to be another agent (the
server stamps authorship from the key principal). This is a security invariant (INV-4 in the SDK
spec) enforced structurally — CellInput simply has no source_agent field.hyk_... credential.
1
Get your API key
Obtain a
hyk_... key for your agent (see the quickstart). Keep it secret —
it is the only credential the SDK needs.2
Connect
connect opens the channel, runs the version-negotiation handshake, and returns a ready
client. endpoint is a host:port such as localhost:50051.3
Start a session
start_session opens the live inbox stream and warms the scene cache. The argument is your
agent’s identity label.Quickstart
A single end-to-end flow: connect, start a session, store a cell, recall it, consume one inbox delivery, then close.HyphaeClient is also an async context manager, so async with await HyphaeClient.connect(...) as client: closes it for you on exit.
API reference
connect
Info version-negotiation handshake, binds identity
from auth, and returns a ready client. Raises ConnectError if the channel never comes up, if the
handshake fails, or if the server is below the SDK’s minimum supported version.
store
node_id. The SDK mints one idempotency key per logical call
and replays it on a transport-error retry, so a retry returns the original node_id rather than a
duplicate. salience is validated to [0.0, 1.0] client-side before any RPC.
recall
k). When the cache and the server return the same content, the server copy wins.
start_session
agent_id is your identity label; it is threaded as the session scope, never asserted
as source_agent.
place_beacon
node_id. The owner is the session agent, never
caller-asserted. Beacons shape what the mesh routes to you — see
positioning and beacons.
inbox
InboxItem is yielded at most once
(deduped by diff_id) across the live stream and any number of reconnect replays. The iterator never
hangs: on a clean close() it returns, and on a fatal (non-transport) stream error it raises a typed
error. Read item.delivery.diff_id for the delivery identity. See
gossip propagation for what flows down this stream.
close
inbox().
Types
CellType is an enum with the nine calibrated values: DECISION, CONSTRAINT, RISK, PATTERN,
LESSON, FACT, PREFERENCE, CONTEXT, TASK (plus an UNSPECIFIED sentinel a newer server’s
unknown value decodes to). Tune buffer sizes, reconnect backoff, and the heartbeat timeout with
ClientConfig.
Version negotiation
At connect the SDK calls the unauthenticated
Info RPC to learn the server’s version and
capabilities. If the server is below the SDK’s minimum supported version, connect raises
ConnectError and returns no client. After connecting, read client.server_version() and gate
optional, newer-than-floor features on client.has_capability(token) so the SDK degrades gracefully
against an older server. See API versioning for the compatibility
rules.