In the world of software development and operations, we've all seen it: the sprawling folder of automation scripts. That collection of Python, Bash, or PowerShell files that started as a quick fix but has since ballooned into a critical, yet fragile, piece of infrastructure. These scripts are often undocumented, hard to debug, and terrifying to modify. When they fail halfway through, they leave systems in a corrupted, indeterminate state.
This isn't sustainable. The future of automation isn't about writing more complex scripts; it's about defining resilient, reusable business processes as code. This paradigm shift requires a new fundamental building block—one that is reliable, auditable, and composable. Enter the atomic action.
On the .do platform, we empower you to move beyond fragile scripts and build robust, agentic workflows with action.do.
BUILDING BLOCKS FOR AUTOMATION
Traditional automation scripts are imperative; they are a sequence of "how-to" steps. This approach has several inherent weaknesses:
An atomic action is the smallest, indivisible unit of work within a workflow. Think of it like a database transaction: it represents a single, specific task that either completes successfully or fails entirely, rolling back to its original state. There is no in-between.
This atomicity is the key to building reliable systems. At .do, we've made this concept a first-class citizen. action.do allows you to define and execute these granular operations as API-callable units.
Instead of a script that does three things, you define three distinct actions:
Each action is a self-contained, versioned, and testable unit of business logic. It's no longer a fragile script; it's a well-defined component in your Business-as-Code repository.
Executing a predefined action is designed to be simple and language-agnostic. By invoking an action via its name, you decouple the "what" from the "how". Your application doesn't need to know the implementation details of sending an email; it just needs to call the send-welcome-email action.
Here’s how you would execute an action 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');
Let's break this down:
This approach transforms complex operations into a single, reliable API call. This is the foundation for building higher-level automations, agentic workflows, and complex business services.
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.
It's time to elevate your automation strategy. Stop wrestling with brittle, monolithic scripts and start defining your operations as a collection of robust, atomic actions. By embracing Business-as-Code, you create a system that is more reliable, scalable, and easier to maintain.
With action.do, you have the power to build complex agentic workflows and deliver services with precision. Define your building blocks, compose your workflows, and execute with confidence.