From 7b116ce7f7299bc4719afb0d0d22fa6df26715ae Mon Sep 17 00:00:00 2001
From: Marcus Schiesser <mail@marcusschiesser.de>
Date: Fri, 7 Jun 2024 17:35:23 +0200
Subject: [PATCH] fix: allow subsequent tool calls

---
 .../components/engines/typescript/agent/tools/interpreter.ts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/templates/components/engines/typescript/agent/tools/interpreter.ts b/templates/components/engines/typescript/agent/tools/interpreter.ts
index aec3029c..9522ab85 100644
--- a/templates/components/engines/typescript/agent/tools/interpreter.ts
+++ b/templates/components/engines/typescript/agent/tools/interpreter.ts
@@ -107,10 +107,13 @@ export class InterpreterTool implements BaseTool<InterpreterParameter> {
 
   async call(input: InterpreterParameter): Promise<InterpreterToolOutput> {
     const result = await this.codeInterpret(input.code);
-    await this.codeInterpreter?.close();
     return result;
   }
 
+  async close() {
+    await this.codeInterpreter?.close();
+  }
+
   private async getExtraResult(
     res?: Result,
   ): Promise<InterpreterExtraResult[]> {
-- 
GitLab