feat(clients): sandbox: Agent Sandbox lifecycle, code/shell/computer-use execution, templates, snapshots

Typed results with hard caps, one call table checked against Discovery
(tools/check_discovery.py), live read-only probe, /agent/sandbox demo.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 04:36:39 +02:00
co-authored by Claude Sonnet 5.5
parent 6d744a433f
commit af6ee63211
35 changed files with 3659 additions and 3 deletions
+40
View File
@@ -0,0 +1,40 @@
#pragma once
// Bash commands in a shell sandbox ("Workspaces" in the product overview:
// commands and files isolated from core systems). Each command runs in a new
// shell as an unprivileged user; cd and variables do not carry over.
#include <string>
#include "google/sandbox/caps.h"
#include "google/sandbox/sandbox_service.h"
namespace molo::google::sandbox {
struct ShellRequest {
std::string command;
std::string cwd; // Empty: the sandbox default (/workspace).
int timeout_seconds = SandboxCaps::kDefaultShellTimeoutSeconds;
};
class ShellRunner : public SandboxService {
public:
explicit ShellRunner(std::shared_ptr<GoogleClient> client);
ExecutionResult run(const std::string& sandbox_name,
const ShellRequest& request) const;
// Same call with a higher command ceiling, for WorkspaceFiles only (it
// ships file bytes inside the command line). Never exposed to routes.
ExecutionResult run_internal(const std::string& sandbox_name,
const ShellRequest& request) const;
static void validate(const ShellRequest& request, std::size_t max_command);
private:
ExecutionResult run_capped(const std::string& sandbox_name,
const ShellRequest& request,
std::size_t max_command) const;
};
} // namespace molo::google::sandbox