Many algorithms need more than code: model weights, a lookup table, a config file. A Python algorithm today is a single main.py of at most 32 KiB plus Python packages, with no place to upload other files. This page shows the options that work now, and their limits.
Choose an option
| Option | Good for | Test run | Workflow step |
|---|---|---|---|
| A Python package in Requirements | Libraries, and models that ship inside a package | Works | Works |
Download in setup() | Weights you host, up to a few hundred MB | Fails: no network | Works where the deployment allows outbound traffic |
| An image algorithm | Large weights, many files, any language | Runs the saved image | Works |
A Python package
List the package in Requirements, one per line, such as opencv-python-headless>=4.9; up to 50 packages, as prebuilt wheels. The platform builds an image for the version when you save, so everything is in place before a step starts. Packages that bundle their weights, or download them only when you call them, fall under the next option.
Download in setup()
Define setup(ctx) in main.py. It runs once before run, and what it returns reaches run as the state argument. Load or download your weights there.
def setup(ctx):
# Runs once per step, before run(). Download or load your weights here.
return load_model("https://models.example.com/hand-boxes-v3.onnx")
def run(recording, out, state):
model = state
...A workflow step can reach public internet addresses, so this works in a workflow on EmbodiFlow Cloud and on deployments that allow outbound traffic; an air-gapped deployment does not. A test run has no network access at all, so the same code fails there. Raise a clear error when the download fails, so the step tells you why instead of writing an empty result.
An image algorithm
For large weights, many files or another language, build a container image with everything in it, on your machine, and push the image. ef algorithm init <dir> --lang image writes an algorithm.yaml, a Dockerfile and an entry script; ef algorithm test <dir> --build builds and tests it with Docker; ef algorithm push <dir> --archive <image.tar> imports a saved image into your team's registry and registers the version. See Image algorithms.
EmbodiFlow Cloud does not build Dockerfiles for teams (ALGORITHM_DOCKERFILE_BUILD_UNAVAILABLE): build the image yourself and push it. A deployment can also turn image pushes off, and then push is refused with ALGORITHM_IMAGE_PUSH_UNAVAILABLE.