MCPcopy
hub / github.com/agent-infra/sandbox / createSandbox

Method createSandbox

sdk/js/src/providers/volcengine.ts:54–92  ·  view source on GitHub ↗

* Create a new sandbox instance using Volcengine VEFAAS. * * @param functionId - The function ID for the sandbox * @param timeout - The timeout for the sandbox creation in seconds (default: 60) * @param kwargs - Additional parameters for sandbox creation * @returns The ID of the creat

(
    functionId: string,
    timeout: number = 60,
    ...kwargs: any[]
  )

Source from the content-addressed store, hash-verified

52 * @returns The ID of the created sandbox or error
53 */
54 async createSandbox(
55 functionId: string,
56 timeout: number = 60,
57 ...kwargs: any[]
58 ): Promise<any> {
59 try {
60 const params = kwargs[0] || {};
61 const body = JSON.stringify({
62 FunctionId: functionId,
63 Timeout: timeout,
64 Metadata: params.metadata,
65 InstanceTosMountConfig: params.instanceTosMountConfig,
66 Envs: params.envs,
67 InstanceImageInfo: params.instanceImageInfo,
68 CpuMilli: params.cpuMilli,
69 MemoryMB: params.memoryMB,
70 MaxConcurrency: params.maxConcurrency,
71 RequestTimeout: params.requestTimeout,
72 ...kwargs[0]
73 });
74
75 const response = await request(
76 'POST',
77 new Date(),
78 {},
79 {},
80 this.accessKey,
81 this.secretKey,
82 null,
83 'CreateSandbox',
84 body,
85 this.region,
86 );
87
88 return response;
89 } catch (error) {
90 return error;
91 }
92 }
93
94 /**
95 * Delete an existing sandbox instance.

Callers 3

combinedWorkflowFunction · 0.80
mainFunction · 0.80

Calls 1

requestFunction · 0.90

Tested by

no test coverage detected