This README provides an overview of the OpenDevin Runtime, a crucial component of the OpenDevin system. It covers two main aspects:
The following sections dive deeper into these topics, providing a comprehensive understanding of the OpenDevin Runtime system.
+-------------------+ +-------------------+
| OpenDevin | | Docker Host |
| Backend | | |
| | | +-------------+ |
| +-------------+ | | | Runtime | |
| | EventStream | | | | Container | |
| | Runtime |<-|-----|->| | |
| +-------------+ | | | +-------+ | |
| | | | |Runtime| | |
| | | | |Client | | |
| | | | +-------+ | |
| | | | | | |
| | | | +-------+ | |
| | | | |Plugins| | |
| | | | +-------+ | |
| | | +-------------+ |
+-------------------+ +-------------------+
This diagram illustrates the high-level architecture of the OpenDevin Runtime system:
This architecture ensures a secure and flexible environment for executing AI-driven development tasks, allowing OpenDevin to execute a wide range of actions safely and efficiently.
The OpenDevin runtime uses a layered approach for building Docker images:
Original Image: ubuntu:22.04
Runtime Image: od_runtime:od_v{OPENDEVIN_VERSION}_image_ubuntu__22.04
Example image name: od_runtime:od_v0.8.1_image_ubuntu__22.04
od_runtime_dev:od_v{OPENDEVIN_VERSION}_image_ubuntu__22.04
SANDBOX_UPDATE_SOURCE_CODE is not set)By default, when SANDBOX_UPDATE_SOURCE_CODE is unset OR set to false, the build process only needs to run once:
od_runtime:od_v{OPENDEVIN_VERSION}_image_ubuntu__22.04) is created by copying OpenDevin code into the original Ubuntu image and installing all dependencies.SANDBOX_UPDATE_SOURCE_CODE=True)When developing or modifying code that runs inside the container, you can set env var SANDBOX_UPDATE_SOURCE_CODE=True to enable a more dynamic build process:
od_runtime_dev:od_v{OPENDEVIN_VERSION}_image_ubuntu__22.04) is rebuilt from the Runtime Image (od_runtime:od_v{OPENDEVIN_VERSION}_image_ubuntu__22.04).This approach allows developers to easily test changes to the OpenDevin codebase, including modifications to files like client.py, without needing to rebuild the entire image from scratch each time.
The Runtime Client is a crucial component of the OpenDevin system, responsible for executing actions within the Docker sandbox environment and producing observations. Here's an overview of its functionality:
Initialization:
EventStreamRuntime class in runtime.py initializes the Docker container and sets up the runtime environment.Communication:
Action Execution:
CmdRunAction: Executes shell commands using a pexpect-spawned bash shell.FileReadAction and FileWriteAction: Perform file operations within the sandbox.IPythonRunCellAction: Executes Python code in an IPython environment.BrowseURLAction and BrowseInteractiveAction: Handle web browsing tasks using a browser environment.Plugin System:
Observation Generation:
Asynchronous Operation:
Security:
Flexibility:
SANDBOX_UPDATE_SOURCE_CODE=False) and development (SANDBOX_UPDATE_SOURCE_CODE=True) modes.