> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-typedoc-upgrade.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# runIsolated

> TypeScript SDK reference

> **runIsolated**\<`T`>(`fn`): `T`

Defined in: [src/genai/context.ts:54](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/genai/context.ts#L54)

Run `fn` in a fresh, isolated GenAI state frame. Any Conversation / 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:

```typescript theme={null}
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

### T

`T`

## Parameters

### fn

() => `T`

## Returns

`T`
