Kibotos

Agent platform integration

This page shows how to connect an Agent platform to Kibotos: where the Operator identity lives, how Agent sessions map to Workspaces and Volumes, and how the platform handles failures. The code uses the Go SDK. Programs in other languages make the same calls through the native API.

Overview

Your platform backend sits between the Agent and Kibotos. It manages Workspaces through ctrl and reaches the node that runs each Workspace with a short-lived credential:

flowchart LR
  Agent[Agent runtime] -->|tool calls| Backend[Platform backend]
  Backend -->|mTLS with the Operator identity| Ctrl[ctrl]
  Backend -->|session credential| Node[node data plane]
  Node --> Workspace[Workspace]

A typical session runs in this order:

  1. Find or create the project's Volume.
  2. Create a Workspace bound to that Volume, with an expiration time.
  3. Run the Agent's tool calls through a data-plane session.
  4. Delete the Workspace when the session ends. The Volume stays for the next session.

Coding Agent with a persistent project is a complete program that follows these steps.

Identity and access

Warning

An Operator has cluster administration rights and can operate every Workspace in the deployment. Keep the identity in your backend. Never copy it into a Workspace or pass it to an Agent.

  • Your platform authorizes its own users. Kibotos has no tenants. Every Operator sees every Workspace, so your backend decides which user may reach which Workspace.
  • Labels are not access control. Use them to find resources. See Labels and annotations.
  • Each backend instance needs its own identity directory. ctrl accepts only the current and the previous certificate of an identity, so two programs renewing one identity lock each other out. Create one enrollment key per instance with kibo enrollment create --operator. See Connect to ctrl.

Agent access to a Workspace

Choose how the Agent's tool calls reach the Workspace:

ApproachHow it worksUse it when
Backend runs the toolsThe backend holds a dataplane.Session and runs each tool call. The Agent receives no credentialBy default. The backend can check, log, and limit every call
Backend hands out a credentialThe backend requests a session credential and gives it to an Agent runtime outside the Workspace, which then calls the node directlyThe Agent runtime needs a direct connection, for example for long output streams

To hand out a credential, request only the scopes the Agent needs and a short lifetime:

response, err := client.DataPlaneSessions().CreateDataPlaneSession(ctx, connect.NewRequest(&ctrlv1.CreateDataPlaneSessionRequest{
	Metadata:        &ctrlv1.CommandMetadata{CommandId: kibotos.NewCommandID("platform")},
	WorkspaceId:     workspaceID,
	RequestedScopes: []ctrlv1.DataPlaneScope{ctrlv1.DataPlaneScope_DATA_PLANE_SCOPE_PROCESS},
	RequestedTtl:    durationpb.New(5 * time.Minute),
}))
if err != nil {
	log.Fatal(err)
}
endpoint := response.Msg.GetSession().GetEndpoint()
credential := response.Msg.GetCredential()
  • A credential is valid for one Workspace and the scopes it names. It cannot create, stop, or delete a Workspace.
  • It lasts 5 minutes by default and 15 minutes at most. Your backend issues the next one.
  • The Agent runtime must reach the node address and trust server-ca.pem from the identity. See Calling the node.
  • Treat the credential as a secret. To cut off all access to a Workspace at once, call RevokeWorkspaceDataPlane.

Mapping sessions to Kibotos objects

On your platformIn KibotosNotes
Project or user directoryVolumeLives until you delete it. Bind it when you create a Workspace
Agent sessionWorkspaceBound to the project's Volume. Deleting it keeps a Volume bound this way
Session or request IDCommand IDkibotos.DeriveCommandID builds it from your ID, so a restarted backend replays the same command instead of creating a second Workspace
Owner, project, or batchLabelFind resources with label_selector after a restart
Longest allowed sessionExpirationctrl stops or deletes the Workspace even if your backend never comes back

A Volume is bound to one Workspace at a time. Before you bind it to a new Workspace, delete the old Workspace and wait for the delete command with Client.WaitWorkspaceDeleted.

Idle sessions

Kibotos cannot save memory state, so choose by what the session needs when it continues:

Between turnsCPU and memoryWhat survivesContinue with
Keep it runningHeldEverything, including processesThe same data-plane session
StopReleasedThe Volume, and the writable layer on a best-effort basisStartWorkspace, then open a new data-plane session and restart processes
DeleteReleasedOnly a Volume bound as aboveA new Workspace

Files the Agent must keep belong on the Volume. See Guarantees and limits.

Failure handling

What you seeMeaningWhat to do
A write returns no answer or times outThe result is unknownSend it again with the same command ID. kibotos.Settle does this. A failure with command_settled is final, so a new attempt takes a new ID. See Write operations and errors
Create or start fails with resource_exhaustedNo node has roomQueue the work and retry. The Workspace stays and can be started later or deleted
The Workspace is UNKNOWNA node is temporarily unreachableWait, or resend the original command ID. Do not create a replacement yet: the original may still be running
The Workspace is FAILEDThe execution failedForce stop, then start. See Recovering from FAILED
The Workspace is AVAILABLE, but the guest does not respondThe guest is stuckSee Responsiveness of the guest
A process stream breaksThe connection to the node droppeddataplane.Session resumes it. A Gap event reports output that could not be recovered
An operation fails because a capability is missingThe server is older than the featureCall Client.Require before the operation and fail only that feature. See Querying capabilities first

Network access

A new Workspace has no network access, and that is the right start for most Agents.

  • Open public internet access when the task needs it, and narrow it with destination rules. See Network policy.
  • To send traffic through your own proxy or use a fixed outbound address, use an Egress. It requires v0.3.0 or later.
  • To show a service in the Workspace to a user, create a public URL, and revoke it when you are done. Anyone with the address can use it.

Next steps

On this page