diff --git a/sandbox-core/src/main/java/io/agentscope/runtime/sandbox/manager/SandboxService.java b/sandbox-core/src/main/java/io/agentscope/runtime/sandbox/manager/SandboxService.java index 7ef3dec..bf49426 100644 --- a/sandbox-core/src/main/java/io/agentscope/runtime/sandbox/manager/SandboxService.java +++ b/sandbox-core/src/main/java/io/agentscope/runtime/sandbox/manager/SandboxService.java @@ -150,7 +150,7 @@ public ContainerModel createContainer(Sandbox sandbox) throws JsonProcessingExce if (this.remoteHttpClient != null) { logger.info("Creating container in remote mode via RemoteHttpClient"); ObjectMapper mapper = new ObjectMapper(); - String sandboxJson = mapper.writeValueAsString(sandbox); + String sandboxJson = mapper.writeValueAsString(Map.of("sandboxId", sandbox.getSandboxId())); Map request = Map.of("sandbox", sandboxJson); Object result = remoteHttpClient.makeRequest( RequestMethod.POST, @@ -536,7 +536,7 @@ public ContainerModel getInfo(Sandbox sandbox) throws JsonProcessingException { if (this.remoteHttpClient != null) { logger.info("Getting sandbox info in remote mode via RemoteHttpClient"); ObjectMapper mapper = new ObjectMapper(); - String sandboxJson = mapper.writeValueAsString(sandbox); + String sandboxJson = mapper.writeValueAsString(Map.of("sandboxId", sandbox.getSandboxId())); Map request = Map.of("sandbox", sandboxJson); Object result = remoteHttpClient.makeRequest( RequestMethod.POST, @@ -599,7 +599,7 @@ public Map listTools(Sandbox sandbox, String toolType) throws Js if (this.remoteHttpClient != null) { logger.info("Listing tools in remote mode via RemoteHttpClient"); ObjectMapper mapper = new ObjectMapper(); - String sandboxJson = mapper.writeValueAsString(sandbox); + String sandboxJson = mapper.writeValueAsString(Map.of("sandboxId", sandbox.getSandboxId())); Map request = Map.of( "sandbox", sandboxJson, "toolType", toolType @@ -630,7 +630,7 @@ public String callTool(Sandbox sandbox, String toolName, Map arg if (this.remoteHttpClient != null) { logger.info("Calling tool in remote mode via RemoteHttpClient"); ObjectMapper mapper = new ObjectMapper(); - String sandboxJson = mapper.writeValueAsString(sandbox); + String sandboxJson = mapper.writeValueAsString(Map.of("sandboxId", sandbox.getSandboxId())); Map request = Map.of( "sandbox", sandboxJson, "toolName", toolName, @@ -660,7 +660,7 @@ public Map addMcpServers(Sandbox sandbox, Map se if (this.remoteHttpClient != null) { logger.info("Adding MCP servers in remote mode via RemoteHttpClient"); ObjectMapper mapper = new ObjectMapper(); - String sandboxJson = mapper.writeValueAsString(sandbox); + String sandboxJson = mapper.writeValueAsString(Map.of("sandboxId", sandbox.getSandboxId())); Map request = Map.of( "sandbox", sandboxJson, "serverConfigs", serverConfigs,