The world of AI and Machine Learning is built on complex processes. A single model training pipeline can involve fetching data from multiple sources, cleaning and transforming it, training for hours or days, validating the results, and finally, deploying the model to production. This is often managed through a tangled web of shell scripts, Python files, and cron jobs—a system that's brittle, difficult to debug, and nearly impossible to reuse.
What if we could tame this complexity? What if, instead of monolithic scripts, we could build our ML pipelines from small, reliable, and reusable building blocks?
This is the core philosophy of the .do platform. By applying the concept of atomic actions to AI, we can transform chaotic ML pipelines into robust, manageable, and scalable agentic workflows.
If you've worked in MLOps, this probably sounds familiar: a single, massive train.py script that does everything. It fetches data, preprocesses it, builds the model, trains it, and saves the output.
This monolithic approach is fraught with problems:
On the .do platform, an atomic action is the smallest, indivisible unit of work. It's a self-contained, reusable function designed to do one thing and do it well. Instead of one giant script, you can break down your model training pipeline into a series of distinct actions:
Each of these becomes an Action on the .do platform. They are more than just functions; they are supercharged, automatically instrumented with logging, error handling, retries, and versioning—essentials for serious workflow orchestration.
Let's see what this looks like in practice. The .do platform allows you to define these actions as simple, self-contained code blocks. While the original example shows sending an email, the same principle applies perfectly to an ML task.
Here’s how you might define a preprocess-data action using the .do SDK:
import { Action } from '@do-sdk/core';
import { readFileSync, writeFileSync } from 'fs';
// Define a new Action to preprocess a dataset
const preprocessData = new Action({
name: 'preprocess-data',
description: 'Loads a raw dataset, cleans it, and saves the output.',
handler: async (inputs: { rawDataPath: string; outputPath: string }) => {
console.log(`Loading data from ${inputs.rawDataPath}...`);
// const rawData = readFileSync(inputs.rawDataPath, 'utf-8');
// --- Start Preprocessing Logic ---
// In a real scenario, this would involve libraries like pandas-js or custom logic.
// e.g., normalize, remove outliers, handle missing values.
const processedData = "pretend_this_is_clean_data";
console.log('Data processing complete.');
// --- End Preprocessing Logic ---
// writeFileSync(inputs.outputPath, processedData);
console.log(`Processed data saved to ${inputs.outputPath}`);
const result = { success: true, processedRows: 1000 };
return result;
},
});
// Execute the action via the .do SDK
async function run() {
const execution = await preprocessData.run({
rawDataPath: '/mnt/data/raw/dataset.csv',
outputPath: '/mnt/data/processed/dataset.arrow',
});
console.log('Execution Result:', execution);
}
run();
By encapsulating this logic in an Action, you've created a reusable, testable, and versioned component. You've turned a piece of your business logic (or in this case, ML logic) into Business-as-Code.
The true power is unlocked when you chain these atomic actions together to create a complete workflow. This is where action.do moves beyond simple API automation and enables truly agentic workflows.
Instead of a script, your entire model training pipeline can be defined declaratively in a workflow.do file. It orchestrates the execution of your individual Actions, passing outputs from one step as inputs to the next.
Your workflow might look like this:
This approach delivers transformative benefits:
By breaking down complex AI processes into atomic steps, you're not just organizing code—you're building a more robust, scalable, and intelligent system. You're ready to DO MORE, FASTER.
Ready to stop wrestling with monolithic scripts? Explore how action.do can bring order to your agentic workflows and turn your most complex processes into manageable code.