Skip to main content

Installation

npm install minns-sdk

Client configuration

Create a client instance with createClient. All options have sensible defaults — only baseUrl is required.
import { createClient } from 'minns-sdk';

const client = createClient({
  baseUrl: "https://your-instance.minns.ai",
  enableDefaultTelemetry: true,
  defaultAsync: true,
  autoBatch: true,
  batchInterval: 100,
  batchMaxSize: 20,
  maxQueueSize: 1000,
});

Configuration options

OptionTypeDefaultDescription
baseUrlstringBase URL of your Minns Memory Layer server
enableDefaultTelemetrybooleantrueEnable fire-and-forget performance telemetry
defaultAsyncbooleantrueWhen true, processEvent() returns a local receipt immediately
autoBatchbooleanfalseBuffer events locally and flush in batches
batchIntervalnumber100Flush the batch queue every N milliseconds
batchMaxSizenumber20Flush when the queue reaches N events
maxQueueSizenumber1000Maximum local queue depth. enqueue() throws if exceeded

Two ways to submit events

The SDK provides two submission modes:

send() — synchronous

Waits for the server response before continuing. Use this when you need the response immediately.
const response = await client.event("research-agent", { agentId: 123, sessionId: 456 })
  .action("search_database", { query: "quantum computing" })
  .outcome({ resultsFound: 10 })
  .send();

console.log(response.nodes_created); // 5

enqueue() — asynchronous

Returns a local acknowledgement immediately and queues the event for background submission. Use this to keep your agent loop fast.
const receipt = await client.event("research-agent")
  .observation("web_page", { target: "https://github.com" })
  .enqueue();
Always call await client.flush() before your process exits to ensure all queued events are submitted.

Direct event submission

You can also bypass the fluent builder and submit raw Event objects:
// Single event
const response = await client.processEvent(event, { enableSemantic: true });

// Multiple events (automatically chunked by batchMaxSize)
const response = await client.processEvents([event1, event2, event3]);

Next steps