> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hystersis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript SDK

> TypeScript SDK reference for Hystersis

# TypeScript SDK

Complete reference for the Hystersis TypeScript/Node.js SDK.

## Installation

```bash theme={null}
npm install hystersis
```

## Initialization

```typescript theme={null}
import { Hystersis } from 'hystersis';

const client = new Hystsesis({
  baseUrl: 'https://api.hystersis.com',
  apiKey: 'your-api-key'
});
```

## Memories

### Create Memory

```typescript theme={null}
const memory = await client.memories.create({
  content: 'User prefers dark mode',
  userId: 'user-123',
  category: 'preferences'
});
```

### Search Memories

```typescript theme={null}
const results = await client.memories.search({
  query: 'display settings',
  limit: 10,
  threshold: 0.7
});
```

### Get Memory

```typescript theme={null}
const memory = await client.memories.get(memoryId);
```

### Update Memory

```typescript theme={null}
await client.memories.update(memoryId, {
  content: 'Updated content'
});
```

### Delete Memory

```typescript theme={null}
await client.memories.delete(memoryId);
```

## Sessions

### Create Session

```typescript theme={null}
const session = await client.sessions.create({
  agentId: 'assistant-bot'
});
```

### Add Message

```typescript theme={null}
await client.messages.add(
  session.id,
  'user',
  'Hello!'
);
```

## Error Handling

```typescript theme={null}
import { 
  Hystersis, 
  AuthenticationError, 
  NotFoundError 
} from 'hystersis';

try {
  const memory = await client.memories.get('invalid-id');
} catch (error) {
  if (error instanceof NotFoundError) {
    console.log('Memory not found');
  }
  if (error instanceof AuthenticationError) {
    console.log('Invalid API key');
  }
}
```

## Integrations

The TypeScript SDK includes integrations for:

* LangChain
* LlamaIndex
* AutoGen
* CrewAI
* Mastra
* Agno
* LangGraph

```typescript theme={null}
import { AgentMemoryMemory } from 'hystersis/integrations/langchain';
```
