Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Update sync python example
Tomas Valenta62682d638265
diff --git a/apps/web/src/app/(docs)/docs/commands/background/page.mdx b/apps/web/src/app/(docs)/docs/commands/background/page.mdxindex e971fc722..84357b254 100644--- a/apps/web/src/app/(docs)/docs/commands/background/page.mdx+++ b/apps/web/src/app/(docs)/docs/commands/background/page.mdx@@ -26,7 +26,15 @@ from e2b_code_interpreter import Sandboxsandbox = Sandbox()# Start the command in the background-command = sandbox.commands.run('echo hello; sleep 10; echo world', on_stdout=lambda data: print(data), background=True)+command = sandbox.commands.run('echo hello; sleep 10; echo world', background=True)++# Get stdout and stderr from the command running in the background.+# You can run this code in a separate thread or use command.wait() to wait for the command to finish.+for stdout, stderr, _ in command:+ if stdout:+ print(stdout)+ if stderr:+ print(stderr)# Kill the commandcommand.kill()