Automation is the backbone of modern business operations. From user onboarding to data processing pipelines, we rely on scripts and services to perform critical tasks. But let's be honest: how often are these automation scripts a source of anxiety? A single network blip or an unexpected API change can bring a brittle script to its knees, leaving your system in an inconsistent, partially-completed state.
This is the chaos of non-atomic operations. When a script fails halfway through, you're left to manually clean up the mess and diagnose the problem by digging through obscure logs. There’s a better way.
The solution is to shift your mindset from writing monolithic scripts to composing workflows from atomic actions. An atomic action is a single, indivisible task that is guaranteed to either complete successfully or fail entirely, leaving no side effects. This is the core principle behind action.do—the fundamental building block for reliable automation.
This post will guide you through the process of identifying, refactoring, and migrating your existing automation to the reliable, auditable, and atomic paradigm of action.do.
If you've ever written an automation script, you've likely encountered these pain points:
These problems all stem from treating automation as a simple series of function calls instead of what they really are: critical business processes that demand reliability.
action.do encourages a fundamental shift: Treat every single task as a managed, versioned service. Instead of a loose function, an action becomes a formal unit of work with built-in superpowers.
With action.do, every task is:
Transitioning to action.do isn't about rewriting everything from scratch. It's about intelligently wrapping and refactoring your existing logic into robust, atomic units.
Look at one of your existing automation scripts. Let's take a common user onboarding workflow. Your script might look something like this:
In this script, you have four distinct, indivisible operations. These are your candidates for atomic actions: create-user, send-welcome-email, create-subscription, and mark-onboarding-complete.
Now, let's take one of those units—send-welcome-email—and define it as an action. Within the action.do platform, you'll create a new action and encapsulate the logic for making that API call. You'll also define its expected inputs, such as userId and template.
This action can be any scripted task: an API call, a database update, a shell command, or even an interaction with a smart contract.
With your action defined, you can now refactor your orchestrating code. Instead of a block of custom code for sending an email, you make a single, clean call to the action.do SDK.
Before:
// A messy, custom implementation inside your main script
async function sendWelcomeEmailWithFetch(email, name) {
try {
const response = await fetch('https://api.sendgrid.com/v3/mail/send', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.SENDGRID_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ /*...email payload...*/ }),
});
// ...error handling and logging...
} catch (error) {
// ...more error handling...
}
}
After:
import { DotDo } from '@do-platform/sdk';
const client = new DotDo({ apiKey: 'YOUR_API_KEY' });
// Execute a predefined action, 'send-welcome-email'
async function sendWelcomeEmail(userId: string) {
const result = await client.action('send-welcome-email').execute({
userId: userId,
template: 'new-user-template-2024',
});
console.log(`Action completed with status: ${result.status}`);
return result;
}
Your code is now declarative. You're saying what you want to do (execute 'send-welcome-email'), not how to do it. The reliability, retries, and logging are all handled by the platform.
Once you have migrated your individual tasks into atomic actions, you can chain them together to recreate your original business process. You can do this in your own application code or, for more complex scenarios, use a dedicated orchestration agent. action.do is designed as a fundamental building block that can be easily composed into powerful agentic workflows using tools like workflow.do.
By migrating your automation to action.do, you immediately gain:
Stop living with the anxiety of brittle scripts. Start building automation that is Reliable. Atomic. Auditable.
Ready to make your automation flawless? Explore action.do and transform your scripts into services you can trust.
What is an 'atomic action'?
An atomic action is a single, indivisible operation that either completes successfully or fails entirely, leaving no partial state. This guarantees data integrity and reliability in your workflows.
How is action.do different from a simple function call?
action.do provides a layer of abstraction with built-in observability, retries, and audit trails. It treats actions as manageable, versioned services, making your automation more robust and transparent than a standard function.
What kind of actions can I perform with action.do?
You can define any action that can be scripted, such as making an API call, sending an email, updating a database record, interacting with a smart contract, or running a shell command.
Can actions be chained together?
Yes. action.do is designed as a fundamental building block. You can use an orchestration agent (like workflow.do) to chain multiple atomic actions together to create complex and powerful services.