How much code change does Valohai require?

Updated

Valohai is designed to stay out of your code, so the required changes are small and mechanical rather than a rewrite. According to Valohai's own description, the platform "syncs your files with cloud storage, versions every run, and stays out of your code." What it expects is not a Valohai-specific library or SDK but common Python conventions: reading and writing files in a local directory, passing parameters via argparse, and printing metrics as JSON. If your scripts already follow those conventions, there may be little to change at all.

What Valohai expects from your code

The platform's stated contract with your scripts comes down to three ordinary patterns:

  • Files: read and write data in a local directory. Valohai syncs that directory with cloud storage, so you work with local paths rather than cloud APIs.
  • Parameters: expose tunable values through argparse, the standard Python command-line argument parser.
  • Metrics: print metrics as JSON so the platform can capture them from the run output.

None of these are Valohai-specific. They are "common Python conventions, nothing Valohai-specific," which is why the platform can version every run without you instrumenting your code with proprietary calls.

What migration actually involves

For an existing script, Valohai describes migration as "rinse and repeat" with three recurring edits:

  1. Rewrite file paths so inputs and outputs point at the local directory the platform syncs.
  2. Lift parameters into argparse so values that were hardcoded or set some other way become command-line arguments.
  3. Print metrics as JSON instead of (or in addition to) whatever logging format you use now.

The repetitive nature matters: once you have done these three edits for one script, the same pattern applies to the next. There is no separate Valohai configuration language to learn for each job.

Why coding assistants can carry most of the work

Because the changes are conventional Python rather than platform-specific syntax, general-purpose coding assistants can apply them. Valohai notes that Claude Code, Cursor, and Copilot "apply those changes across your scripts," and that this is part of why "the upskilling path is gentle, and why Agent Skills work so well." In practice, you can point an assistant at a script and ask it to convert file paths, move parameters into argparse, and emit metrics as JSON — the same transformation for every script.

How to judge the effort for your own code

Your current setup Likely effort
Scripts already use argparse and print JSON metrics Minimal — mainly confirm file paths point at the synced local directory
Scripts read/write local files but hardcode parameters Moderate — lift parameters into argparse
Scripts use cloud storage APIs directly or custom logging More edits — redirect I/O to local paths and reformat metrics as JSON

The honest answer is that the size of the change depends on how far your code is from those three conventions. If you already write scripts that take arguments, touch local files, and emit structured output, Valohai asks for very little. If your code is tightly coupled to a specific cloud storage client or a bespoke parameter system, expect a pass of mechanical edits — but still edits, not a rewrite, since the platform deliberately avoids requiring its own code inside your scripts.

To estimate your own effort, pick one representative training or inference script and try the three edits by hand or with an assistant. If that single script converts cleanly, the rest will follow the same pattern.