MCPcopy Create free account
hub / github.com/agenticsorg/edge-agents / executeCode

Method executeCode

scripts/sparc2/src/agent/agent.ts:357–377  ·  view source on GitHub ↗

* Execute code in a sandbox * @param code Code to execute * @param options Execution options * @returns Execution result

(
    code: string,
    options?: "python" | "javascript" | "typescript" | {
      language?: "python" | "javascript" | "typescript";
      stream?: boolean;
    },
  )

Source from the content-addressed store, hash-verified

355 * @returns Execution result
356 */
357 async executeCode(
358 code: string,
359 options?: "python" | "javascript" | "typescript" | {
360 language?: "python" | "javascript" | "typescript";
361 stream?: boolean;
362 },
363 ) {
364 let language: "python" | "javascript" | "typescript" = "javascript";
365 let stream = true;
366
367 if (typeof options === "string") {
368 language = options;
369 } else if (options && typeof options === "object") {
370 language = options.language || language;
371 stream = options.stream !== undefined ? options.stream : stream;
372 }
373
374 await logInfo(`Executing code`, { language, codeLength: code.length });
375
376 return executeCode(code, { language, stream });
377 }
378}
379
380/**

Callers

nothing calls this directly

Calls 2

logInfoFunction · 0.90
executeCodeFunction · 0.90

Tested by

no test coverage detected