Skip to content

System architecture

This page explains how Capsem’s clients, shared service, and per-VM workers work together to run agents and tools in Linux VMs on your computer. It follows VM creation, traffic handling, record storage, and shutdown so you can identify which component owns each part of the work.

Control and data

Legend
  • Components, inputs and outputs
    No host-permission level assigned by this diagram.
  • Control and processing
    Components or stages that manage and process operations.
  • Per-VM ownership
    Dashed boundary groups components assigned to one VM.
  • VM hardware boundary
    Separates the Linux VM and its workload from host processes.
FromConnectionTo
@capsem/mcpSDKCLI · TUI · Capsem UI · SDKs
CLI · TUI · Capsem UI · SDKsauthenticated APIGateway
GatewayHTTP over Unix socketService
Servicelifecycle / grants · controlVM owner
Servicepolicy / capabilities · controlSecurity engine
Serviceproducer / reader grants · controlLog writer
OCI containerterminal / traffic / tools · bidirectionalGuest helpers
VM ownervsock control · bidirectionalGuest helpers
Guest helpersvsock trafficSecurity engine
Security engineaudit recordsLog writer
VM ownerVM recordsLog writer
Security engineallowed traffic on granted connectionsUpstream services

Create and operate a VM

The CLI, TUI, Capsem UI, and SDKs send VM requests through the gateway. The gateway authenticates the caller; the service selects the VM and sends typed commands to its owner. Clients cannot connect to VM-owner control sockets.

For creation, the service admits the image and settings, prepares the VM’s storage, and starts its workers. The VM owner boots Linux and connects guest helpers over vsock, a host–VM transport. Terminal input, commands, and file operations follow these channels. Image creation returns after the workload reports readiness.

Process traffic

Guest networking sends supported HTTP, HTTPS, and DNS traffic to the VM’s security engine. It parses traffic, evaluates rules, requests authorized credentials, and forwards allowed operations over service-granted connections. Required audit records go to the log writer before the operation proceeds.

Private networks connect guest interfaces through a separate switch process. Published ports use a separate relay. Neither path passes through HTTP inspection. See the network boundaries.

Run model requests without a VM

capsem proxy creates a separate security engine and log writer for a model client running on your computer. The CLI controls the lease through the authenticated gateway; the model client sends requests to a separate HTTP listener. The service accepts connections and passes connected sockets to the confined engine. No VM owner, guest helper, or container is started.

Legend
  • Limited host permissions
    Assigned files, credentials, or upstream connections.
  • Maximum host permissions
    Launching-user permissions or trusted coordinator authority.
  • Components, inputs and outputs
    No host-permission level assigned by this diagram.
  • Per-VM ownership
    Dashed boundary groups components assigned to one VM.
FromConnectionTo
capsem proxyauthenticated controlcapsem-gateway
capsem-gatewayHTTP over UDScapsem-service
Model client on hostmodel API requestsService data listener — HTTP · unauthenticated
capsem-servicebind / accept · controlService data listener — HTTP · unauthenticated
Service data listener — HTTP · unauthenticatedconnected socketscapsem-proxy — Security engine
capsem-servicepolicy / capabilities · controlcapsem-proxy — Security engine
capsem-serviceledger grants · controlcapsem-ledger — Temporary records
capsem-proxy — Security engineaudit recordscapsem-ledger — Temporary records
capsem-proxy — Security engineallowed requests service-granted connectionsConfigured model provider

The provider configuration fixes the upstream destination and wire protocol. The engine applies policy, credential processing, and logging through the same pipeline used for VM traffic. The listener is unauthenticated HTTP, so keep it on loopback. This mode cannot restrict the host client’s other activity. Follow Use model APIs through the proxy to connect a client, or use the Proxy reference to implement lease control.

State and ownership

ScopeOwners and state
SharedService, gateway, credential store, installed runtime assets, image cache, and settings.
Per VMVM owner, security engine, log writer, native MCP workers, guest filesystem, and ledger.
Per proxy leaseSecurity engine, log writer, provider routing, and temporary records; no VM.
Per private networkSwitch process, member cables, and network audit records.
Per published connectionGranted host and guest connections passed to the VM’s expose relay.

Named VMs retain their files when stopped. Suspending also saves running VM state; forking copies a VM’s files into another persistent VM. A fork starts programs afresh. The log writer owns ledger access for both live and retained VMs.

Stop and retire

The service revokes the original worker generation and waits for its processes to exit before retiring its resources. Managed SDK jobs renew a finite lease; lost renewal lets the service clean up after a client crash.

The security architecture describes process permissions, grant authentication, revocation, and the trusted components.