Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ public InMemoryMemoryService memoryService() {
@Bean
public SandboxService sandboxService() {
logger.info("Creating SandboxService bean");
BaseClientStarter clientConfig = DockerClientStarter.builder().build();
BaseClientStarter clientStarter = DockerClientStarter.builder().build();
ManagerConfig managerConfig = ManagerConfig.builder()
.clientConfig(clientConfig)
.clientStarter(clientStarter)
.build();
SandboxService sandboxService = new SandboxService(managerConfig);
sandboxService.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ public DashScopeChatModel chatModel() {
*/
@Bean
public SandboxService sandboxService() {
BaseClientStarter clientConfig = DockerClientStarter.builder().build();
BaseClientStarter clientStarter = DockerClientStarter.builder().build();
ManagerConfig managerConfig = ManagerConfig.builder()
.clientConfig(clientConfig)
.clientStarter(clientStarter)
.build();

SandboxService service = new SandboxService(managerConfig);
Expand All @@ -92,9 +92,13 @@ public Toolkit createToolkit(SandboxService sandboxService) {
try {
BrowserSandbox browserSandbox = new BrowserSandbox(sandboxService, "agent-user", "agent-session");
toolkit.registerTool(ToolkitInit.BrowserNavigateTool(browserSandbox));
// getInfo() triggers lazy initialization (container creation)
// getDesktopUrl() bypasses it, so we must initialize first
browserSandbox.getInfo();
String desktopUrl = browserSandbox.getDesktopUrl();
System.out.println("GUI Desktop URL: " + desktopUrl);
} catch (Exception ignored) {
} catch (Exception exception) {
exception.printStackTrace();
}
return toolkit;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,21 @@ public class SandboxStructuredExample {

public static void main(String[] args) throws Exception {

BaseClientStarter clientConfig = DockerClientStarter.builder().build();
BaseClientStarter clientStarter = DockerClientStarter.builder().build();
ManagerConfig managerConfig = ManagerConfig.builder()
.clientConfig(clientConfig)
.clientStarter(clientStarter)
.build();

SandboxService service = new SandboxService(managerConfig);
service.start();

Toolkit toolkit = new Toolkit();
try {
BrowserSandbox browserSandbox = new BrowserSandbox(service, "agent-user", "agent-sessopn");
BrowserSandbox browserSandbox = new BrowserSandbox(service, "agent-user", "agent-session");
toolkit.registerTool(ToolkitInit.BrowserNavigateTool(browserSandbox));
// getInfo() triggers lazy initialization (container creation)
// getDesktopUrl() bypasses it, so we must initialize first
browserSandbox.getInfo();
String desktopUrl = browserSandbox.getDesktopUrl();
System.out.println("GUI Desktop URL: " + desktopUrl);
} catch (Exception ignored) {
Expand Down
Loading