Table of Contents

Raw gRPC access

The curated client calls every user-facing RPC of the OpenShell service. For anything it does not expose, such as a field it does not surface, the generated gRPC clients are one property away:

Property Generated client
OpenShellClient.Raw Openshell.V1.OpenShell.OpenShellClient, the OpenShell service
OpenShellClient.RawSandboxUpdates Openshell.V1.SandboxUpdates.SandboxUpdatesClient, the separate SandboxUpdates service

Both share the connection, authentication, retries, and telemetry of the curated client. They are on the concrete OpenShellClient, not on the IOpenShellClient interface, so the fake does not offer them.

// The generated client shares the connection, authentication, retries and telemetry of `client`.
// It takes and returns protobuf wire types, and its errors are RpcException, not OpenShellException.
try
{
    var response = await client.Raw.GetSandboxAsync(new Wire.GetSandboxRequest
    {
        Name = "agent-1",
        WorkspaceScope = new WorkspaceSelector { Workspace = client.Workspace },   // not filled in for you
    });
    Console.WriteLine(response.Sandbox);
}
catch (RpcException e) when (e.StatusCode == StatusCode.NotFound)
{
    Console.WriteLine("no such sandbox");
}

Raw calls use the protobuf wire types (in the Openshell.V1, Openshell.Sandbox.V1, and Openshell.Datamodel.V1 namespaces) and do not map errors to OpenShellException: they throw the gRPC RpcException. Requests also do not get the client's workspace: set their WorkspaceScope yourself, as above.

Adjust a curated request

SandboxSpec.RawSpec changes the wire SandboxSpec after the SDK has mapped the curated fields, for fields that SandboxSpec does not surface:

// Adjust the assembled wire spec for a field the curated SandboxSpec does not surface: here, a GPU request.
var spec = new SandboxSpec
{
    Image = "registry.example.com/team/cuda-agent:1.0",
    RawSpec = wire => wire.ResourceRequirements = new Wire.ResourceRequirements
    {
        Gpu = new Wire.GpuResourceRequirements { Count = 1 },
    },
};

The generated types are listed in the API reference with the rest of the package.