Skip to main content

Interface ClientOptions

The ClientOptions object is passed to the MemMachineClient constructor to configure connection, authentication, and request behavior.
PropertyTypeDescription
base_urlstringRequired. The root URL of your MemMachine server instance.
api_keystringOptional. Your secret API key used for authenticating requests.
timeoutnumberOptional. Request timeout in milliseconds (Default: 60000).
max_retriesnumberOptional. Number of retry attempts for failed requests (Default: 3).

Interface HealthStatus

Returned by the client.healthCheck() method. This object provides a snapshot of the server’s availability and the status of internal memory managers.
PropertyTypeDescription
statusstringOverall health status (e.g., 'healthy').
servicestringThe service identifier or name.
versionstringThe current server version string.
memory_managersobjectStatus of internal managers: episodic_memory (boolean) and profile_memory (boolean).

Usage Example

Use ClientOptions to connect, then use HealthStatus to verify your environment is ready.
import { MemMachineClient } from '@memmachine/client';

const client = new MemMachineClient({ 
  base_url: 'your-base-url',
  api_key: 'your_secret_key'
});

async function checkConnection() {
  try {
    const health = await client.healthCheck();
    
    if (health.status === 'healthy') {
      console.log(`Connected to ${health.service} v${health.version}`);
      console.log(`Episodic Manager: ${health.memory_managers.episodic_memory ? 'UP' : 'DOWN'}`);
    }
  } catch (error) {
    console.error("Connection failed:", error.message);
  }
}

checkConnection();