This guide covers local setup, the example demo, sandbox profiles, and workspace layouts.
Install Docker, Kind, kubectl, curl, and Go first.
make build
export PATH="$PWD/bin:$PATH"make kind-up
export CS_STORAGE_CLASS=local-path
contextctl sc listcontextctl ctx create demo
contextctl ctx listA new context may show provisioning until a workload mounts it.
contextctl sb create demo-pool
contextctl sb wait demo-pool
contextctl sb listcontextctl status
# Refresh continuously
watch contextctl statuscontextctl sb delete demo-pool
contextctl ctx delete demo
make kind-downContext Service runs at http://127.0.0.1:8080. Run make kind-smoke to test both lifecycles
automatically.
Create several ready-to-explore examples and display them together:
make kind-demo
export PATH="$PWD/bin:$PATH"
contextctl statusThe demo includes:
demo-workspace,demo-memory, anddemo-artifactscontexts mounted by a sample agentdemo-dedicated, with two profiled sandboxes and a workspace for eachdemo-shared, with two profiled sandboxes attached to one shared workspacedemo-readonly, with two profiled sandboxes mounting prepared context read-only
The shared example uses a demo-only host-path RWX volume because Kind's default local-path
provisioner supports only RWO. Production environments should use an RWX-capable CSI driver.
make kind-demo-clean
make kind-downkubectl apply -f deploy/context-service.yaml
kubectl -n serverless-harness rollout status deployment/context-serviceBefore production, update the namespace, Context Service image, and CS_SANDBOX_IMAGE in
deploy/context-service.yaml.
If OpenShift restricted-v2 rejects UID 65532, remove runAsUser and runAsGroup from the
Deployment so OpenShift can assign them.
The resource aliases ctx, sb, and sc are available for interactive use. For example,
contextctl sb list is equivalent to contextctl sandbox-pool list.
Copy and edit the example configuration, then load it into your shell:
cp .env.example .env
# Edit .env and replace the token placeholder.
set -a
source .env
set +aThe local .env contains credentials and is ignored by Git. .env.example is safe to commit.
A sandbox profile is a platform-managed SandboxTemplate that defines how sandbox Pods run:
their image, command, environment, resources, and security settings. Context Service adds the
requested workspace at /workspace.
kubectl apply -f deploy/examples/sandbox-profile.yaml
contextctl sb create developer --sandbox-profile shellOmit --sandbox-profile to use the built-in runtime configured by CS_SANDBOX_IMAGE. Profiles
must leave persistent storage and the workspace volume name to Context Service. A WarmPool
already selects its own SandboxTemplate, so --sandbox-profile and --warm-pool cannot be
combined. Profiles require the optional agent-sandbox extensions API; make kind-demo installs
it automatically.
Each sandbox receives its own RWO PVC:
flowchart LR
CS["Context Service"] --> S1["Sandbox 1"] --> P1["RWO PVC 1"]
CS --> S2["Sandbox 2"] --> P2["RWO PVC 2"]
contextctl sb create review --replicas 3
contextctl sb wait reviewDeleting the pool also deletes its managed PVCs.
Multiple sandboxes can share one RWX PVC when the storage class supports ReadWriteMany:
flowchart LR
CS["Context Service"] --> S1["Sandbox 1"]
CS --> S2["Sandbox 2"]
S1 --> P["Shared RWX PVC"]
S2 --> P
contextctl sb create review --shared --replicas 3 \
--workspace-size 5Gi --storage-class ibm-scale-csi
contextctl sb wait reviewDeleting the pool also deletes its managed shared PVC.
Attach an existing populated PVC read-only:
flowchart LR
Owner["Producer or external owner"] -->|populate| P["Existing PVC"]
CS["Context Service"] --> S1["Sandbox 1 · RO"] --> P
CS --> S2["Sandbox 2 · RO"] --> P
CS -. never deletes .-> P
contextctl sb create readers --claim prepared-workspace --read-only --replicas 3
contextctl sb wait readersAttach it read-write instead:
contextctl sb create writer --claim prepared-workspace --read-write--claim requires exactly one of --read-only or --read-write. Multiple sandboxes require an
RWX claim. Context Service never deletes the externally owned PVC.
Claim ready sandboxes from an existing agent-sandbox SandboxWarmPool:
flowchart LR
T["SandboxTemplate"] --> W["SandboxWarmPool"]
W --> S1["Warm Sandbox"]
W --> S2["Warm Sandbox"]
CS["Context Service"] --> C1["SandboxClaim 1"] --> S1
CS --> C2["SandboxClaim 2"] --> S2
contextctl sb create fast-run --warm-pool research-agents --replicas 3
contextctl sb wait fast-runThe WarmPool's SandboxTemplate supplies its runtime and storage configuration. Deleting the
allocation removes its SandboxClaim resources, not the WarmPool or template.
Run contextctl help or contextctl help sandbox-pool create for all options and examples.