@devries-cameron20 / composio-1 / commits / 9752d374b
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

feat: add workbench.enable option to disable workbench in session config

Add the `enable` boolean field to workbench configuration in both TypeScript and Python SDKs. When set to false, the session excludes COMPOSIO_REMOTE_WORKBENCH and COMPOSIO_REMOTE_BASH_TOOL, strips workbench-related prompt lines, and rejects direct workbench calls. Defaults to true for full backwards compatibility.

Abir Taheer committed Mar 24, 2026 at 13:20 UTC 9752d374b40c911c327294743f7aea8106f895f2
5 files changed +130 -4
python/composio/core/models/tool_router.py
+22 -1
@@ -127,11 +127,17 @@ class ToolRouterWorkbenchConfig(te.TypedDict, total=False):
127 """Configuration for workbench settings in tool router session.
128
129 Attributes:
130 + enable: Whether to enable the workbench entirely. Defaults to True.
131 + When set to False, no code execution tools
132 + (COMPOSIO_REMOTE_WORKBENCH, COMPOSIO_REMOTE_BASH_TOOL) are
133 + available in the session, workbench-related prompt lines are
134 + stripped, and direct workbench calls are rejected.
135 enable_proxy_execution: Whether to allow proxy execute calls in the workbench.
136 If False, prevents arbitrary HTTP requests.
137 auto_offload_threshold: Maximum execution payload size to offload to workbench.
138 """
139
140 + enable: bool
141 enable_proxy_execution: bool
142 auto_offload_threshold: int
143
@@ -472,10 +478,15 @@ class ToolRouter(Resource, t.Generic[TTool, TToolCollection]):
478 Example: {'github': 'ca_xxx', 'slack': 'ca_yyy'}
479 :param workbench: Optional workbench configuration (ToolRouterWorkbenchConfig).
480 Dict with:
481 + - 'enable' (bool): Whether to enable the workbench entirely.
482 + Defaults to True. When set to False, no code execution tools
483 + (COMPOSIO_REMOTE_WORKBENCH, COMPOSIO_REMOTE_BASH_TOOL) are
484 + available in the session.
485 - 'enable_proxy_execution' (bool): Whether to allow proxy execute
486 calls in the workbench. If False, prevents arbitrary HTTP requests.
487 - 'auto_offload_threshold' (int): Maximum execution payload size to
488 offload to workbench.
489 + Example: {'enable': False}
490 Example: {'enable_proxy_execution': False, 'auto_offload_threshold': 300}
491 :param experimental: Optional experimental configuration (ToolRouterExperimentalConfig).
492 Note: These features are experimental and may change.
@@ -541,6 +552,14 @@ class ToolRouter(Resource, t.Generic[TTool, TToolCollection]):
552 }
553 )
554
555 + # Create a session with workbench disabled
556 + session = tool_router.create(
557 + user_id='user_123',
558 + workbench={
559 + 'enable': False
560 + }
561 + )
562 +
563 # Create a session with workbench config
564 session = tool_router.create(
565 user_id='user_123',
@@ -659,7 +678,9 @@ class ToolRouter(Resource, t.Generic[TTool, TToolCollection]):
678 create_params["tags"] = tags_payload
679
680 if workbench is not None:
662 - execution_payload: t.Dict[str, t.Any] = {}
681 + execution_payload: t.Dict[str, t.Any] = {
682 + "enable": workbench.get("enable", True),
683 + }
684 if "enable_proxy_execution" in workbench:
685 execution_payload["enable_proxy_execution"] = workbench[
686 "enable_proxy_execution"
python/tests/test_tool_router.py
+37
@@ -508,9 +508,46 @@ class TestToolRouter:
508 call_args = mock_client.tool_router.session.create.call_args
509 kwargs = call_args.kwargs
510 assert "workbench" in kwargs
511 + assert kwargs["workbench"]["enable"] is True
512 assert kwargs["workbench"]["enable_proxy_execution"] is False
513 assert kwargs["workbench"]["auto_offload_threshold"] == 300
514
515 + def test_create_session_with_workbench_disabled(self, tool_router, mock_client):
516 + """Test creating a session with workbench entirely disabled."""
517 + session = tool_router.create(
518 + user_id="user_123",
519 + workbench={"enable": False},
520 + )
521 +
522 + assert session.session_id == "session_123"
523 +
524 + call_args = mock_client.tool_router.session.create.call_args
525 + kwargs = call_args.kwargs
526 + assert "workbench" in kwargs
527 + assert kwargs["workbench"]["enable"] is False
528 +
529 + def test_create_session_with_workbench_enabled_and_configured(
530 + self, tool_router, mock_client
531 + ):
532 + """Test creating a session with workbench explicitly enabled and configured."""
533 + session = tool_router.create(
534 + user_id="user_123",
535 + workbench={
536 + "enable": True,
537 + "enable_proxy_execution": False,
538 + "auto_offload_threshold": 20000,
539 + },
540 + )
541 +
542 + assert session.session_id == "session_123"
543 +
544 + call_args = mock_client.tool_router.session.create.call_args
545 + kwargs = call_args.kwargs
546 + assert "workbench" in kwargs
547 + assert kwargs["workbench"]["enable"] is True
548 + assert kwargs["workbench"]["enable_proxy_execution"] is False
549 + assert kwargs["workbench"]["auto_offload_threshold"] == 20000
550 +
551 def test_create_session_complex_config(self, tool_router, mock_client):
552 """Test creating a session with complex configuration."""
553 session = tool_router.create(
ts/packages/core/src/lib/toolRouterParams.ts
+1
@@ -119,6 +119,7 @@ export const transformToolRouterWorkbenchParams = (
119 }
120
121 return {
122 + enable: params.enable ?? true,
123 enable_proxy_execution: params.enableProxyExecution,
124 auto_offload_threshold: params.autoOffloadThreshold,
125 };
ts/packages/core/src/types/toolRouter.types.ts
+9 -2
@@ -187,6 +187,12 @@ export const ToolRouterCreateSessionConfigSchema = z
187 ),
188 workbench: z
189 .object({
190 + enable: z
191 + .boolean()
192 + .default(true)
193 + .describe(
194 + 'Whether to enable the workbench entirely. Defaults to true. When set to false, no code execution tools (COMPOSIO_REMOTE_WORKBENCH, COMPOSIO_REMOTE_BASH_TOOL) are available in the session.'
195 + ),
196 enableProxyExecution: z
197 .boolean()
198 .optional()
@@ -199,7 +205,7 @@ export const ToolRouterCreateSessionConfigSchema = z
205 ),
206 })
207 .optional()
202 - .describe('The execution config for the tool router session'),
208 + .describe('The workbench config for the tool router session'),
209 experimental: z
210 .object({
211 assistivePrompt: z
@@ -243,7 +249,8 @@ export const ToolRouterCreateSessionConfigSchema = z
249 * @param {boolean} [manageConnections.enable] - Whether to use tools to manage connections in the tool router session @default true
250 * @param {string} [manageConnections.callbackUrl] - The callback url to use in the tool router session
251 * @param {object} workbench - Workbench configuration for tool execution
246 - * @param {boolean} [workbench.proxyExecutionEnabled] - Whether to enable proxy execution
252 + * @param {boolean} [workbench.enable] - Whether to enable the workbench entirely. Defaults to true. When false, no code execution tools are available.
253 + * @param {boolean} [workbench.enableProxyExecution] - Whether to enable proxy execution
254 * @param {number} [workbench.autoOffloadThreshold] - Auto offload threshold in characters for moving execution to workbench
255 */
256 export type ToolRouterCreateSessionConfig = z.infer<typeof ToolRouterCreateSessionConfigSchema>;
ts/packages/core/test/models/toolRouter.test.ts
+61 -1
@@ -915,6 +915,7 @@ describe('ToolRouter', () => {
915 tags: undefined,
916 manage_connections: createExpectedManageConnections(),
917 workbench: {
918 + enable: true,
919 enable_proxy_execution: true,
920 auto_offload_threshold: undefined,
921 },
@@ -941,6 +942,7 @@ describe('ToolRouter', () => {
942 tags: undefined,
943 manage_connections: createExpectedManageConnections(),
944 workbench: {
945 + enable: true,
946 enable_proxy_execution: undefined,
947 auto_offload_threshold: 1000,
948 },
@@ -968,13 +970,14 @@ describe('ToolRouter', () => {
970 tags: undefined,
971 manage_connections: createExpectedManageConnections(),
972 workbench: {
973 + enable: true,
974 enable_proxy_execution: true,
975 auto_offload_threshold: 500,
976 },
977 });
978 });
979
977 - it('should create a session with workbench disable', async () => {
980 + it('should create a session with workbench proxy and offload disabled', async () => {
981 mockClient.toolRouter.session.create.mockResolvedValueOnce(mockSessionCreateResponse);
982
983 const config: ToolRouterCreateSessionConfig = {
@@ -995,11 +998,68 @@ describe('ToolRouter', () => {
998 tags: undefined,
999 manage_connections: createExpectedManageConnections(),
1000 workbench: {
1001 + enable: true,
1002 enable_proxy_execution: false,
1003 auto_offload_threshold: 0,
1004 },
1005 });
1006 });
1007 +
1008 + it('should create a session with workbench entirely disabled', async () => {
1009 + mockClient.toolRouter.session.create.mockResolvedValueOnce(mockSessionCreateResponse);
1010 +
1011 + const config: ToolRouterCreateSessionConfig = {
1012 + workbench: {
1013 + enable: false,
1014 + },
1015 + };
1016 +
1017 + await toolRouter.create(userId, config);
1018 +
1019 + expect(mockClient.toolRouter.session.create).toHaveBeenCalledWith({
1020 + user_id: userId,
1021 + toolkits: undefined,
1022 + auth_configs: undefined,
1023 + connected_accounts: undefined,
1024 + tools: undefined,
1025 + tags: undefined,
1026 + manage_connections: createExpectedManageConnections(),
1027 + workbench: {
1028 + enable: false,
1029 + enable_proxy_execution: undefined,
1030 + auto_offload_threshold: undefined,
1031 + },
1032 + });
1033 + });
1034 +
1035 + it('should create a session with workbench explicitly enabled', async () => {
1036 + mockClient.toolRouter.session.create.mockResolvedValueOnce(mockSessionCreateResponse);
1037 +
1038 + const config: ToolRouterCreateSessionConfig = {
1039 + workbench: {
1040 + enable: true,
1041 + enableProxyExecution: true,
1042 + autoOffloadThreshold: 20000,
1043 + },
1044 + };
1045 +
1046 + await toolRouter.create(userId, config);
1047 +
1048 + expect(mockClient.toolRouter.session.create).toHaveBeenCalledWith({
1049 + user_id: userId,
1050 + toolkits: undefined,
1051 + auth_configs: undefined,
1052 + connected_accounts: undefined,
1053 + tools: undefined,
1054 + tags: undefined,
1055 + manage_connections: createExpectedManageConnections(),
1056 + workbench: {
1057 + enable: true,
1058 + enable_proxy_execution: true,
1059 + auto_offload_threshold: 20000,
1060 + },
1061 + });
1062 + });
1063 });
1064
1065 // describe('complex configuration combinations', () => {