Created
May 28, 2026 01:26
-
-
Save calcsam/9c54c3d9158b9e80fba0c47064b9d8cf to your computer and use it in GitHub Desktop.
Per-thread sandboxes for Slack bots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const agent = new Agent({ | |
| name: 'engineer-bot', | |
| model: openai('gpt-4o'), | |
| channels: { adapters: { slack: slackAdapter } }, | |
| workspace: ({ requestContext }) => { | |
| const channel = requestContext.get('channel'); | |
| return new Workspace({ | |
| // Stable per-thread sandbox identity — same thread reuses the same sandbox. | |
| id: `slack-${channel.threadId}`, | |
| sandbox: new ComputeSDKSandbox({ provider: 'e2b' }), | |
| }); | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment