Skip to main content
The deployment module’s main exports, with signatures. For choosing a target see Deployment strategies; for how the pieces fit together see Deployment architecture.

Module exports


DeploymentFactory

Factory for creating deployed Software instances.

Methods

create()

Create a deployed Software instance.
Parameters: Returns: Software instance with unified interface Raises:
  • ValueError if strategy not in allowed list
  • RuntimeError if adaptation fails
Example:

list_strategies()

List all available deployment strategies.
Returns: List of strategy names Example:

explain_strategy()

Get explanation of a deployment strategy.
Parameters: Returns: One-line description from selector instruction Example:

Print information about all deployment strategies.
Example:

DeployStrategy

Enum of available deployment strategies. Auto-generated from strategies/ directory.
Usage:

DeployConfig

Configuration for deploying software.
Fields: Properties: Example:

Software (abstract base class)

Unified interface for deployed software. Users interact with this class.

Methods

run()

Execute the software with given inputs.
Parameters: Returns: Normalized response dictionary Response Format:
Example:

stop()

Stop the software and cleanup resources.
Behavior by Strategy: Example:

start()

Start or restart a stopped deployment.
Behavior by Strategy: Example:

logs()

Get execution logs.
Returns: Log content as string Example:

is_healthy()

Check if software is running and healthy.
Returns: True if healthy, False otherwise Example:

name (property)

Return the deployment strategy name.
Example:

Convenience methods

call()

Shorthand for run().

run_batch()

Run multiple inputs in sequence.
Example:

Context manager support


DeployedSoftware

Concrete implementation of Software. Wraps any runner with unified interface.

Additional methods

get_adapted_path()

Get path to the adapted code.
Example:

get_endpoint()

Get HTTP endpoint if applicable.
Returns: Endpoint URL or None Example:

get_deployment_info()

Get full deployment metadata.
Returns:

get_strategy()

Get the deployment strategy name.

get_provider()

Get the cloud provider name.

Data classes

DeploymentSetting

Result of strategy selection.

AdaptationResult

Result of code adaptation.

DeploymentInfo

Metadata about the deployment.

SelectorAgent

LLM-based strategy selection agent.

Methods

select()

Select deployment configuration for a solution.

explain()

Get human-readable explanation of selection.
Example:

AdapterAgent

Code transformation and deployment agent.

Methods

adapt()

Adapt a solution for deployment.
Note: Creates a copy of the solution at {code_path}_adapted_{strategy}. Original is never modified.

StrategyRegistry

Auto-discovery system for deployment strategies.

Methods


Runner (abstract base class)

Base class for strategy-specific runners.

Lifecycle

Runners follow this lifecycle:
  1. __init__() → Ready state
  2. run() → Execute (can be called multiple times)
  3. stop() → Stopped state (resources cleaned up)
  4. start() → Ready state (can run again)

Abstract methods


Error handling


Environment variables

Deployment strategies

The five targets and what each one suits

Python API

deploy() on the Kapso class
Related pages: Deployment strategies · Python API · CLI Kapso is an open-source framework by Leeroo that builds software toward measurable goals through experiment campaigns. Source code: github.com/Leeroo-AI/kapso · Install: pip install leeroo-kapso · Every page as plain text: llms.txt.