Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Update playground usage

Tomas Valenta8c04007bcd67
diff --git a/api-service/agent/basic_agent.py b/api-service/agent/basic_agent.py
index 7216df03a..16610b4ea 100644
--- a/api-service/agent/basic_agent.py
+++ b/api-service/agent/basic_agent.py
@@ -162,6 +162,8 @@ class BasicAgent(AgentBase):
# Create tools
# Create playground for code tools
playground = NodeJSPlayground(get_envs=self.get_envs)
+ await playground.open()
+
tools = list(create_tools(playground=playground))
self.tool_names = [tool.name for tool in tools]
diff --git a/api-service/agent/stripe_agent.py b/api-service/agent/stripe_agent.py
index 1a8c68c7d..8f49f725e 100644
--- a/api-service/agent/stripe_agent.py
+++ b/api-service/agent/stripe_agent.py
@@ -165,6 +165,7 @@ class StripeAgent(AgentBase):
# Create tools
# Create playground for code tools
playground = NodeJSPlayground(get_envs=self.get_envs)
+ await playground.open()
await playground.checkout_repo(instructions["RepoURL"], True, "/repo")
@@ -325,7 +326,7 @@ class StripeAgent(AgentBase):
except RewriteStepsException:
print("REWRITING")
continue
- await playground.push_repo()
+ await playground.push_repo(rootdir="/repo")
except:
raise
finally:
diff --git a/api-service/session/playground/base.py b/api-service/session/playground/base.py
index 7bf3e271b..c630d9547 100644
--- a/api-service/session/playground/base.py
+++ b/api-service/session/playground/base.py
@@ -54,7 +54,7 @@ class Playground(Session):
)
print("res", res)
- async def push_repo(self):
+ async def push_repo(self, rootdir: str):
id = str(uuid.uuid4())[:8]
print(await self.run_command(f"echo 2 > /repo/test.txt"))
@@ -212,6 +212,7 @@ class Playground(Session):
thread.get()
async def write_file(self, path: str, content: str):
+ print("Writing file", path, content)
thread: Any = self.api.write_filesystem_file(
self.id,
path,