// This example shows the boundary between trusted host scope and model arguments. package main import ( "context" "encoding/json" "fmt" "os" "clusterflow.dev/cfbrowser" "clusterflow.dev/cfbrowser/agenttools" "clusterflow.dev/cfbrowser/api" "clusterflow.dev/cfbrowser/driver/cdp" ) func main() { if err := run(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } func run() error { m, err := cfbrowser.New(cfbrowser.Config{Executable: os.Getenv("CFBROWSER_EXECUTABLE")}, &cdp.Driver{}) if err != nil { return err } defer m.Close() service := agenttools.Service{Manager: m} owner := api.Owner{EnvironmentID: "local", ThreadID: "thread-1", RunID: "run-1"} // In a real host, apply the existing approval policy before calling the service. result, err := service.Call(context.Background(), owner, "cf_browser_session", json.RawMessage(`{"operation":"list"}`)) if err != nil { return err } return json.NewEncoder(os.Stdout).Encode(map[string]any{"tools": agenttools.Catalog(), "sessions": result}) }