In the world of modern software, our applications are no longer monolithic islands. They are complex, interconnected ecosystems that rely on a constellation of external services, APIs, and databases. From processing payments with Stripe to sending emails via SendGrid or updating records in Salesforce, these integrations are the lifeblood of our business logic. But this connectivity comes with a cost: fragility.
What happens when a single API call fails in a multi-step user onboarding process? Does the user get left in a half-registered state? Is a welcome email sent without a corresponding database record? These are the failure modes that keep developers up at night.
The solution isn't to build fewer integrations. It's to build them smarter. The key lies in breaking down complex processes into their smallest, most fundamental components: atomic actions.
An atomic action is a single, indivisible operation that either completes successfully or fails entirely, leaving no partial state behind. Think of it as an "all-or-nothing" guarantee.
Consider a simple bank transfer. The process involves two steps: debiting Account A and crediting Account B. If the system crashes after debiting Account A but before crediting Account B, the money vanishes into the ether. This is unacceptable. A bank transfer must be atomic—both steps succeed, or neither happens.
In the context of workflow automation, this principle is just as crucial. An atomic action could be:
By designing our systems around these indivisible units, we create predictable and recoverable processes. When an action fails, we know exactly what didn't happen, and there's no messy partial state to clean up.
Closely related to atomicity is the concept of idempotency. An action is idempotent if performing it multiple times with the same inputs has the exact same effect as performing it once.
Why is this a superpower for connecting to external services? Because networks are unreliable. Timeouts and transient errors are a fact of life. The standard response is to retry a failed request.
Idempotency transforms your retry logic from a potential source of disaster into a reliable tool for resilience. It is the foundation for building self-healing workflows that can withstand the temporary failures of external services.
This is precisely the philosophy behind action.do: providing a framework to Execute Atomic Actions, Flawlessly. It's the fundamental building block for your Business-as-Code, designed to make every step of your process reliable, auditable, and idempotent.
Instead of scattering fetch calls and third-party SDKs throughout your codebase, you define and execute single-purpose actions through a clean, unified API.
Here’s how simple it is to execute a pre-defined 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);
}
By abstracting the task into action.do, you gain several advantages:
An atomic action is powerful, but it's just one step. The true magic happens when you compose them into a larger business process. This is where a workflow.do comes in.
A workflow.do is a sequence or graph of atomic action.do steps, orchestrated to achieve a significant business outcome.
Take a new user onboarding workflow:
Here, action.do represents the individual steps, and workflow.do is the conductor ensuring they happen in the right order. If the Stripe action fails, the system can retry just that step without re-creating the database user or re-sending the welcome email. This granular control is the hallmark of a robust agentic workflow.
The .do platform isn't just a set of pre-built integrations. You can—and should—define your own custom actions. By wrapping your unique business logic, microservices, or even legacy functions as a custom action, you convert them into standardized, reusable, and auditable components. This allows you to integrate your own internal services into workflows with the same level of reliability and visibility as any external API.
Connecting workflows to external services will always involve uncertainty. Networks will fail, and APIs will return errors. Instead of hoping for the best, we can engineer for resilience. By breaking down our processes into atomic and idempotent units, we can build systems that are robust, auditable, and easy to debug.
action.do provides the core primitive for this modern approach to workflow automation. It allows you to focus on your business logic, confident that each step will be executed flawlessly. Start building your Business-as-Code today—one atomic action at a time.