In the world of complex software and business processes, failure is inevitable. A network connection drops, a third-party API times out, a database is temporarily unavailable. When a multi-step workflow fails halfway through, it can leave your systems in a messy, inconsistent state—a digital mess that requires manual cleanup and erodes trust. What if you could build automations that are immune to this kind of chaos?
This is the core principle behind action.do, the fundamental building block for automation on the .do platform. By breaking down complex processes into single, indivisible tasks, you can build powerful agentic workflows that deliver services with unparalleled precision and reliability.
BUILDING BLOCKS FOR AUTOMATION
Think of building a complex structure with Lego bricks. Each brick is a single, complete unit. You can't use half a brick; it either fits perfectly or it doesn't.
An atomic action is the "Lego brick" of your workflow. It's the smallest, indivisible unit of work that represents a single, specific task. This could be:
The key is its "atomic" nature: the action either completes successfully or it fails entirely, instantly rolling back as if it never happened. It never leaves you in a partial state. This "all-or-nothing" guarantee is the foundation of Business-as-Code, ensuring every step in your process is predictable and dependable.
An atomic action is a definition, a blueprint for a task. To bring it to life, you need to execute it. That’s the job of action.do. It's the command center for running your predefined actions programmatically via the .do API and SDKs.
Let's look at a simple example. Imagine we have a predefined action named send-welcome-email. Here’s how you would execute it using the .do TypeScript SDK:
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');
As you can see, the process is straightforward:
While an action (action.do) is a single, granular operation, its true power is unlocked when you compose multiple actions into a complete workflow. This is where a service.do comes in.
By creating your own custom actions, you can encapsulate any business logic, external API integration, or script into a reusable, versioned, and callable unit. This makes your agentic workflows modular, easier to maintain, and infinitely scalable.
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.
Stop worrying about partial failures and inconsistent data. By embracing atomic actions with action.do, you shift your focus from managing complexity to delivering value. These reliable, API-callable units are the essential foundation for robust workflow automation and the future of Business-as-Code.
Ready to build your business logic with precision? Start defining and executing your atomic actions on the .do platform today.