Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions docs/docs/tutorials/sdk/sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,41 @@ await agent.deleteSession('demo');
// Session no longer exists
```

## Compacting Sessions

Sessions are Dexto's working memory layer. When a transcript gets large, you can
compact older turns into a persisted compaction artifact and then decide how
to continue:

```typescript
const compaction = await agent.compactSession({
sessionId: session.id,
mode: 'continue-in-child',
trigger: 'manual',
});

const nextSessionId = compaction?.targetSessionId ?? session.id;
```

`compactSession()` supports three modes:

- `artifact-only`: create the artifact without changing the active session
- `continue-in-place`: compact the current session and keep using the same ID
- `continue-in-child`: create a new child session seeded with the compacted continuation

You can also resolve a stored artifact later:

```typescript
if (compaction) {
const artifact = await agent.getSessionCompaction(compaction.id);
console.log(artifact?.summaryMessages);
}
```

This is still session lifecycle and working-memory management. Long-term memory
systems, semantic extraction, and user preference storage should build on top of
these artifacts rather than replacing them.

## When to Create Sessions

**One session per conversation thread.** Here are common patterns:
Expand Down
2,092 changes: 2,091 additions & 1 deletion docs/static/openapi/openapi.json

Large diffs are not rendered by default.

Loading
Loading