Data plane
Files, processes, desktops, and service connections go directly to the node that runs the Workspace, without forwarding through ctrl. This page shows how to request a session credential from ctrl, keep it valid, and call the node with it.
Every data-plane call takes two steps:
- Request a short-lived session credentialA short-lived credential for the data plane. You request it from ctrl, together with the address of the node that runs the Workspace. from ctrl. The response also gives the address of the node.
- Send the request to that address with the credential.
Requesting a session credential
Call DataPlaneSessionService/CreateDataPlaneSession on ctrl for an AVAILABLE Workspace. Every field of the request and the response is listed in DataPlaneSessionService.
- Give a command ID in
metadata.command_id. Replaying the same ID returns the same credential. - Request only the scopes your calls need in
requested_scopes. The scope each method needs is in Data-plane services. - For
SERVICE_CONNECT, list the exact targets inservice_targets. - To keep the credential from reaching a newer execution, set
expected_generationto the generationOne run of a Workspace. Every successful start begins a new generation, numbered from 1 upward; the credentials, processes, and connections of the previous generation become invalid. you believe is current. A mismatch returnsFAILED_PRECONDITION.
When the request is refused with FAILED_PRECONDITION, observed_workspace in the error details carries the Workspace as it was. Use it to decide whether the execution has ended:
| Workspace | Meaning |
|---|---|
generation differs from expected_generation, or the state is STOPPED or DELETED | This execution has ended, along with its processes and connections |
The state is STOPPING, DELETING, FAILED, or UNKNOWN, or still AVAILABLE (for example expired but not yet stopped) | The execution may still be running. Ask again later |
Credential lifetime
lifetime selects one of two policies:
lifetime | How long the credential lasts | Constraints |
|---|---|---|
| Default | requested_ttl. The default is 5 minutes and the limit is 15 minutes. 0 means the default. Other values must be whole seconds from 1 second up to the limit; a longer value returns invalid_argument | None |
EXECUTION | Bound to the current execution of the Workspace: at most 1 hour, ending at the Workspace's expiration time if that comes first | Requires expected_generation. requested_ttl is not allowed. Capability name workspace.session.execution |
Response
The response carries the credential in credential, and in session the address of the node data plane (endpoint), the granted scopes and targets, and the expiration time expires_at. session.generation is the Workspace's generation when the credential was issued: the same value means the same execution, even if endpoint changed. Use session.endpoint as the base URL of every data-plane request.
Warning
Treat credential as a secret. Do not parse it, log it, or put it in a URL. Log session.session_id when you need to correlate requests.
Caching and renewing the credential
When you cache a credential and reuse it across requests:
- Request a new one once about 80% of the lifetime has passed, minus up to 10% random jitter. Do not wait until only a few seconds remain. The node allows 30 seconds of clock skew, so with a small fixed margin, the node can reject the credential while you still believe it is valid.
- When the node returns the reason
SESSION_EXPIRED,SESSION_REVOKED, orUNAUTHENTICATED, discard the cached credential and request a new one for the next request. Do not retry with the same credential. - Do not go by the error code alone. A guest refusing file access and a credential missing a scope also return
permission_denied. Their reason isPERMISSION_DENIED, and a new credential does not help.
Interactive sessions
Interactive sessions outlive a single credential. The output stream is authenticated only once, when it is established. Each keystroke's SendInput and each Resize and SendSignal is a new RPC that is authenticated again.
Callers like this request a new credential with a new command_id before expires_at and switch to it. They do not need to reopen the output stream. This is what kibo workspace terminal does.
Calling the node
Send requests to session.endpoint with an Authorization: Bearer <credential> header. Only one such header is allowed.
The node data plane uses different TLS settings from ctrl:
- Trust the system root certificates plus
server-ca.pemfrom the identity, and verify the host name by the standard rules. - Do not follow HTTP redirects.
- Streaming methods need HTTP/2.
For both endpoints side by side, see TLS settings.
Data-plane services
Each method needs the scope listed next to it:
| Service | Methods | Required scope |
|---|---|---|
FilesystemService | Stat, ListDir, WatchDir (server stream) | FILE_READ |
FilesystemService | MakeDir, Move, Remove | FILE_WRITE |
ProcessService | Start (server stream), Attach (server stream), SendInput, CloseStdin, SendSignal, Resize | PROCESS |
DesktopService | Screenshot, PerformActions | DESKTOP |
ServiceConnectionService | Connect (bidirectional stream) | SERVICE_CONNECT |
HTTP /v1/files | GET | FILE_READ |
HTTP /v1/files | PUT | FILE_WRITE |
WebSocket /v1/service | GET | SERVICE_CONNECT |
For how to use each service, see Commands and terminals, Files, Services and ports, and Desktop.
Stream interruptions
An expired credential affects only new RPCs. Established streams keep running.
The following events end streams in progress:
- The credential is revoked.
- The Workspace restarts into a new generation.
- Someone calls
WorkspaceService/RevokeWorkspaceDataPlane. - The node switches to a new data-plane process, for example after a node upgrade. HTTP/2 connections to the old process first receive GOAWAY and then close, and streams in progress end with them.
Some client libraries report the close after GOAWAY as a protocol error. For example, the Go Connect client reports invalid_argument: protocol error: incomplete envelope. Treat it as a connection interruption as well: resume process streams and restart directory watches.
Next steps
- Authentication: the Operator identity for ctrl and the TLS settings for the node.
- Write operations and errors: command IDs and the error format.
- Go SDK: issues, caches, and renews data-plane credentials for you.
Write operations and errors
Every program that changes state through the API follows the same rules: query the server's capabilities first, carry a command ID and an expected revision on write requests, and read errors in one format. This page describes each rule and the fields that carry it.
Go SDK
The Go SDK lets Go programs call Kibotos. This page covers installing it, connecting to ctrl with an Operator identity, the conventions it carries for write operations, and reaching the files, processes and services of a Workspace.