In the world of automation, complexity is the enemy of reliability. As we build increasingly sophisticated systems—from simple task automations to advanced agentic workflows—the risk of creating fragile, hard-to-debug monoliths grows. When a multi-step process fails halfway through, where do you even begin to look?
The answer lies not in building bigger, more complex systems, but in thinking smaller. Much smaller. The solution is to embrace the power of the atomic.
Enter atomic actions: the fundamental building blocks of modern automation. At action.do, we believe that by breaking down any process into its smallest, indivisible units, you can build workflows that are not just powerful, but also incredibly reliable, scalable, and easy to maintain.
In the context of automation, an atomic action is the smallest, indivisible unit of work. Think of it as a single, well-defined task that represents a single logical operation.
Consider these examples:
The key principle of an atomic action is that it either completes successfully or it fails entirely, leaving no messy partial states behind. A user record isn't half-created. An email is either sent or it's not. This all-or-nothing guarantee is the cornerstone of building dependable systems.
While a single action is useful, its true potential is unlocked when you start composing them. An action.do represents a single, reusable task. A workflow.do is where the magic happens—it's the orchestration of one or more actions to achieve a larger business process.
This approach to workflow automation allows you to construct sophisticated agentic workflows that can reason and execute complex processes, all while being built on a foundation of simple, testable, and reliable components. This is the essence of business-as-code.
We've designed action.do to make encapsulating logic into a powerful, API-callable action incredibly straightforward. You define what it does, what it needs, and how it runs—all in clean,-readable code.
Here’s how you would define an action to send a welcome email using our SDK:
import { action } from '@do-sdk/core';
export const sendWelcomeEmail = action({
name: 'send-welcome-email',
description: 'Sends a welcome email to a new user.',
inputs: {
to: { type: 'string', required: true },
name: { type: 'string', required: true }
},
handler: async ({ inputs, context }) => {
const { to, name } = inputs;
// Email sending logic (e.g., using an API like SendGrid or AWS SES)
console.log(`Sending welcome email to ${name} at ${to}`);
// A real implementation would return actual success status and identifiers
return { success: true, messageId: 'xyz-123' };
},
});
Let's break this down:
Once defined, this action becomes a repeatable, callable unit that can be triggered via an API and integrated into countless workflows.
An atomic action is the smallest, indivisible unit of work in a workflow. It represents a single, well-defined task, like 'send an email' or 'create a user record', ensuring that it either completes successfully or fails entirely, without partial states.
An action.do represents a single task. A workflow.do is a collection of one or more actions orchestrated to achieve a larger business process. Actions are the building blocks; workflows are the blueprints that connect them.
Absolutely. Actions are designed to be modular and reusable. You can define an action once, like 'generate-report', and call it from any number of different workflows, promoting DRY (Don't Repeat Yourself) principles in your automations.
The handler can contain any Node.js/TypeScript logic. This includes making API calls to third-party services, performing data transformations, interacting with databases, or executing any custom business logic required to complete the task.
Stop wrestling with monolithic scripts and fragile automations. By adopting an atomic approach, you gain reliability, reusability, and clarity. When a process fails, you'll know exactly which brick is out of place, allowing you to fix it quickly and confidently.
Ready to turn your complex processes into simple, repeatable tasks? Simplify complexity and build robust, scalable agentic workflows from the ground up with action.do.