In the world of workflow automation, complexity is the enemy of reliability. As we build increasingly sophisticated systems—especially agentic workflows that make decisions and interact with multiple services—the risk of partial failures and inconsistent states grows exponentially. What happens when a script successfully creates a user but fails to send the welcome email? You're left with a broken user experience and a tangled mess to debug.
This is where the principle of atomicity becomes a game-changer. Imagine if every single task in your workflow was an unbreakable unit—it either completes perfectly or it fails cleanly, leaving your system exactly as it was before.
This is the power of action.do. On the .do platform, an atomic action is the fundamental building block for all automation. It lets you define single, indivisible tasks to build complex automations and deliver services with absolute precision and reliability.
Think of an atomic action as the smallest possible unit of work that still has meaning. It's a single, encapsulated task that cannot be broken down further. The core principle is all-or-nothing execution.
This concept isn't new; it's the bedrock of reliable database transactions. The .do platform brings this same level of transactional integrity to your business processes. An action.do could be anything from "update a CRM record" to "send a password reset email" or "provision a new server." By defining these tasks as atomic, you eliminate entire classes of errors common in traditional scripting.
While actions are the granular building blocks, they are not the end goal. The true value lies in composing them into higher-level business capabilities. This is the distinction between action.do and service.do:
By embracing this "Business-as-Code" methodology, you transform your operations. Fragile, monolithic scripts become a well-defined library of reusable, versioned, and API-callable actions. Your workflows become clear orchestrations of these reliable components, making them easier to build, debug, and scale.
Invoking an action is designed to be simple and programmatic. Using the .do SDK, you can seamlessly execute predefined actions from anywhere in your application stack.
Here’s how you would execute an action to send a welcome email:
import { Do } from '@do-platform/sdk';
// Initialize the .do client with your API key
const client = new Do({ apiKey: 'YOUR_API_KEY' });
// Execute a predefined atomic action by name
async function sendWelcomeEmail(userId: string) {
try {
const result = await client.action.execute({
name: 'send-welcome-email',
params: {
recipientId: userId,
template: 'new-user-welcome-v1'
}
});
console.log('Action Executed Successfully:', result.id);
return result;
} catch (error) {
console.error('Action Failed:', error);
}
}
// Run the action for a new user
sendWelcomeEmail('user_12345abc');
Let's break this down:
By shifting your mindset from writing scripts to composing atomic actions, you build a foundation for truly robust and scalable agentic workflows. action.do empowers you to encapsulate single tasks as reliable, API-callable units, bringing the precision of database transactions to your entire business logic. Stop chasing down partial failures and start building automations that work, every time.
What is an 'atomic action' in the context of .do?
An atomic action is the smallest, indivisible unit of work within a workflow. It represents a single, specific task—like sending an email or updating a database record—that either completes successfully or fails entirely, ensuring system reliability and preventing partial states.
How do actions differ from services?
An action (action.do) is a single, granular operation. A service (service.do) is a higher-level business capability composed of one or more actions orchestrated into a workflow. Actions are the building blocks; services are the valuable outcomes.
Can I create my own custom actions?
Yes. The .do platform empowers you to define your own custom actions using Business-as-Code. You can encapsulate any business logic, external API call, or script into a reusable, versioned, and callable action for your agentic workflows.
How are actions invoked?
Actions are invoked programmatically through the .do API or our language-specific SDKs. You simply call the action by its unique name and provide the necessary parameters, allowing for seamless integration into any application or system.
What happens when an action fails?
Because actions are atomic, a failure is handled cleanly without leaving your system in an inconsistent state. The platform provides detailed error logging and allows you to configure automated retries, notifications, or alternative compensatory actions.