Pods

Pods are isolated compute environments where cPod skills and workflows execute. Each pod runs inside its own container with dedicated CPU, memory, and an OCI-compatible image. Pods can be started, stopped, and restarted independently, making them the fundamental unit of compute scheduling in cPod.


Pod Schema

FieldTypeRequiredDescription
idstringautoUUID
namestringyesHuman-readable name (e.g. "api-server-primary")
statusenumautopending | provisioning | running | stopping | stopped | failed
spec.imagestringyesOCI image reference (e.g. "docker.io/acme/api:v3.2.1")
spec.cpustringnoCPU request in millicores (e.g. "1000m")
spec.memorystringnoMemory request (e.g. "2Gi")
spec.replicasnumbernoNumber of replicas — defaults to 1
spec.envobjectnoEnvironment variables as key/value pairs
labelsobjectnoArbitrary key/value labels for filtering
organizationIdstringyesOrganization this pod belongs to
workspaceIdstringyesWorkspace this pod belongs to
createdAtstringautoISO 8601 UTC
updatedAtstringautoISO 8601 UTC

List Pods

import { CpodClient } from '@cpod/sdk'
const sdk = CpodClient.fromEnv()
 
const result = await sdk.pods.list({
  workspaceId: 'c3d4e5f6-...',
  status: 'running',
  limit: 20,
})
 
for (const pod of result.data) {
  console.log(pod.id, pod.name, pod.status, pod.spec.image)
}

Get Pod Status

const pod = await sdk.pods.get('pod-uuid')
console.log(pod.status) // → "running" | "stopped" | "failed" …

Create a Pod

Newly created pods start in pending status and transition to provisioning then running automatically once compute is allocated.

const pod = await sdk.pods.create({
  workspaceId: 'c3d4e5f6-...',
  name: 'api-server-primary',
  spec: {
    image: 'docker.io/acme/api:v3.2.1',
    cpu: '1000m',
    memory: '2Gi',
    replicas: 3,
    env: {
      NODE_ENV: 'production',
      LOG_LEVEL: 'info',
    },
  },
  labels: {
    team: 'platform',
    tier: 'api',
  },
})
 
console.log(pod.id, pod.status) // → "pending"

Start and Stop a Pod

// Start a stopped pod
const started = await sdk.pods.start('pod-uuid')
console.log(started.status) // → "provisioning"
 
// Gracefully stop a running pod (resources are retained)
const stopped = await sdk.pods.stop('pod-uuid')
console.log(stopped.status) // → "stopping"

Delete a Pod

⚠️

A pod must be in stopped or failed status before it can be deleted. Stop the pod first if it is running, then delete it to release compute resources permanently.

// Stop first, then delete
await sdk.pods.stop('pod-uuid')
 
// Poll until stopped (or use events to watch status)
let pod = await sdk.pods.get('pod-uuid')
while (pod.status === 'stopping') {
  await new Promise(r => setTimeout(r, 2000))
  pod = await sdk.pods.get('pod-uuid')
}
 
await sdk.pods.delete('pod-uuid')