Skip to content

Instantly share code, notes, and snippets.

@calcsam
Created May 28, 2026 01:26
Show Gist options
  • Select an option

  • Save calcsam/9c54c3d9158b9e80fba0c47064b9d8cf to your computer and use it in GitHub Desktop.

Select an option

Save calcsam/9c54c3d9158b9e80fba0c47064b9d8cf to your computer and use it in GitHub Desktop.
Per-thread sandboxes for Slack bots
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