Skip to main content

Documentation Index

Fetch the complete documentation index at: https://wb-21fd5541-update-reference-docs-34.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

runIsolated

runIsolated<T>(fn): T Run fn in a fresh, isolated GenAI state frame. Any Session / Turn / LLM started inside fn lives in this frame only — it does not clash with sibling runIsolated frames running concurrently, and it does not leak to the outer async chain. Use this to safely run parallel GenAI work:
await Promise.all([
  weave.runIsolated(async () => { ... }),
  weave.runIsolated(async () => { ... }),
]);
Sequential single-flight usage doesn’t require this wrapper — the process-wide default state handles it.

Type parameters

Name
T

Parameters

NameType
fn() => T

Returns

T

Defined in

genai/context.ts:88