In the world of workflow automation, complexity is the enemy of scale. As business processes grow, simple scripts become tangled messes, and automations become brittle and prone to failure. What if you could build complex, enterprise-grade automations with the simplicity and reliability of assembling Lego bricks?
This is the core idea behind action.do, the fundamental building block for automation on the .do platform. By treating single tasks as "atomic actions," you can power sophisticated agentic workflows, embrace Business-as-Code, and deliver services with unmatched precision and reliability.
BUILDING BLOCKS FOR AUTOMATION
Think of an atomic action as the smallest, indivisible unit of work in your system. It's a single, encapsulated task—like sending an email, updating a database record, or calling an external API.
The key is the word "atomic." It means the action has only two possible outcomes:
There is no middle ground. An atomic action can't be partially completed. This "all or nothing" principle is crucial because it eliminates the risk of leaving your systems in a weird, inconsistent state. It ensures that every step in your workflow is clean, predictable, and reliable.
While an action.do is powerful, its true potential is unlocked when you compose actions into a service.do. Here’s how they relate:
This layered approach is the essence of Business-as-Code. You define granular, reusable actions and then compose them into complex, high-value services that directly represent your business logic.
Integrating these atomic actions into your applications is incredibly straightforward. The .do platform abstracts away the underlying complexity, allowing you to invoke any action with a simple API call through our SDKs.
Here’s a look at how you might execute a predefined send-welcome-email action using TypeScript:
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, you simply call the action by its unique name and provide the necessary params. The platform handles the rest—execution, logging, and error handling.
The concept of atomic actions is especially critical for the future of automation: agentic workflows. For AI agents to reliably perform business tasks, they need a toolbox of dependable functions they can call upon.
Actions on the .do platform serve as that perfect toolbox. An AI agent can decide which action needs to be executed to achieve a goal, and the platform guarantees that the action is performed correctly, reliably, and with full auditability. This gives agents the power to act on your business systems safely and effectively.
Q: What is an 'atomic action' in the context of .do?
A: 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.
Q: How do actions differ from services?
A: 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.
Q: Can I create my own custom actions?
A: 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.
Q: How are actions invoked?
A: 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.
Q: What happens when an action fails?
A: 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.