Skip to main content

Go SDK Reference

Go The Go SDK is a client for the Memanto REST server. Point it at a server you run (BaseURL), or leave BaseURL empty and it starts uvx memanto serve on first use, like the TypeScript SDK.

Prerequisites

  • Go 1.24+
  • uvx on PATH, only if the client starts the server itself. Install uv, which ships uvx.

Installation

Quick Start

New memories take about a second to become searchable, so a Recall right after a Remember may not return them yet. On the first call, the client:
  1. Starts the server, unless BaseURL is set: picks a free port, runs uvx memanto serve --host 127.0.0.1 --port <port>, and waits for /health.
  2. Creates the agent if it does not exist (unless DisableAutoCreate is set).
  3. Activates a session and sends its token with each memory call. If the server rejects the token, the client activates a new session and retries once.
A Client is safe for concurrent use from multiple goroutines.
Close stops a server the client started. Go has no exit hooks, so always call it (defer client.Close()); otherwise the server keeps running after your program exits.
Memanto allows one session per agent. Activating a session signs out every other client of that agent (the CLI, MCP, IDE hooks), and the other way round. Use a separate agent for your Go program if other tools use the same agent at the same time.

Connecting to a Running Server

To use a server you started with memanto serve (or Docker), set BaseURL. The client then never starts a server, and Close leaves yours running:
APIKey is sent as X-Api-Key on every request. A server reachable beyond localhost requires it to create or activate agents.

On-Prem

No API key is needed on the on-prem backend. Run uvx memanto once and choose On-Prem; a server the client starts inherits that config from ~/.memanto/:
See the On-Prem Overview.

Client

Options

New does not contact the server; that happens on the first call. Every method takes a context.Context first. Responses are typed with the generated package github.com/moorcheh-ai/memanto/sdks/go/api; endpoints without a response schema return map[string]any.

Memory Write Methods

In RememberInput, Confidence defaults to 0.8, Source to agent, and Provenance to explicit_statement.

Memory Read Methods

AsOf and Since take YYYY-MM-DD or an ISO 8601 datetime. Optional numbers where zero is a meaningful value (MinSimilarity, Threshold, Temperature) are pointers. Leave them nil for the server default, or set one with memanto.Ptr:

Analysis Methods

Action is one of keep_old, keep_new, keep_both, remove_both, manual.

Agent & Session Lifecycle

Errors

A failed call returns a nil result and an error. When the server answers with a non-2xx status, the error is a *memanto.APIError carrying StatusCode and the server’s message in Detail:
If uvx is not installed, the first call returns an error telling you to install uv.

Versioning

Each Memanto release vX.Y.Z also tags the Go SDK as sdks/go/vX.Y.Z, so the SDK version matches the memanto release on PyPI:
To pin the server a started client runs, set PackageSpec: "memanto==<version>".

License

MIT