System Architecture
The deployment system uses a plugin-based architecture where strategies are self-contained packages that can be added without modifying core code.| Component | Module | Role |
|---|---|---|
| DeploymentFactory | factory.py | Orchestrates selection, adaptation, and runner creation |
| SelectorAgent | selector/agent.py | LLM-based strategy selection |
| AdapterAgent | adapter/agent.py | Code transformation for target platform |
| StrategyRegistry | strategies/base.py | Auto-discovery of strategy plugins |
| Runner | strategies/*/runner.py | Infrastructure-specific execution |
| DeployedSoftware | software.py | Unified wrapper for user interaction |
Module Breakdown
Directory Structure
Core Components
DeploymentFactory (factory.py)
The orchestrator that manages the full deployment pipeline.
Responsibilities:
- Coordinate selection, adaptation, and runner creation
- Handle strategy validation
- Create unified Software instances
SelectorAgent (selector/agent.py)
LLM-based strategy selection that analyzes code and chooses the optimal deployment target.
Responsibilities:
- Gather selector instructions from all strategies
- Query coding agent to analyze repository
- Return
DeploymentSettingwith chosen strategy
| Method | Input | Output |
|---|---|---|
select() | SolutionResult, optional allowed_strategies | DeploymentSetting |
explain() | SolutionResult | str human-readable explanation |
AdapterAgent (adapter/agent.py)
Code transformation and deployment using coding agents.
Responsibilities:
- Create adapted workspace (copy of original)
- Load adapter instructions for target strategy
- Run coding agent to transform code
- Extract endpoint URL and run interface from output
| Method | Input | Output |
|---|---|---|
adapt() | SolutionResult, DeploymentSetting | AdaptationResult |
StrategyRegistry (strategies/base.py)
Auto-discovery system for deployment strategies.
Responsibilities:
- Scan
strategies/directory on startup - Load configuration and instructions for each strategy
- Provide access to strategy metadata and runner classes
| Method | Input | Output |
|---|---|---|
list_strategies() | optional allowed: List[str] | List[str] |
get_strategy() | name: str | DeployStrategyConfig |
get_runner_class() | name: str | type (Runner subclass) |
Runner (Abstract Base Class)
Infrastructure-specific execution handler.| Runner | Strategy | Execution Method |
|---|---|---|
LocalRunner | local | Python importlib + function call |
DockerRunner | docker | HTTP requests to container |
ModalRunner | modal | modal.Function.remote() |
BentoMLRunner | bentoml | HTTP to BentoCloud/local |
LangGraphRunner | langgraph | LangGraph Cloud API |
DeployedSoftware (software.py)
Unified wrapper that users interact with.
Data Models
DeployConfig
DeploymentSetting
AdaptationResult
Strategy Plugin Architecture
Each strategy is a self-contained directory:config.yaml Structure
How Strategies Are Discovered
- On import,
StrategyRegistryscansstrategies/directory - Each subdirectory with
selector_instruction.mdANDadapter_instruction.mdis registered - Runner classes are lazy-loaded from
runner.pywhen needed