bedrock-agentcore 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +151 -9
  3. package/dist/src/tools/browser/client.d.ts +125 -0
  4. package/dist/src/tools/browser/client.d.ts.map +1 -0
  5. package/dist/src/tools/browser/client.js +320 -0
  6. package/dist/src/tools/browser/client.js.map +1 -0
  7. package/dist/src/tools/browser/index.d.ts +4 -0
  8. package/dist/src/tools/browser/index.d.ts.map +1 -0
  9. package/dist/src/tools/browser/index.js +3 -0
  10. package/dist/src/tools/browser/index.js.map +1 -0
  11. package/dist/src/tools/browser/integrations/playwright/client.d.ts +147 -0
  12. package/dist/src/tools/browser/integrations/playwright/client.d.ts.map +1 -0
  13. package/dist/src/tools/browser/integrations/playwright/client.js +324 -0
  14. package/dist/src/tools/browser/integrations/playwright/client.js.map +1 -0
  15. package/dist/src/tools/browser/integrations/playwright/index.d.ts +20 -0
  16. package/dist/src/tools/browser/integrations/playwright/index.d.ts.map +1 -0
  17. package/dist/src/tools/browser/integrations/playwright/index.js +19 -0
  18. package/dist/src/tools/browser/integrations/playwright/index.js.map +1 -0
  19. package/dist/src/tools/browser/integrations/playwright/types.d.ts +169 -0
  20. package/dist/src/tools/browser/integrations/playwright/types.d.ts.map +1 -0
  21. package/dist/src/tools/browser/integrations/playwright/types.js +2 -0
  22. package/dist/src/tools/browser/integrations/playwright/types.js.map +1 -0
  23. package/dist/src/tools/browser/integrations/vercel-ai/click-tool.d.ts +18 -0
  24. package/dist/src/tools/browser/integrations/vercel-ai/click-tool.d.ts.map +1 -0
  25. package/dist/src/tools/browser/integrations/vercel-ai/click-tool.js +31 -0
  26. package/dist/src/tools/browser/integrations/vercel-ai/click-tool.js.map +1 -0
  27. package/dist/src/tools/browser/integrations/vercel-ai/evaluate-tool.d.ts +18 -0
  28. package/dist/src/tools/browser/integrations/vercel-ai/evaluate-tool.d.ts.map +1 -0
  29. package/dist/src/tools/browser/integrations/vercel-ai/evaluate-tool.js +32 -0
  30. package/dist/src/tools/browser/integrations/vercel-ai/evaluate-tool.js.map +1 -0
  31. package/dist/src/tools/browser/integrations/vercel-ai/get-html-tool.d.ts +17 -0
  32. package/dist/src/tools/browser/integrations/vercel-ai/get-html-tool.d.ts.map +1 -0
  33. package/dist/src/tools/browser/integrations/vercel-ai/get-html-tool.js +30 -0
  34. package/dist/src/tools/browser/integrations/vercel-ai/get-html-tool.js.map +1 -0
  35. package/dist/src/tools/browser/integrations/vercel-ai/get-text-tool.d.ts +17 -0
  36. package/dist/src/tools/browser/integrations/vercel-ai/get-text-tool.d.ts.map +1 -0
  37. package/dist/src/tools/browser/integrations/vercel-ai/get-text-tool.js +30 -0
  38. package/dist/src/tools/browser/integrations/vercel-ai/get-text-tool.js.map +1 -0
  39. package/dist/src/tools/browser/integrations/vercel-ai/index.d.ts +19 -0
  40. package/dist/src/tools/browser/integrations/vercel-ai/index.d.ts.map +1 -0
  41. package/dist/src/tools/browser/integrations/vercel-ai/index.js +19 -0
  42. package/dist/src/tools/browser/integrations/vercel-ai/index.js.map +1 -0
  43. package/dist/src/tools/browser/integrations/vercel-ai/navigate-tool.d.ts +19 -0
  44. package/dist/src/tools/browser/integrations/vercel-ai/navigate-tool.d.ts.map +1 -0
  45. package/dist/src/tools/browser/integrations/vercel-ai/navigate-tool.js +39 -0
  46. package/dist/src/tools/browser/integrations/vercel-ai/navigate-tool.js.map +1 -0
  47. package/dist/src/tools/browser/integrations/vercel-ai/screenshot-tool.d.ts +22 -0
  48. package/dist/src/tools/browser/integrations/vercel-ai/screenshot-tool.d.ts.map +1 -0
  49. package/dist/src/tools/browser/integrations/vercel-ai/screenshot-tool.js +44 -0
  50. package/dist/src/tools/browser/integrations/vercel-ai/screenshot-tool.js.map +1 -0
  51. package/dist/src/tools/browser/integrations/vercel-ai/tools.d.ts +123 -0
  52. package/dist/src/tools/browser/integrations/vercel-ai/tools.d.ts.map +1 -0
  53. package/dist/src/tools/browser/integrations/vercel-ai/tools.js +145 -0
  54. package/dist/src/tools/browser/integrations/vercel-ai/tools.js.map +1 -0
  55. package/dist/src/tools/browser/integrations/vercel-ai/type-tool.d.ts +20 -0
  56. package/dist/src/tools/browser/integrations/vercel-ai/type-tool.d.ts.map +1 -0
  57. package/dist/src/tools/browser/integrations/vercel-ai/type-tool.js +35 -0
  58. package/dist/src/tools/browser/integrations/vercel-ai/type-tool.js.map +1 -0
  59. package/dist/src/tools/browser/types.d.ts +336 -0
  60. package/dist/src/tools/browser/types.d.ts.map +1 -0
  61. package/dist/src/tools/browser/types.js +17 -0
  62. package/dist/src/tools/browser/types.js.map +1 -0
  63. package/dist/src/tools/code-interpreter/client.d.ts +212 -0
  64. package/dist/src/tools/code-interpreter/client.d.ts.map +1 -0
  65. package/dist/src/tools/code-interpreter/client.js +512 -0
  66. package/dist/src/tools/code-interpreter/client.js.map +1 -0
  67. package/dist/src/tools/code-interpreter/index.d.ts +4 -0
  68. package/dist/src/tools/code-interpreter/index.d.ts.map +1 -0
  69. package/dist/src/tools/code-interpreter/index.js +5 -0
  70. package/dist/src/tools/code-interpreter/index.js.map +1 -0
  71. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.d.ts +27 -0
  72. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.d.ts.map +1 -0
  73. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.js +46 -0
  74. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.js.map +1 -0
  75. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.d.ts +26 -0
  76. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.d.ts.map +1 -0
  77. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.js +41 -0
  78. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.js.map +1 -0
  79. package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.d.ts +32 -0
  80. package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.d.ts.map +1 -0
  81. package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.js +77 -0
  82. package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.js.map +1 -0
  83. package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.d.ts +26 -0
  84. package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.d.ts.map +1 -0
  85. package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.js +26 -0
  86. package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.js.map +1 -0
  87. package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.d.ts +94 -0
  88. package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.d.ts.map +1 -0
  89. package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.js +112 -0
  90. package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.js.map +1 -0
  91. package/dist/src/tools/code-interpreter/types.d.ts +473 -0
  92. package/dist/src/tools/code-interpreter/types.d.ts.map +1 -0
  93. package/dist/src/tools/code-interpreter/types.js +52 -0
  94. package/dist/src/tools/code-interpreter/types.js.map +1 -0
  95. package/package.json +99 -12
  96. package/index.js +0 -4
