### Start usage example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/daytona.mdx Example of starting the language server and deferring its stop. ```go if err := lsp.Start(ctx); err != nil { return err } defer lsp.Stop(ctx) ``` -------------------------------- ### Start method and example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/daytona.mdx Starts the desktop environment. Must be called before using mouse, keyboard, or screenshot operations. The example shows starting and deferring stop. ```go func (c *ComputerUseService) Start(ctx context.Context) error ``` ```go if err := cu.Start(ctx); err != nil { return err } defer cu.Stop(ctx) ``` -------------------------------- ### AsyncLspServer.start example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/python-sdk/async/async-lsp-server.mdx Example of creating and starting an LSP server. ```python lsp = sandbox.create_lsp_server("typescript", "workspace/project") await lsp.start() # Initialize the server # Now ready for LSP operations ``` -------------------------------- ### RecordingService.Start example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/daytona.mdx Example usage of the Start method. Starts a recording with a custom label and prints the recording ID and file path. ```go // Start a recording with a label recording, err := cu.Recording().Start(ctx, stringPtr("my-test-recording")) if err != nil { return err } fmt.Printf("Recording started: %s\n", recording.GetId()) fmt.Printf("File: %s\n", recording.GetFilePath()) ``` -------------------------------- ### Start LSP server example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/typescript-sdk/lsp-server.mdx Example of creating and starting an LSP server using the sandbox.createLspServer method. ```ts const lsp = await sandbox.createLspServer('typescript', 'workspace/project'); await lsp.start(); // Initialize the server // Now ready for LSP operations ``` -------------------------------- ### PipInstall usage examples Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/daytona.mdx Examples of using PipInstall for basic installation and with functional options. ```go // Basic installation image := daytona.Base("python:3.11").PipInstall([]string{"numpy", "pandas"}) // With options image := daytona.Base("python:3.11").PipInstall( []string{"torch"}, options.WithIndexURL("https://download.pytorch.org/whl/cpu"), options.WithExtraOptions("--no-cache-dir"), ) ``` -------------------------------- ### Start example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/daytona.mdx Starts the sandbox with a default timeout of 60 seconds. If already running, it is a no-op. ```go err := sandbox.Start(ctx) if err != nil { return err } // Sandbox is now running ``` -------------------------------- ### start() example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/typescript-sdk/computer-use.mdx Starts all computer use processes (Xvfb, xfce4, x11vnc, novnc). ```typescript const result = await sandbox.computerUse.start(); console.log('Computer use processes started:', result.message); ``` -------------------------------- ### Start LSP server example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/python-sdk/sync/lsp-server.mdx Example of creating and starting an LSP server for a TypeScript project. After start() is called, the server is ready for LSP operations. ```python lsp = sandbox.create_lsp_server("typescript", "workspace/project") lsp.start() # Initialize the server # Now ready for LSP operations ``` -------------------------------- ### Example: WithFindLinks Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/options.mdx Example usage of WithFindLinks to specify find-links URLs for package installation. ```go image := daytona.Base("python:3.11").PipInstall( []string{"mypackage"}, options.WithFindLinks("/path/to/wheels", "https://example.com/wheels/"), ) ``` -------------------------------- ### LspServerService usage example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/daytona.mdx Shows how to create an LSP server for Python, start it, open a file, and get code completions. The example uses types.LspLanguagePython and types.Position. ```go // Create an LSP server for Python lsp := sandbox.CreateLspServer(types.LspLanguagePython, "/home/user/project") // Start the language server if err := lsp.Start(ctx); err != nil { return err } defer lsp.Stop(ctx) // Open a file for analysis if err := lsp.DidOpen(ctx, "/home/user/project/main.py"); err != nil { return err } // Get code completions completions, err := lsp.Completions(ctx, "/home/user/project/main.py", types.Position{Line: 10, Character: 5}) ``` -------------------------------- ### start() example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/typescript-sdk/computer-use.mdx Starts a recording with a label and logs the recording ID and file path. ```typescript // Start a recording with a label const recording = await sandbox.computerUse.recording.start('my-test-recording'); console.log(`Recording started: ${recording.id}`); console.log(`File: ${recording.filePath}`); ``` -------------------------------- ### Get entrypoint session and list commands example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/python-sdk/async/async-process.mdx Example showing how to retrieve the entrypoint session and iterate over its commands. ```python session = await sandbox.process.get_entrypoint_session() for cmd in session.commands: print(f"Command: {cmd.command}") ``` -------------------------------- ### AptGet usage example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/daytona.mdx Example of using AptGet to install system packages on an Ubuntu base image. ```go image := daytona.Base("ubuntu:22.04").AptGet([]string{"git", "curl", "build-essential"}) ``` -------------------------------- ### AsyncComputerUse.start example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/python-sdk/async/async-computer-use.mdx Example of starting computer use processes and printing the result message. ```python result = await sandbox.computer_use.start() print("Computer use processes started:", result.message) ``` -------------------------------- ### ComputerUse.start example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/python-sdk/sync/computer-use.mdx Starts computer use processes and prints the result message. ```python result = sandbox.computer_use.start() print("Computer use processes started:", result.message) ``` -------------------------------- ### start() - Start a Sandbox Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/typescript-sdk/daytona.mdx Starts a Sandbox and waits for it to be ready. The timeout parameter is optional; 0 means no timeout. The example starts a sandbox with a 60-second timeout. ```ts start(sandbox: Sandbox, timeout?: number): Promise; ``` ```ts const sandbox = await daytona.get('my-sandbox-id'); // Wait up to 60 seconds for the sandbox to start await daytona.start(sandbox, 60); ``` -------------------------------- ### Get session and list commands example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/python-sdk/async/async-process.mdx Example showing how to retrieve a session and iterate over its commands. ```python session = await sandbox.process.get_session("my-session") for cmd in session.commands: print(f"Command: {cmd.command}") ``` -------------------------------- ### create_session() example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/ruby-sdk/process.mdx Example of creating a session, getting it, and deleting it. ```ruby # Create a new session session_id = "my-session" sandbox.process.create_session(session_id) session = sandbox.process.get_session(session_id) # Do work... sandbox.process.delete_session(session_id) ``` -------------------------------- ### Image.pipInstall() example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/typescript-sdk/image.mdx Example usage of pipInstall() to install 'numpy' with the findLinks option pointing to the PyPI simple index. ```ts const image = Image.debianSlim('3.12').pipInstall('numpy', { findLinks: ['https://pypi.org/simple'] }) ``` -------------------------------- ### Install with setuptools Source: https://github.com/daytona/clients/blob/main/toolbox-api-client-python/README.md Install the package using setuptools for the current user. Use sudo to install for all users. ```sh python setup.py install --user ``` -------------------------------- ### VolumeService.Create example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/daytona.mdx Example of creating a volume and waiting for it to be ready. ```go volume, err := client.Volume.Create(ctx, "my-data-volume") if err != nil { return err } // Wait for volume to be ready volume, err = client.Volume.WaitForReady(ctx, volume, 60*time.Second) ``` -------------------------------- ### Run SDK examples Source: https://github.com/daytona/clients/blob/main/sdk-go/README.md Sets the API key and runs several example programs from the examples directory. ```bash export DAYTONA_API_KEY=your-api-key go run examples/sandbox/main.go go run examples/code_interpreter/main.go go run examples/fromimage/main.go go run examples/snapshots/withlogstreaming/snapshot_with_logs.go ``` -------------------------------- ### Image.pip_install_from_requirements example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/python-sdk/common/image.mdx Example usage of pip_install_from_requirements to install dependencies from a requirements.txt file. ```python image = Image.debian_slim("3.12").pip_install_from_requirements("requirements.txt") ``` -------------------------------- ### AsyncProcess.exec example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/python-sdk/async/async-process.mdx Shows how to execute simple commands, set a working directory, set a timeout, and start a background server using the exec method. ```python # Simple command response = await sandbox.process.exec("echo 'Hello'") print(response.artifacts.stdout) # Prints: Hello # Command with working directory result = await sandbox.process.exec("ls", cwd="workspace/src") # Command with timeout result = await sandbox.process.exec("sleep 10", timeout=5) # Start a server in the background await sandbox.process.exec("python3 -m http.server 8000 > server.log 2>&1 &") ``` -------------------------------- ### exec() examples Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/ruby-sdk/process.mdx Examples of using the exec method: simple command, with working directory, with timeout, and starting a background server. ```ruby # Simple command response = sandbox.process.exec(command: "echo 'Hello'") puts response.artifacts.stdout => "Hello\n" # Command with working directory result = sandbox.process.exec(command: "ls", cwd: "workspace/src") # Command with timeout result = sandbox.process.exec(command: "sleep 10", timeout: 5) # Start a server in the background sandbox.process.exec(command: "python3 -m http.server 8000 > server.log 2>&1 &") ``` -------------------------------- ### Sandbox.WaitForStart signature and example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/daytona.mdx Waits for the sandbox to reach the "started" state. Polls until started, error state, or timeout. 0 means no timeout. ```go func (s *Sandbox) WaitForStart(ctx context.Context, timeout time.Duration) error ``` ```go err := sandbox.WaitForStart(ctx, 2*time.Minute) if err != nil { return err } // Sandbox is now running ``` -------------------------------- ### Example: WithExtraIndexURLs Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/options.mdx Example usage of WithExtraIndexURLs to install a package with an additional private index URL. ```go image := daytona.Base("python:3.11").PipInstall( []string{"mypackage"}, options.WithExtraIndexURLs("https://private.example.com/simple/"), ) ``` -------------------------------- ### start() example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/typescript-sdk/sandbox.mdx Starts the Sandbox and waits for it to be ready. Optional timeout in seconds (default 60, 0 means no timeout). Throws DaytonaError if start fails or times out. ```TypeScript const sandbox = await daytona.getCurrentSandbox('my-sandbox'); await sandbox.start(40); // Wait up to 40 seconds console.log('Sandbox started successfully'); ``` -------------------------------- ### Create snapshot example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/ruby-sdk/snapshot.mdx Example usage of the create method, creating a snapshot from a Debian slim image with numpy installed. ```ruby image = Image.debianSlim('3.12').pipInstall('numpy') params = CreateSnapshotParams.new(name: 'my-snapshot', image: image) snapshot = daytona.snapshot.create(params) do |chunk| print chunk end ``` -------------------------------- ### VolumeService.get example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/python-sdk/sync/volume.mdx Example of getting a volume by name, creating it if it doesn't exist, and printing its details. ```python daytona = Daytona() volume = daytona.volume.get("test-volume-name", create=True) print(f"{volume.name} ({volume.id})") ``` -------------------------------- ### WithPre usage example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/options.mdx Example usage of WithPre to install a package with pre-release versions allowed. ```go image := daytona.Base("python:3.11").PipInstall( []string{"mypackage"}, options.WithPre(), ) ``` -------------------------------- ### GetMetrics usage example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/daytona.mdx Example of calling GetMetrics with nil start and end times to get all samples. ```go samples, err := sandbox.GetMetrics(ctx, nil, nil) if err != nil { return err } for _, m := range samples { fmt.Printf("%s CPU: %.1f%%\n", m.Timestamp.Format(time.RFC3339), m.CPUUsedPct) } ``` -------------------------------- ### StartWithTimeout example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/daytona.mdx Starts the sandbox with a custom timeout. Blocks until the sandbox reaches the 'started' state or the timeout is exceeded. 0 means no timeout. ```go err := sandbox.StartWithTimeout(ctx, 2*time.Minute) if err != nil { return err } ``` -------------------------------- ### Getting started with ComputerUseApi click Source: https://github.com/daytona/clients/blob/main/toolbox-api-client-python/README.md Example showing how to configure the client, create an API instance, and call the click method. The host defaults to http://localhost:22221. ```python import daytona_toolbox_api_client from daytona_toolbox_api_client.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to http://localhost:22221 # See configuration.py for a list of all supported configuration parameters. configuration = daytona_toolbox_api_client.Configuration( host = "http://localhost:22221" ) # Enter a context with an instance of the API client with daytona_toolbox_api_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = daytona_toolbox_api_client.ComputerUseApi(api_client) request = daytona_toolbox_api_client.MouseClickRequest() # MouseClickRequest | Mouse click request try: # Click mouse button api_response = api_instance.click(request) print("The response of ComputerUseApi->click:\n") pprint(api_response) except ApiException as e: print("Exception when calling ComputerUseApi->click: %s\n" % e) ``` -------------------------------- ### RecordingService.Get example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/go-sdk/daytona.mdx Example usage of the Get method. Retrieves recording details and prints file name, status, and duration. ```go recording, err := cu.Recording().Get(ctx, recordingID) if err != nil { return err } fmt.Printf("Recording: %s\n", recording.GetFileName()) fmt.Printf("Status: %s\n", recording.GetStatus()) fmt.Printf("Duration: %v seconds\n", recording.GetDurationSeconds()) ``` -------------------------------- ### Get document symbols example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/typescript-sdk/lsp-server.mdx Example of using the documentSymbols() method to get all symbols in a file. ```ts // Get all symbols in a file const symbols = await lsp.documentSymbols('workspace/project/src/index.ts'); symbols.forEach(symbol => { console.log(`${symbol.kind} ${symbol.name}: ${symbol.location}`); }); ``` -------------------------------- ### Image.pip_install_from_pyproject example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/python-sdk/common/image.mdx Example usage of pip_install_from_pyproject to install dependencies from a pyproject.toml file, including optional dependencies. ```python image = Image.debian_slim("3.12") .pip_install_from_pyproject("pyproject.toml", optional_dependencies=["dev"]) ``` -------------------------------- ### Image.pip_install example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/python-sdk/common/image.mdx Example usage of pip_install to install 'requests' and 'pandas' on a Debian slim image with Python 3.12. ```python image = Image.debian_slim("3.12").pip_install("requests", "pandas") ``` -------------------------------- ### start() Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/ruby-sdk/lsp-server.mdx Starts the language server. ```APIDOC ## start() ### Description Starts the language server. This method must be called before using any other LSP functionality. It initializes the language server for the specified language and project. ### Method start ### Returns - `void` ``` -------------------------------- ### Run specific example scripts Source: https://github.com/daytona/clients/blob/main/examples/ruby/README.md Concrete examples of running the exec-command, lifecycle, and file-operations examples. ```bash ruby examples/ruby/exec-command/exec_session.rb ruby examples/ruby/lifecycle/lifecycle.rb ruby examples/ruby/file-operations/main.rb ``` -------------------------------- ### executeCommand() usage examples Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/typescript-sdk/process.mdx Four examples showing simple command execution, working directory, timeout, and background server start. ```ts // Simple command const response = await process.executeCommand('echo "Hello"'); console.log(response.artifacts.stdout); // Prints: Hello ``` ```ts // Command with working directory const result = await process.executeCommand('ls', 'workspace/src'); ``` ```ts // Command with timeout const result = await process.executeCommand('sleep 10', undefined, 5); ``` ```ts // Start a server in the background await process.executeCommand('python3 -m http.server 8000 > server.log 2>&1 &'); ``` -------------------------------- ### Get snapshot example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/ruby-sdk/snapshot.mdx Example usage of the get method, printing snapshot name and image name. ```ruby daytona = Daytona::Daytona.new snapshot = daytona.snapshot.get("demo") puts "#{snapshot.name} (#{snapshot.image_name})" ``` -------------------------------- ### start() method signature Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/ruby-sdk/sandbox.mdx Signature for the start method. Starts the Sandbox and waits for it to be ready. ```ruby def start(timeout = DEFAULT_TIMEOUT) ``` -------------------------------- ### Get completions example Source: https://github.com/daytona/clients/blob/main/artifacts/sdk-docs/typescript-sdk/lsp-server.mdx Example of using the completions() method to get completion suggestions at a specific position in a file. ```ts // Get completions at a specific position const completions = await lsp.completions('workspace/project/src/index.ts', { line: 10, character: 15 }); completions.items.forEach(item => { console.log(`${item.label} (${item.kind}): ${item.detail}`); }); ``` -------------------------------- ### Run an example script Source: https://github.com/daytona/clients/blob/main/examples/ruby/README.md Use the ruby command to run any example script. The SDK and client libraries are loaded from source files at the repo root, so changes are reflected immediately. ```bash ruby examples/ruby//