mirror of
https://github.com/hanzoai/agent.git
synced 2026-09-11 21:08:51 +00:00
hanzoai/agents carried the reconciled Go, TypeScript and Python SDKs: memory in Base with one record schema across all three, scope ids resolved the way the control plane resolves them, /v1 paths, one address per vector operation, agents that start under Express 5, and suites that run (Go green, 92 TypeScript, 527 Python). They come home here. The Go module is github.com/hanzoai/agent/sdk/go, because the path has to name the repository it is fetched from. The TypeScript manifest names its versions directly and keeps npm's lockfile; this repo is not a pnpm workspace. Versions are 0.2.10. Co-authored-by: Hanzo Dev <[email protected]>
1.5 KiB
1.5 KiB
Agent memory in Hanzo Base
BaseMemoryBackend keeps an agent's memory in Base, so its state lives in the
same single binary as everything else it runs beside. One record per scope and
key, in one collection.
Create the collection
Import the schema once, as a superuser:
curl -X PUT http://127.0.0.1:8090/v1/collections/import \
-H "Authorization: $(hanzo auth token)" \
-H 'Content-Type: application/json' \
--data @agent_memory.collection.json
Base's admin UI imports the same file from Settings.
Nothing creates it on first write.
Two things in that schema are load-bearing:
- The unique index over
(scope, scope_id, mkey)is what makes one key one record. Without it a losing race writes a second record at the same key and reads start depending on which one Base returns first. - The rules are null, so out of the box the collection is reachable by a superuser alone. Open them deliberately, per deployment.
Use it
memory := agent.NewMemory(
agent.NewBaseMemoryBackend("http://127.0.0.1:8090", token, "agent_memory"),
)
memory.Set(ctx, "tone", "plain")
NewMemory(nil) gives the in-memory backend instead, which is right for a test
and loses everything when the process ends.
Similarity search
The caller computes embeddings. SearchVector ranks the scope's vectors by
cosine in the client, which suits an agent's working set, not a corpus. Vectors
of another width came from another model and are skipped.