In the ever-evolving landscape of software architecture, we've witnessed a seismic shift from monolithic applications to microservices. This move towards decentralization promised greater scalability, flexibility, and independent deployments. But what if we could push that granularity even further? What if the fundamental unit of our business logic wasn't a service, but a single, atomic action?
This is the next frontier in building robust, reliable systems, especially in the world of agentic workflows and Business-as-Code. It's about breaking down complex processes into their smallest, indivisible parts to achieve flawless execution.
Traditional workflow automation often involves complex scripts or monolithic services that handle multiple steps of a business process. While this works, it introduces significant fragility:
We need a better building block.
An atomic action is a single, indivisible operation that either completes successfully or fails entirely, leaving no partial state. Think of it as a transaction in a database, but for any business operation.
Good examples of atomic actions include:
By isolating these tasks, we lay the groundwork for a system that is inherently more reliable and easier to manage.
This is precisely the philosophy behind action.do. It provides a dedicated API and infrastructure to define and execute single-purpose actions as the fundamental building blocks for your Business-as-Code.
Instead of bundling logic, you define distinct actions and call them when needed. Here’s how simple it is to execute a predefined send-welcome-email action using the .do SDK:
import { Do } from '@do-sdk/core';
// Initialize the .do client with your API key
const a = new Do(process.env.DO_API_KEY);
// Execute a specific, atomic action with parameters
const { result, error } = await a.action.execute({
name: 'send-welcome-email',
params: {
userId: 'usr_12345',
template: 'new-user-welcome-v2'
}
});
if (error) {
console.error('Action failed:', error);
} else {
console.log('Action Succeeded:', result);
}
This approach transforms your system design by embracing three core principles: Execute. Audit. Repeat.
Each call to action.do is a self-contained unit. It either fully succeeds or it fails. There's no in-between. This eliminates the risk of partial state changes, ensuring your system's integrity is never compromised by a failed operation.
Because every execution is a distinct API call, you get a clean, granular audit trail for free. You can see exactly which action was called, with what parameters, at what time, and whether it succeeded or failed. Debugging complex agentic workflows goes from being an art to a science.
action.do encourages and facilitates idempotency. Idempotency ensures that executing the same action multiple times with the same parameters has the same effect as executing it once. This is a superpower for workflow automation. If a network blip causes a failure, your system can safely retry the action without fear of sending duplicate invoices or creating duplicate user accounts.
Atomic actions are the "Lego bricks" of your system. They are powerful on their own, but their true potential is unlocked when you start composing them into larger processes. This is where workflow.do comes in.
A workflow.do is a sequence or graph of atomic actions orchestrated to achieve a larger business outcome.
By building workflows from auditable, idempotent atomic actions, you create complex business processes that are transparent, resilient, and easy to maintain. This is the essence of building true Business-as-Code.
An atomic action is a single, indivisible operation that either completes successfully or fails entirely, leaving no partial state. Examples include sending a single email, making one API call, or writing a single record to a database.
Idempotency ensures that executing the same action multiple times with the same parameters has the same effect as executing it once. This is crucial for building reliable systems that can recover from failures without causing unintended side effects, like sending duplicate invoices.
action.do represents the individual steps or building blocks. A workflow.do is a sequence or graph of these actions orchestrated to achieve a larger business outcome. You compose workflows from one or more atomic actions.
Yes. The .do platform allows you to define your own custom actions as functions or microservices, which can then be invoked via the action.do API. This turns your existing business logic into reusable, auditable components.