@@ -0,0 +1,41 @@
1
+ /// <reference types="node" />
2
+ import { tool } from 'ai';
3
+ import { z } from 'zod';
4
+ /**
5
+ * Creates a Vercel AI SDK tool for executing shell commands in CodeInterpreter.
6
+ *
7
+ * @param interpreter - CodeInterpreter instance
8
+ * @returns Vercel AI SDK tool for command execution
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { createExecuteCommandTool } from '@bedrock-agentcore/sdk/code-interpreter/vercel-ai'
13
+ * import { CodeInterpreter } from '@bedrock-agentcore/sdk/code-interpreter'
14
+ *
15
+ * const interpreter = new CodeInterpreter({ region: 'us-west-2' })
16
+ * const executeCommandTool = createExecuteCommandTool(interpreter)
17
+ *
18
+ * // Use with Vercel AI SDK Agent
19
+ * const agent = new ToolLoopAgent({
20
+ * model: bedrock('global.anthropic.claude-sonnet-4-20250514-v1:0'),
21
+ * tools: { executeCommand: executeCommandTool }
22
+ * })
23
+ * ```
24
+ */
25
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/explicit-module-boundary-types
26
+ export function createExecuteCommandTool(interpreter) {
27
+ return tool({
28
+ description: `Execute shell commands in the sandbox environment.
29
+ Use this to run system commands, install packages, manipulate files with Unix tools, etc.
30
+ The environment persists across executions within the same session.`,
31
+ inputSchema: z.object({
32
+ command: z.string().describe('The shell command to execute'),
33
+ }),
34
+ execute: async ({ command }) => {
35
+ 'use step';
36
+ const result = await interpreter.executeCommand({ command });
37
+ return result;
38
+ },
39
+ });
40
+ }
41
+ //# sourceMappingURL=execute-command-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-command-tool.js","sourceRoot":"","sources":["../../../../../../src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,+HAA+H;AAC/H,MAAM,UAAU,wBAAwB,CAAC,WAA4B;IACnE,OAAO,IAAI,CAAC;QACV,WAAW,EAAE;;oEAEmD;QAChE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;SAC7D,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;YAC7B,UAAU,CAAA;YAEV,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;YAE5D,OAAO,MAAM,CAAA;QACf,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { CodeInterpreter } from '../../client.js';
2
+ /**
3
+ * Creates a Vercel AI SDK tool for file operations in CodeInterpreter.
4
+ *
5
+ * @param interpreter - CodeInterpreter instance
6
+ * @returns Vercel AI SDK tool for file operations
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { createFileOperationsTool } from '@bedrock-agentcore/sdk/code-interpreter/vercel-ai'
11
+ * import { CodeInterpreter } from '@bedrock-agentcore/sdk/code-interpreter'
12
+ *
13
+ * const interpreter = new CodeInterpreter({ region: 'us-west-2' })
14
+ * const fileOpsTool = createFileOperationsTool(interpreter)
15
+ *
16
+ * // Use with Vercel AI SDK Agent
17
+ * const agent = new ToolLoopAgent({
18
+ * model: bedrock('global.anthropic.claude-sonnet-4-20250514-v1:0'),
19
+ * tools: { fileOps: fileOpsTool }
20
+ * })
21
+ * ```
22
+ */
23
+ export declare function createFileOperationsTool(interpreter: CodeInterpreter): import("ai").Tool<{
24
+ operation: "write" | "read" | "list" | "remove";
25
+ path: string;
26
+ files?: {
27
+ path: string;
28
+ content: string;
29
+ }[] | undefined;
30
+ paths?: string[] | undefined;
31
+ }, string>;
32
+ //# sourceMappingURL=file-operations-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-operations-tool.d.ts","sourceRoot":"","sources":["../../../../../../src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,eAAe;;;;;;;;WAyDpE"}
@@ -0,0 +1,77 @@
1
+ /// <reference types="node" />
2
+ import { tool } from 'ai';
3
+ import { z } from 'zod';
4
+ /**
5
+ * Creates a Vercel AI SDK tool for file operations in CodeInterpreter.
6
+ *
7
+ * @param interpreter - CodeInterpreter instance
8
+ * @returns Vercel AI SDK tool for file operations
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { createFileOperationsTool } from '@bedrock-agentcore/sdk/code-interpreter/vercel-ai'
13
+ * import { CodeInterpreter } from '@bedrock-agentcore/sdk/code-interpreter'
14
+ *
15
+ * const interpreter = new CodeInterpreter({ region: 'us-west-2' })
16
+ * const fileOpsTool = createFileOperationsTool(interpreter)
17
+ *
18
+ * // Use with Vercel AI SDK Agent
19
+ * const agent = new ToolLoopAgent({
20
+ * model: bedrock('global.anthropic.claude-sonnet-4-20250514-v1:0'),
21
+ * tools: { fileOps: fileOpsTool }
22
+ * })
23
+ * ```
24
+ */
25
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/explicit-module-boundary-types
26
+ export function createFileOperationsTool(interpreter) {
27
+ return tool({
28
+ description: `Manage files in the code execution sandbox.
29
+ Use this to create notebooks/scripts, store intermediate results, and inspect outputs.
30
+ Operations: write (create/update files), read (get file contents), list (show directory contents), remove (delete files).`,
31
+ inputSchema: z.object({
32
+ operation: z.enum(['write', 'read', 'list', 'remove']).describe('File operation to perform'),
33
+ files: z
34
+ .array(z.object({
35
+ path: z.string().describe('File path'),
36
+ content: z.string().describe('File content (for write operation)'),
37
+ }))
38
+ .optional()
39
+ .describe('Files to write (for write operation)'),
40
+ paths: z.array(z.string()).optional().describe('File paths to read or remove (for read/remove operations)'),
41
+ path: z.string().optional().default('.').describe('Directory path to list (for list operation)'),
42
+ }),
43
+ execute: async ({ operation, files, paths, path }) => {
44
+ 'use step';
45
+ switch (operation) {
46
+ case 'write': {
47
+ if (!files || files.length === 0) {
48
+ return 'status: error\nerror: No files specified for write operation';
49
+ }
50
+ const result = await interpreter.writeFiles({ files });
51
+ return result;
52
+ }
53
+ case 'read': {
54
+ if (!paths || paths.length === 0) {
55
+ return 'status: error\nerror: No paths specified for read operation';
56
+ }
57
+ const result = await interpreter.readFiles({ paths });
58
+ return result;
59
+ }
60
+ case 'list': {
61
+ const result = await interpreter.listFiles({ path });
62
+ return result;
63
+ }
64
+ case 'remove': {
65
+ if (!paths || paths.length === 0) {
66
+ return 'status: error\nerror: No paths specified for remove operation';
67
+ }
68
+ const result = await interpreter.removeFiles({ paths });
69
+ return result;
70
+ }
71
+ default:
72
+ return 'status: error\nerror: Invalid operation';
73
+ }
74
+ },
75
+ });
76
+ }
77
+ //# sourceMappingURL=file-operations-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-operations-tool.js","sourceRoot":"","sources":["../../../../../../src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,+HAA+H;AAC/H,MAAM,UAAU,wBAAwB,CAAC,WAA4B;IACnE,OAAO,IAAI,CAAC;QACV,WAAW,EAAE;;0HAEyG;QACtH,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;YAC5F,KAAK,EAAE,CAAC;iBACL,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;gBACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;gBACtC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;aACnE,CAAC,CACH;iBACA,QAAQ,EAAE;iBACV,QAAQ,CAAC,sCAAsC,CAAC;YACnD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2DAA2D,C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OAAO,MAAM,CAAA;gBACf,CAAC;gBAED;oBACE,OAAO,yCAAyC,CAAA;YACpD,CAAC;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Vercel AI SDK integrations for AWS Bedrock AgentCore CodeInterpreter.
3
+ *
4
+ * This module provides a unified CodeInterpreterTools class that simplifies
5
+ * integration with Vercel AI SDK v6 ToolLoopAgent.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { ToolLoopAgent } from 'ai'
10
+ * import { bedrock } from '@ai-sdk/amazon-bedrock'
11
+ * import { CodeInterpreterTools } from '@bedrock-agentcore/sdk/code-interpreter/vercel-ai'
12
+ *
13
+ * const codeInterpreter = new CodeInterpreterTools({ region: 'us-west-2' })
14
+ *
15
+ * const agent = new ToolLoopAgent({
16
+ * model: bedrock('global.anthropic.claude-sonnet-4-20250514-v1:0'),
17
+ * instructions: 'You are a helpful coding assistant...',
18
+ * tools: codeInterpreter.tools,
19
+ * })
20
+ *
21
+ * // Clean up when done
22
+ * await codeInterpreter.stopSession()
23
+ * ```
24
+ */
25
+ export { CodeInterpreterTools } from './tools.js';
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/tools/code-interpreter/integrations/vercel-ai/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Vercel AI SDK integrations for AWS Bedrock AgentCore CodeInterpreter.
3
+ *
4
+ * This module provides a unified CodeInterpreterTools class that simplifies
5
+ * integration with Vercel AI SDK v6 ToolLoopAgent.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { ToolLoopAgent } from 'ai'
10
+ * import { bedrock } from '@ai-sdk/amazon-bedrock'
11
+ * import { CodeInterpreterTools } from '@bedrock-agentcore/sdk/code-interpreter/vercel-ai'
12
+ *
13
+ * const codeInterpreter = new CodeInterpreterTools({ region: 'us-west-2' })
14
+ *
15
+ * const agent = new ToolLoopAgent({
16
+ * model: bedrock('global.anthropic.claude-sonnet-4-20250514-v1:0'),
17
+ * instructions: 'You are a helpful coding assistant...',
18
+ * tools: codeInterpreter.tools,
19
+ * })
20
+ *
21
+ * // Clean up when done
22
+ * await codeInterpreter.stopSession()
23
+ * ```
24
+ */
25
+ export { CodeInterpreterTools } from './tools.js';
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/tools/code-interpreter/integrations/vercel-ai/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Unified CodeInterpreter Tools for Vercel AI SDK
3
+ *
4
+ * Provides all three CodeInterpreter tools and session management in one class.
5
+ */
6
+ import { CodeInterpreter } from '../../client.js';
7
+ import type { CodeInterpreterConfig, SessionInfo } from '../../types.js';
8
+ import { createExecuteCodeTool } from './execute-code-tool.js';
9
+ import { createFileOperationsTool } from './file-operations-tool.js';
10
+ import { createExecuteCommandTool } from './execute-command-tool.js';
11
+ /**
12
+ * CodeInterpreterTools - All-in-one CodeInterpreter integration for Vercel AI SDK
13
+ *
14
+ * Provides three ready-to-use tools and session management in a single class.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * import { CodeInterpreterTools } from '@bedrock-agentcore/sdk/code-interpreter/vercel-ai'
19
+ * import { ToolLoopAgent } from 'ai'
20
+ * import { bedrock } from '@ai-sdk/amazon-bedrock'
21
+ *
22
+ * // Create tools instance
23
+ * const codeInterpreter = new CodeInterpreterTools({ region: 'us-west-2' })
24
+ *
25
+ * // Start session (optional - automatically started on first use)
26
+ * await codeInterpreter.startSession()
27
+ *
28
+ * // Create agent with all three tools
29
+ * const agent = new ToolLoopAgent({
30
+ * model: bedrock('global.anthropic.claude-sonnet-4-20250514-v1:0'),
31
+ * tools: codeInterpreter.tools,
32
+ * })
33
+ *
34
+ * // Clean up when done
35
+ * await codeInterpreter.stopSession()
36
+ * ```
37
+ */
38
+ export declare class CodeInterpreterTools {
39
+ private interpreter;
40
+ /**
41
+ * Tool for executing Python, JavaScript, or TypeScript code
42
+ */
43
+ readonly executeCode: ReturnType<typeof createExecuteCodeTool>;
44
+ /**
45
+ * Tool for file operations (read, write, list, remove)
46
+ */
47
+ readonly fileOperations: ReturnType<typeof createFileOperationsTool>;
48
+ /**
49
+ * Tool for executing shell commands
50
+ */
51
+ readonly executeCommand: ReturnType<typeof createExecuteCommandTool>;
52
+ /**
53
+ * All three tools in an object for easy spreading into agent config
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * const agent = new ToolLoopAgent({
58
+ * tools: codeInterpreter.tools, // spreads all three tools
59
+ * })
60
+ * ```
61
+ */
62
+ readonly tools: {
63
+ executeCode: ReturnType<typeof createExecuteCodeTool>;
64
+ fileOperations: ReturnType<typeof createFileOperationsTool>;
65
+ executeCommand: ReturnType<typeof createExecuteCommandTool>;
66
+ };
67
+ constructor(config?: CodeInterpreterConfig);
68
+ /**
69
+ * Start a CodeInterpreter session
70
+ *
71
+ * Sessions are automatically started on first tool use, but you can
72
+ * call this explicitly to start the session upfront.
73
+ *
74
+ * @param sessionName - Optional session name for AWS
75
+ * @param timeout - Optional session timeout in seconds (default: 900, max: 28800)
76
+ * @returns Session information
77
+ */
78
+ startSession(sessionName?: string, timeout?: number): Promise<SessionInfo>;
79
+ /**
80
+ * Stop the current CodeInterpreter session
81
+ *
82
+ * Call this when you're done using the tools to clean up resources.
83
+ */
84
+ stopSession(): Promise<void>;
85
+ /**
86
+ * Get the underlying CodeInterpreter client
87
+ *
88
+ * Provides direct access to the client for advanced use cases.
89
+ *
90
+ * @returns The CodeInterpreter client instance
91
+ */
92
+ getClient(): CodeInterpreter;
93
+ }
94
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../../../src/tools/code-interpreter/integrations/vercel-ai/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAsB,MAAM,gBAAgB,CAAA;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,WAAW,CAAiB;IAEpC;;OAEG;IACH,SAAgB,WAAW,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;IAErE;;OAEG;IACH,SAAgB,cAAc,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAA;IAE3E;;OAEG;IACH,SAAgB,cAAc,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAA;IAE3E;;;;;;;;;OASG;IACH,SAAgB,KAAK,EAAE;QACrB,WAAW,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;QACrD,cAAc,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAA;QAC3D,cAAc,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAA;KAC5D,CAAA;gBAEW,MAAM,GAAE,qBAA0B;IAgB9C;;;;;;;;;OASG;IACG,YAAY,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAOhF;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAIlC;;;;;;OAMG;IACH,SAAS,IAAI,eAAe;CAG7B"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Unified CodeInterpreter Tools for Vercel AI SDK
3
+ *
4
+ * Provides all three CodeInterpreter tools and session management in one class.
5
+ */
6
+ import { CodeInterpreter } from '../../client.js';
7
+ import { createExecuteCodeTool } from './execute-code-tool.js';
8
+ import { createFileOperationsTool } from './file-operations-tool.js';
9
+ import { createExecuteCommandTool } from './execute-command-tool.js';
10
+ /**
11
+ * CodeInterpreterTools - All-in-one CodeInterpreter integration for Vercel AI SDK
12
+ *
13
+ * Provides three ready-to-use tools and session management in a single class.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * import { CodeInterpreterTools } from '@bedrock-agentcore/sdk/code-interpreter/vercel-ai'
18
+ * import { ToolLoopAgent } from 'ai'
19
+ * import { bedrock } from '@ai-sdk/amazon-bedrock'
20
+ *
21
+ * // Create tools instance
22
+ * const codeInterpreter = new CodeInterpreterTools({ region: 'us-west-2' })
23
+ *
24
+ * // Start session (optional - automatically started on first use)
25
+ * await codeInterpreter.startSession()
26
+ *
27
+ * // Create agent with all three tools
28
+ * const agent = new ToolLoopAgent({
29
+ * model: bedrock('global.anthropic.claude-sonnet-4-20250514-v1:0'),
30
+ * tools: codeInterpreter.tools,
31
+ * })
32
+ *
33
+ * // Clean up when done
34
+ * await codeInterpreter.stopSession()
35
+ * ```
36
+ */
37
+ export class CodeInterpreterTools {
38
+ interpreter;
39
+ /**
40
+ * Tool for executing Python, JavaScript, or TypeScript code
41
+ */
42
+ executeCode;
43
+ /**
44
+ * Tool for file operations (read, write, list, remove)
45
+ */
46
+ fileOperations;
47
+ /**
48
+ * Tool for executing shell commands
49
+ */
50
+ executeCommand;
51
+ /**
52
+ * All three tools in an object for easy spreading into agent config
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * const agent = new ToolLoopAgent({
57
+ * tools: codeInterpreter.tools, // spreads all three tools
58
+ * })
59
+ * ```
60
+ */
61
+ tools;
62
+ constructor(config = {}) {
63
+ this.interpreter = new CodeInterpreter(config);
64
+ // Create all three tools
65
+ this.executeCode = createExecuteCodeTool(this.interpreter);
66
+ this.fileOperations = createFileOperationsTool(this.interpreter);
67
+ this.executeCommand = createExecuteCommandTool(this.interpreter);
68
+ // Create tools object for easy spreading
69
+ this.tools = {
70
+ executeCode: this.executeCode,
71
+ fileOperations: this.fileOperations,
72
+ executeCommand: this.executeCommand,
73
+ };
74
+ }
75
+ /**
76
+ * Start a CodeInterpreter session
77
+ *
78
+ * Sessions are automatically started on first tool use, but you can
79
+ * call this explicitly to start the session upfront.
80
+ *
81
+ * @param sessionName - Optional session name for AWS
82
+ * @param timeout - Optional session timeout in seconds (default: 900, max: 28800)
83
+ * @returns Session information
84
+ */
85
+ async startSession(sessionName, timeout) {
86
+ const params = {};
87
+ if (sessionName !== undefined)
88
+ params.sessionName = sessionName;
89
+ if (timeout !== undefined)
90
+ params.timeout = timeout;
91
+ return this.interpreter.startSession(Object.keys(params).length > 0 ? params : undefined);
92
+ }
93
+ /**
94
+ * Stop the current CodeInterpreter session
95
+ *
96
+ * Call this when you're done using the tools to clean up resources.
97
+ */
98
+ async stopSession() {
99
+ await this.interpreter.stopSession();
100
+ }
101
+ /**
102
+ * Get the underlying CodeInterpreter client
103
+ *
104
+ * Provides direct access to the client for advanced use cases.
105
+ *
106
+ * @returns The CodeInterpreter client instance
107
+ */
108
+ getClient() {
109
+ return this.interpreter;
110
+ }
111
+ }
112
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../../../../src/tools/code-interpreter/integrations/vercel-ai/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,C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