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

# TypeScript SDK: Conversations

> Multi-turn sessions with maintained context.

A conversation keeps rolling context across turns so follow-ups like *"how does that compare to Q3?"* resolve correctly.

## Start a session

```typescript theme={null}
const { session_id } = await client.startConversation();
```

The returned `session_id` is opaque — store it in your app state.

## Continue a session

```typescript theme={null}
const turn1 = await client.continueConversation({
  query: "What was ACME's Q4 revenue?",
  sessionId: session_id,
});

const turn2 = await client.continueConversation({
  query: "How does that compare to Q3?",
  sessionId: session_id,
});
```

Under the hood this calls `query()` with `maintainContext: true` and the `sessionId` attached. You can do that yourself — `continueConversation` is just a named shortcut.

## Stream a session turn

Use `queryStream` with the session ID:

```typescript theme={null}
for await (const token of client.queryStream({
  query: "And what drove the increase?",
  sessionId: session_id,
  maintainContext: true,
})) {
  process.stdout.write(token);
}
```

## List + inspect conversations

```typescript theme={null}
const conversations = await client.listConversations();
for (const c of conversations) {
  console.log(c.session_id, c.title ?? "(untitled)", c.turn_count);
}

const full = await client.getConversation(session_id);
console.log(full.messages);
```

## Delete

```typescript theme={null}
await client.deleteConversation(session_id);
```

Deletes the session record and its rolling history. Source documents and facts are unaffected.

## Scope a session to specific uploads

Useful for per-conversation knowledge isolation (e.g. customer-specific bots):

```typescript theme={null}
const answer = await client.query({
  query: "What does this contract say about termination?",
  sessionId: session_id,
  maintainContext: true,
  conversationUploadIds: ["upload_customerA_contract"],
});
```

The retrieval restricts itself to those uploads for this session.
