The SurrealDB Agent Memory client ships in the surrealdb package on pub, as a standalone import that does not depend on the database driver. It works in any Dart project and on every Flutter target (Android, iOS, web, and desktop).
Installation
Add the package to pubspec.yaml:
dependencies:
surrealdb:dart pub get
# or, in a Flutter project
flutter pub getClient construction
Import the SurrealDB Agent Memory entry point directly. The client is pinned to one context and talks to SurrealDB Agent Memory's REST API over HTTPS:
import 'package:surrealdb/memory.dart';
final client = AgentMemory(
endpoint: 'https://api.memory.example',
context: 'acme-prod',
apiKey: 'sp-your-key',
);Importing package:surrealdb/memory.dart pulls in only the SurrealDB Agent Memory client, not the SurrealDB database driver.
Remember, recall, and chat
await client.remember('I was promoted to CTO', scopes: 'user/tobie');
final hits = await client.recall("What is Tobie's role?", k: 10);
await for (final chunk in client.chatStream('Tell me a story')) {
stdout.write(chunk.delta);
}
client.close();scopes accepts a slash-path string or a list of paths. Register paths with agent-memory scopes create before first use.
The client covers the rest of the SurrealDB Agent Memory end-user surface (documents, sessions, entities, and governance) over the same REST API. See the REST API for the full contract.