deploy() takes a strategy that decides where the solution runs. Five ship, plus AUTO, which picks one for you.
Which strategy should I use?
In Python the values are
DeployStrategy.LOCAL and so on; on the CLI they are lowercase, as --strategy docker.
Local
Runs the solution as a plain Python process in the current environment. Nothing to install, easiest to debug, no isolation.main.py exposing predict() and the runner imports it. Its run_interface is {type: function, module: main, callable: predict}.
Docker
Runs the solution in a container, so system dependencies and Python versions stay contained. Needs Docker installed and running.http://localhost:<port>/predict from a container named kapso-<solution>-<hash>; the name and the host port are derived from the solution’s path, so two solutions deployed on one machine keep their own container, image and port, and a re-deploy replaces only its own. The container runs as an unprivileged user, restarts with the daemon, and is recreated by start() with the same environment variables and, when the selector granted one, the GPUs.
Dockerfile the adapter generates
Dockerfile the adapter generates
requests: pip install "leeroo-kapso[deploy]".
Modal
Runs on Modal’s serverless platform, which is the quickest route to a GPU you do not have to operate. Needspip install modal && modal token new.
kapso-<solution>-<hash> and exposes a predict function plus a web endpoint. An explicit DeployStrategy.MODAL deploy runs on CPU; under AUTO the selector names a GPU (T4, A10G, …) when the code needs one, and the adapter sets gpu= from it. stop() removes the app; start() runs modal deploy again from the adapted workspace. Install with pip install "leeroo-kapso[modal]".
Modal app the adapter generates
Modal app the adapter generates
BentoML
Packages the solution as a BentoML service and deploys it to BentoCloud (aBENTO_CLOUD_API_KEY is required; serving without BentoCloud is not wired yet). Needs pip install "leeroo-kapso[bentoml]".
4Gi of memory, served at /predict against the bentocloud provider.
BentoML service the adapter generates
BentoML service the adapter generates
LangGraph
Deploys the solution as a LangGraph agent workflow, with state, tools, streaming and checkpoints, on LangGraph Platform (aLANGSMITH_API_KEY is required). Needs pip install "leeroo-kapso[langgraph]".
agent.py, main.py and langgraph.json; the runner calls the deployed graph on LangGraph Platform via langgraph_sdk, against assistant id agent.
How does AUTO choose?
AUTO is the default. A selector agent reads the solution and picks a target from the code itself rather than from a rule table:
selector_instruction.txt describing when it is the right answer, so the choice is made from those descriptions.
Name a strategy explicitly when you already know the answer; AUTO costs a model call.
How do I pass environment variables?
--env:
.env in the adapted workspace (owner-only permissions; an existing .env keeps its other lines), and the adapter session sees their names, never their values. At runtime Kapso sets them itself where it owns the process: in the local runner’s environment before main is imported, and on the Docker container both at the first docker run --env-file .env and whenever start() recreates it. For Modal, BentoCloud and LangGraph the adapter attaches the file to the deployment (modal.Secret.from_dotenv(), envs: in bentofile.yaml, "env": ".env" in langgraph.json).
What is checked before the software is handed back?
After the adapter session, the adaptation is validated: every Python file must compile, the files the strategy’sconfig.yaml names under required_files must exist, and — for LOCAL, the one target that runs in this interpreter — main must import. A failed check is sent back to the agent with the finding, up to two more times; a deployment that still fails validation raises instead of handing back software that cannot run.
Related
Deployment architecture
Adding a strategy
pip install leeroo-kapso · Every page as plain text: llms.txt.