Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
test(ts/e2e): cover claude agent sdk on node current (#3620)
This PR: - builds on top of https://github.com/ComposioHQ/composio/pull/3495 - adds a Node.js `current` e2e suite for `@composio/claude-agent-sdk` - exercises the packaged provider through Claude Agent SDK `createSdkMcpServer` / `query()` with a deterministic local tool - forwards `ANTHROPIC_API_KEY` through Turbo, Docker e2e env passthrough, and the Node e2e workflow
Alberto Schiabel committed
Jun 20, 2026 at 02:08 UTC
24e647fa168dbb587c7b9577ee1d95a780f46b3c
10 files changed
+212
-2
.github/workflows/ts.test-e2e.yml
+1
@@ -56,6 +56,7 @@ jobs:
56
COMPOSIO_BASE_URL: ${{ secrets.COMPOSIO_BASE_URL_STAGING }}
57
COMPOSIO_USER_API_KEY: ${{ secrets.COMPOSIO_USER_API_KEY }}
58
COMPOSIO_E2E_NODE_VERSION: ${{ matrix.node-version }}
59
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
60
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
61
62
steps:
pnpm-lock.yaml
+22
@@ -333,6 +333,28 @@ importers:
333
specifier: workspace:*
334
version: link:../../../_utils
335
336
+ ts/e2e-tests/runtimes/node/claude-agent-sdk:
337
+ dependencies:
338
+ '@anthropic-ai/claude-agent-sdk':
339
+ specifier: ^0.1.9
340
+ version: 0.1.77(zod@3.25.76)
341
+ '@composio/claude-agent-sdk':
342
+ specifier: workspace:*
343
+ version: link:../../../../packages/providers/claude-agent-sdk
344
+ '@composio/core':
345
+ specifier: workspace:*
346
+ version: link:../../../../packages/core
347
+ zod:
348
+ specifier: 3.25.76
349
+ version: 3.25.76
350
+ devDependencies:
351
+ '@e2e-tests/utils':
352
+ specifier: workspace:*
353
+ version: link:../../../_utils
354
+ typescript:
355
+ specifier: 'catalog:'
356
+ version: 5.9.3
357
+
358
ts/e2e-tests/runtimes/node/custom-tools:
359
dependencies:
360
'@composio/core':
ts/e2e-tests/README.md
+1
@@ -27,6 +27,7 @@ ts/e2e-tests/
27
├── runtimes/
28
├── node/ # Node.js runtime tests
29
│ ├── cjs-basic/ # Node.js 22 require(esm) interop tests
30
+ │ ├── claude-agent-sdk/ # @composio/claude-agent-sdk + Claude Agent SDK MCP tests
31
│ ├── custom-tools/ # Custom local tools execution (session.execute, proxyExecute, Zod validation)
32
│ ├── esm-basic/ # ESM compatibility tests
33
│ ├── json-schema-to-zod-v3/ # @composio/json-schema-to-zod + Zod v3 tests
ts/e2e-tests/_utils/src/const.ts
+1
@@ -4,6 +4,7 @@ import toolchainVersions from '../../../../toolchain-versions.json' with { type:
4
* Environment variables to automatically pass through to Docker containers.
5
*/
6
export const WELL_KNOWN_ENV_VARS = [
7
+ 'ANTHROPIC_API_KEY',
8
'COMPOSIO_API_KEY',
9
'COMPOSIO_BASE_URL',
10
'OPENAI_API_KEY',
ts/e2e-tests/runtimes/node/claude-agent-sdk/README.md
new
+17
@@ -0,0 +1,17 @@
1
+# Node.js Claude Agent SDK E2E
2
+
3
+Verifies that `@composio/claude-agent-sdk` works on the current Node.js runtime with the real `@anthropic-ai/claude-agent-sdk` package.
4
+
5
+The fixture wraps a deterministic local Composio-style tool, mounts it into an SDK MCP server, and asks Claude to call it.
6
+
7
+## Requirements
8
+
9
+```bash
10
+ANTHROPIC_API_KEY=...
11
+```
12
+
13
+## Run
14
+
15
+```bash
16
+pnpm --filter @e2e-tests/node-claude-agent-sdk test:e2e:node
17
+```
ts/e2e-tests/runtimes/node/claude-agent-sdk/e2e.test.ts
new
+34
@@ -0,0 +1,34 @@
1
+import { e2e, type E2ETestResult } from '@e2e-tests/utils';
2
+import { TIMEOUTS } from '@e2e-tests/utils/const';
3
+import { describe, it, expect, beforeAll } from 'bun:test';
4
+
5
+declare module 'bun' {
6
+ interface Env {
7
+ ANTHROPIC_API_KEY: string;
8
+ }
9
+}
10
+
11
+e2e(import.meta.url, {
12
+ versions: { node: ['current'] },
13
+ usesFixtures: true,
14
+ env: {
15
+ ANTHROPIC_API_KEY: Bun.env.ANTHROPIC_API_KEY,
16
+ },
17
+ defineTests: ({ runFixture }) => {
18
+ let result: E2ETestResult;
19
+
20
+ beforeAll(async () => {
21
+ result = await runFixture({ filename: 'index.mjs' });
22
+ }, TIMEOUTS.LLM_LONG);
23
+
24
+ describe('@composio/claude-agent-sdk on current Node.js', () => {
25
+ it('exits successfully', () => {
26
+ expect(result.exitCode).toBe(0);
27
+ });
28
+
29
+ it('executes the wrapped tool through Claude Agent SDK MCP', () => {
30
+ expect(result.stdout).toContain('claude query executed wrapped tool');
31
+ });
32
+ });
33
+ },
34
+});
ts/e2e-tests/runtimes/node/claude-agent-sdk/fixtures/index.mjs
new
+101
@@ -0,0 +1,101 @@
1
+import { ClaudeAgentSDKProvider } from '@composio/claude-agent-sdk';
2
+import { createSdkMcpServer, query } from '@anthropic-ai/claude-agent-sdk';
3
+
4
+const TOOL_SLUG = 'COMPOSIO_E2E_SENTINEL';
5
+const SENTINEL = 'COMPOSIO_CLAUDE_AGENT_SDK_NODE_CURRENT_OK';
6
+
7
+const provider = new ClaudeAgentSDKProvider();
8
+const calls = [];
9
+
10
+const tools = provider.wrapTools(
11
+ [
12
+ {
13
+ slug: TOOL_SLUG,
14
+ name: 'Composio E2E Sentinel',
15
+ description:
16
+ 'Returns the exact Composio Claude Agent SDK e2e sentinel. Use this tool when asked for the sentinel.',
17
+ version: 'e2e',
18
+ availableVersions: ['e2e'],
19
+ inputParameters: {
20
+ type: 'object',
21
+ properties: {
22
+ label: {
23
+ type: 'string',
24
+ enum: ['node-current'],
25
+ description: 'The e2e runtime label.',
26
+ },
27
+ shout: {
28
+ type: 'boolean',
29
+ description: 'Whether to return the uppercase sentinel.',
30
+ default: true,
31
+ },
32
+ },
33
+ required: ['label'],
34
+ additionalProperties: false,
35
+ },
36
+ tags: ['e2e'],
37
+ },
38
+ ],
39
+ async (toolSlug, input) => {
40
+ calls.push({ toolSlug, input });
41
+
42
+ if (toolSlug !== TOOL_SLUG) {
43
+ throw new Error(`Unexpected tool slug: ${toolSlug}`);
44
+ }
45
+ if (input.label !== 'node-current') {
46
+ throw new Error(`Unexpected label: ${JSON.stringify(input.label)}`);
47
+ }
48
+
49
+ return input.shout === false ? SENTINEL.toLowerCase() : SENTINEL;
50
+ }
51
+);
52
+
53
+if (tools.length !== 1) {
54
+ throw new Error(`Expected exactly one wrapped tool, got ${tools.length}`);
55
+}
56
+
57
+const mcpServer = createSdkMcpServer({
58
+ name: 'composio',
59
+ version: '1.0.0',
60
+ tools,
61
+});
62
+
63
+let queryResult = '';
64
+
65
+for await (const message of query({
66
+ prompt: [
67
+ `Use the ${TOOL_SLUG} tool with label "node-current" and shout true.`,
68
+ `Reply with exactly the tool result: ${SENTINEL}`,
69
+ 'Do not use any built-in tools.',
70
+ ].join('\n'),
71
+ options: {
72
+ mcpServers: { composio: mcpServer },
73
+ tools: [],
74
+ allowedTools: [`mcp__composio__${TOOL_SLUG}`],
75
+ permissionMode: 'bypassPermissions',
76
+ allowDangerouslySkipPermissions: true,
77
+ maxTurns: 4,
78
+ maxBudgetUsd: 0.25,
79
+ persistSession: false,
80
+ settingSources: [],
81
+ },
82
+})) {
83
+ if (message.type === 'result') {
84
+ if (message.subtype !== 'success') {
85
+ throw new Error(`Claude query failed: ${JSON.stringify(message.errors ?? message)}`);
86
+ }
87
+ queryResult = message.result;
88
+ }
89
+}
90
+
91
+const sdkCalls = calls.filter(call => call.toolSlug === TOOL_SLUG);
92
+
93
+if (sdkCalls.length < 1) {
94
+ throw new Error(`Expected Claude Agent SDK to call ${TOOL_SLUG}, got ${sdkCalls.length} calls`);
95
+}
96
+
97
+if (!queryResult.includes(SENTINEL)) {
98
+ throw new Error(`Expected query result to include ${SENTINEL}, got ${JSON.stringify(queryResult)}`);
99
+}
100
+
101
+console.log('claude query executed wrapped tool');
ts/e2e-tests/runtimes/node/claude-agent-sdk/package.json
new
+21
@@ -0,0 +1,21 @@
1
+{
2
+ "name": "@e2e-tests/node-claude-agent-sdk",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "typecheck": "tsc --noEmit",
8
+ "test:e2e": "bun test e2e.test.ts",
9
+ "test:e2e:node": "bun test e2e.test.ts"
10
+ },
11
+ "dependencies": {
12
+ "@anthropic-ai/claude-agent-sdk": "^0.1.9",
13
+ "@composio/claude-agent-sdk": "workspace:*",
14
+ "@composio/core": "workspace:*",
15
+ "zod": "3.25.76"
16
+ },
17
+ "devDependencies": {
18
+ "@e2e-tests/utils": "workspace:*",
19
+ "typescript": "catalog:"
20
+ }
21
+}
ts/e2e-tests/runtimes/node/claude-agent-sdk/tsconfig.json
new
+12
@@ -0,0 +1,12 @@
1
+{
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "target": "es2022",
5
+ "module": "esnext",
6
+ "moduleResolution": "bundler",
7
+ "strict": true,
8
+ "skipLibCheck": true,
9
+ "noEmit": true
10
+ },
11
+ "include": ["e2e.test.ts"]
12
+}
turbo.jsonc
+2
-2
@@ -24,12 +24,12 @@
24
},
25
"test:e2e": {
26
"dependsOn": ["^build"],
27
- "env": ["COMPOSIO_API_KEY", "COMPOSIO_BASE_URL", "COMPOSIO_USER_API_KEY", "OPENAI_API_KEY"],
27
+ "env": ["ANTHROPIC_API_KEY", "COMPOSIO_API_KEY", "COMPOSIO_BASE_URL", "COMPOSIO_USER_API_KEY", "OPENAI_API_KEY"],
28
"cache": false
29
},
30
"test:e2e:node": {
31
"dependsOn": ["^build"],
32
- "env": ["COMPOSIO_API_KEY", "COMPOSIO_BASE_URL", "COMPOSIO_USER_API_KEY", "COMPOSIO_E2E_NODE_VERSION", "OPENAI_API_KEY"],
32
+ "env": ["ANTHROPIC_API_KEY", "COMPOSIO_API_KEY", "COMPOSIO_BASE_URL", "COMPOSIO_USER_API_KEY", "COMPOSIO_E2E_NODE_VERSION", "OPENAI_API_KEY"],
33
"cache": false
34
},
35
"test:e2e:deno": {