In the world of software development and business automation, complexity is the enemy. As we build increasingly sophisticated systems—from simple notification services to intricate agentic workflows—the risk of creating unwieldy, brittle monoliths grows. How can we build powerful automations that are also reliable, maintainable, and easy to understand?
The answer lies in a principle that has stood the test of time: breaking down large problems into smaller, manageable pieces. In the .do ecosystem, we call this fundamental piece an atomic action.
action.do is the building block of automation. It represents a single, indivisible, executable step. By chaining these simple steps together, you can create powerful, automated services and deliver valuable Services-as-Software.
Think of an action.do as a LEGO brick for your automation. It's a self-contained unit that performs one specific task, and does it well. An atomic action is:
This approach transforms complex "business as code" from a tangled web into a clear, logical sequence of events.
Defining an action is straightforward. With the .do SDK, you can encapsulate any piece of logic into a reusable action. Let's look at a common task: sending a welcome email to a new user.
import { action } from '@do-sdk/core';
// Define an action to send a welcome email
const sendWelcomeEmail = action.create({
id: 'send-welcome-email',
description: 'Sends a welcome email to a new user.',
execute: async ({ email, name }) => {
// Your email sending logic via an external API
console.log(`Sending welcome email to ${name} at ${email}...`);
// On success, return a meaningful result
return { success: true, messageId: 'xyz-123' };
}
});
// Execute the action
const result = await sendWelcomeEmail.execute({
email: 'jane.doe@example.com',
name: 'Jane Doe'
});
In this example, we've created a self-contained, documented, and executable unit of work. This sendWelcomeEmail action can now be imported and used in any part of our system, without needing to rewrite or copy-paste the email-sending logic.
The true power of action.do is unlocked when you compose them into a workflow.do. While an action is a single step, a workflow is the orchestrator that chains these steps together to achieve a larger business outcome.
Consider a new user onboarding process. Instead of a single, massive function, you can build it as a workflow composed of several atomic actions:
A workflow.do defines this precise sequence, handling the flow of data from one action to the next. If the CRM integration fails, you know exactly which brick in the wall is broken, and the other successful actions (like creating the user in the database) are not compromised.
To ensure action.do remains a robust foundation for workflow automation, it's built on two key principles:
By embracing the philosophy of atomic actions, you move from building fragile scripts to engineering resilient, scalable automation services. You start with a single, perfect brick—the action.do—and build your empire from there.
Q: What is an 'atomic action' in the context of .do?
A: An atomic action is the smallest, indivisible unit of work in a workflow. It performs a single, specific task, like 'send an email' or 'update a database record', ensuring that operations are reliable, testable, and easy to debug.
Q: How does an action.do differ from a workflow.do?
A: An action.do represents a single step, while a workflow.do orchestrates multiple actions to achieve a larger business outcome. You build powerful workflows by composing a series of simple actions.
Q: Can I create my own custom actions?
A: Yes. The .do platform is designed for extensibility. You can define your own custom actions using our SDK, encapsulating your specific business logic and integrating any third-party API to make them available in any workflow.
Q: Are actions stateful?
A: No, actions are stateless by design. They receive input, perform their task, and produce output without retaining memory of previous executions. State management is handled at the workflow level, ensuring actions are reusable and predictable.