Multi-Environment Orchestration
This section is about running Codebolt across more than one execution environment.
The question here is:
How does Codebolt start, connect, and coordinate agent work when the agent loop runs in another environment?
That environment might be:
- an E2B sandbox
- a Daytona workspace
- a Docker container
- a Git worktree environment
- another remote Codebolt server
- a snapshot- or narrative-backed environment
The core idea
Codebolt keeps the server as the control plane and system of record.
A provider is responsible for:
- setting up the remote environment
- starting the remote runtime or agent server
- registering the environment back with Codebolt
- forwarding provider lifecycle and filesystem-style requests
- keeping the remote environment alive with heartbeats
In practice, this means the system is split like this:
local codebolt server
│
├── starts / talks to provider
│
└── provider creates remote environment
│
└── remote runtime connects back over WebSocket
Where the implementation lives
The builder-facing parts currently span a few repos/packages:
| Piece | Role |
|---|---|
packages/server | Owns orchestration state, run state, tool execution, plugin lifecycle |
packages/codeboltjs | Agent SDK and provider-facing protocol handlers |
codeboltjs/packages/provider | Base utilities for building environment providers |
codeboltjs/providers/* | Concrete providers such as e2b, daytona-remote-provider, dockerprovider, gitWorkTreeProvider, remoteserverprovider |
Representative provider implementations exist in:
D:\Codeboltapps\codeboltjs\providers\e2bD:\Codeboltapps\codeboltjs\providers\daytona-remote-providerD:\Codeboltapps\codeboltjs\providers\dockerproviderD:\Codeboltapps\codeboltjs\providers\gitWorkTreeProviderD:\Codeboltapps\codeboltjs\providers\remoteserverprovider
How communication works across environments
At a high level, communication looks like this:
- The server chooses or invokes a provider for an environment.
- The provider creates or attaches to the remote environment.
- The provider starts the remote Codebolt runtime or agent server.
- The remote side connects back over WebSocket.
- Provider lifecycle messages and agent-start messages flow through that connection.
- The remote agent loop runs there, while the server remains the authority for run state.
In the current codeboltjs runtime, provider-oriented handlers include events like:
providerStartproviderAgentStartproviderStopproviderReadFileproviderWriteFileproviderDeleteFile
Those handlers are exposed from Codebolt.ts so provider processes can participate in the protocol without inventing their own transport layer.
What a custom provider is responsible for
A custom provider typically has to implement these responsibilities:
- resolve the project and workspace context
- set up the target environment
- start or attach to the remote runtime
- establish transport back to Codebolt
- respond to provider lifecycle events
- keep the environment healthy and report heartbeats
- tear the environment down cleanly
The shared base for this lives in @codebolt/provider, which exposes a BaseProvider abstraction for environment providers.
What stays local vs what becomes remote
This is the most important thing to explain in the docs.
Usually:
- the agent loop runs remotely
- the server remains local or central
- coordination state still belongs to the server
- event logs still belong to the server
Depending on provider design, some environment-specific file operations may be handled through provider messages, while many normal Codebolt services still route through the main server.
So multi-environment is not "a second independent Codebolt." It is one Codebolt system with a remote execution boundary.
What to document for provider authors
Provider docs should answer four practical questions:
- How do I create and register the environment?
- How does the remote runtime connect back?
- Which messages must my provider handle?
- What state is owned locally vs remotely?
Those four answers matter more than provider-specific deployment steps.
Start here if you are building one
- Read Custom Remote Execution Provider.
- Read Creating a Custom Provider.
- Read Provider Architecture.
- Read Environment Lifecycle.
- Read Communication Flow.
- Read Remote Execution for the user-facing model.
Suggested documentation scope for this track
This section should cover:
- provider architecture
- provider lifecycle
- transport and communication flow
- environment registration and heartbeat
- remote agent startup
- cross-environment file / diff / merge flows
That keeps it clearly separate from multi-agent orchestration management.