Module Exports
DeploymentFactory
Factory for creating deployed Software instances.Methods
create()
Create a deployed Software instance.| Parameter | Type | Description |
|---|---|---|
strategy | DeployStrategy | Deployment target (AUTO, LOCAL, DOCKER, etc.) |
config | DeployConfig | Deployment configuration |
strategies | List[str] | Optional list of allowed strategies (for AUTO) |
Software instance with unified interface
Raises:
ValueErrorif strategy not in allowed listRuntimeErrorif adaptation fails
list_strategies()
List all available deployment strategies.explain_strategy()
Get explanation of a deployment strategy.| Parameter | Type | Description |
|---|---|---|
strategy | str | Strategy name |
print_strategies_info()
Print information about all deployment strategies.DeployStrategy
Enum of available deployment strategies. Auto-generated fromstrategies/ directory.
DeployConfig
Configuration for deploying software.| Field | Type | Default | Description |
|---|---|---|---|
solution | SolutionResult | Required | The built solution from Tinkerer.evolve() |
env_vars | Dict[str, str] | {} | Environment variables |
timeout | int | 300 | Execution timeout in seconds |
coding_agent | str | "claude_code" | Coding agent for adaptation |
| Property | Type | Description |
|---|---|---|
code_path | str | Path to the generated code |
goal | str | The original goal/objective |
Software (Abstract Base Class)
Unified interface for deployed software. Users interact with this class.Methods
run()
Execute the software with given inputs.| Parameter | Type | Description |
|---|---|---|
inputs | Dict, str, or bytes | Input data |
stop()
Stop the software and cleanup resources.| Strategy | What stop() Does |
|---|---|
| LOCAL | Unloads Python module from sys.modules |
| DOCKER | Stops and removes the Docker container |
| MODAL | Runs modal app stop to terminate the deployment |
| BENTOML | Runs bentoml deployment terminate to stop the service |
| LANGGRAPH | Deletes the conversation thread and disconnects |
start()
Start or restart a stopped deployment.| Strategy | What start() Does |
|---|---|
| LOCAL | Reloads the Python module |
| DOCKER | Creates and starts a new container |
| MODAL | Re-lookups the Modal function |
| BENTOML | Re-deploys by running deploy.py from code_path |
| LANGGRAPH | Reconnects to LangGraph Platform |
logs()
Get execution logs.is_healthy()
Check if software is running and healthy.True if healthy, False otherwise
Example:
name (property)
Return the deployment strategy name.Convenience Methods
call()
Shorthand forrun().
run_batch()
Run multiple inputs in sequence.Context Manager Support
DeployedSoftware
Concrete implementation ofSoftware. Wraps any runner with unified interface.
Additional Methods
get_adapted_path()
Get path to the adapted code.get_endpoint()
Get HTTP endpoint if applicable.None
Example:
get_deployment_info()
Get full deployment metadata.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.AdapterAgent
Code transformation and deployment agent.Methods
adapt()
Adapt a solution for deployment.{code_path}_adapted_{strategy}. Original is never modified.
StrategyRegistry
Auto-discovery system for deployment strategies.Methods
get()
Get singleton registry instance.list_strategies()
List available strategy names.get_strategy()
Get strategy config by name.get_selector_instruction()
Get selector instruction content.get_adapter_instruction()
Get adapter instruction content.get_runner_class()
Get the runner class for a strategy.get_default_run_interface()
Get default run interface from config.yaml.Runner (Abstract Base Class)
Base class for strategy-specific runners.Lifecycle
Runners follow this lifecycle:__init__()→ Ready staterun()→ Execute (can be called multiple times)stop()→ Stopped state (resources cleaned up)start()→ Ready state (can run again)
Abstract Methods
Complete Usage Example
Error Handling
Environment Variables
| Variable | Strategy | Description |
|---|---|---|
MODAL_TOKEN_ID | Modal | Modal authentication |
MODAL_TOKEN_SECRET | Modal | Modal authentication |
LANGSMITH_API_KEY | LangGraph | LangSmith API key |
BENTOML_API_TOKEN | BentoML | BentoCloud authentication |