GuidesAI SDK

Stable ID

Keep sessions and artifacts scoped to each user.

Pass a stableId to scope sessions and file storage so that one user's artifacts never leak into another user's sandbox. Always pass a unique value that maps to your application's user ID.

Setting stableId in the constructor

import { Bluebag } from "@bluebag/ai-sdk";

const bluebag = new Bluebag({
  apiKey: process.env.BLUEBAG_API_KEY!,
  stableId: user.id,
});

const config = await bluebag.enhance({
  model,
  messages,
});

Setting stableId dynamically

You can also set or update the stableId after creating the client:

import { Bluebag } from "@bluebag/ai-sdk";

const bluebag = new Bluebag({
  apiKey: process.env.BLUEBAG_API_KEY!,
});

// Set stableId before calling enhance
bluebag.setStableId(user.id);

const config = await bluebag.enhance({
  model,
  messages,
});

Stable IDs must be unique per user and should be URL-safe (letters, numbers, -, _), up to 64 characters.

On this page