Skip to content

Commit ccd1240

Browse files
Enhance context isolation documentation
- Add isolation mention to introduction - Expand default context behavior note with specific benefits - Document automatic scaling without artificial limits Complements existing isolation documentation from PR #249.
1 parent 3b5c262 commit ccd1240

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/content/docs/sandbox/api/interpreter.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar:
77

88
import { TypeScriptExample } from "~/components";
99

10-
Execute Python, JavaScript, and TypeScript code with support for data visualizations, tables, and rich output formats. Contexts maintain state (variables, imports, functions) across executions.
10+
Execute Python, JavaScript, and TypeScript code with support for data visualizations, tables, and rich output formats. Contexts maintain state (variables, imports, functions) across executions with complete isolation between contexts.
1111

1212
## Methods
1313

@@ -40,7 +40,7 @@ const ctx = await sandbox.createCodeContext({
4040
</TypeScriptExample>
4141

4242
:::note[Context isolation]
43-
Each code context is completely isolated from other contexts. Variables, imports, functions, and state defined in one context are never accessible to another context. Each context has a dedicated executor process from creation to deletion, ensuring complete isolation even under heavy concurrent usage.
43+
Each code context is completely isolated from other contexts. Variables, imports, functions, and state defined in one context are never accessible to another context. Each context has a dedicated executor process from creation to deletion, ensuring complete isolation even under heavy concurrent usage. The system automatically scales to support as many concurrent contexts as needed without artificial limits.
4444
:::
4545

4646
### `runCode()`
@@ -87,7 +87,10 @@ await Promise.all([
8787
</TypeScriptExample>
8888

8989
:::note[Default context behavior]
90-
If no `context` is provided, a default context is automatically created/reused for the specified `language`. While convenient for quick tests, **explicitly creating contexts is recommended** for production use to maintain predictable state.
90+
If no `context` is provided, a default context is automatically created/reused for the specified `language`. While convenient for quick tests, **explicitly creating contexts is recommended** for production use to:
91+
- Maintain predictable state across executions
92+
- Enable concurrent execution by creating multiple contexts
93+
- Ensure proper resource cleanup when contexts are deleted
9194

9295
<TypeScriptExample>
9396
```

0 commit comments

Comments
 (0)