In the rapidly evolving world of automation, we're moving beyond simple scripts into the realm of agentic workflows—systems where intelligent, autonomous agents execute complex business processes. But with great power comes great complexity. How do you ensure reliability when a multi-step process, run by an AI, fails halfway through? How do you prevent duplicate charges, half-created user accounts, or a cascade of errors?
The answer isn't to build more complex monitors. It's to think smaller. Much smaller.
The solution lies in building with atomic actions: single, indivisible units of work. This is the core philosophy behind action.do, the fundamental building block for your Business-as-Code.
At its heart, action.do is designed to do one thing perfectly: execute a single, auditable, and reliable task. By composing your large-scale processes from these simple, single-purpose actions, you can build incredibly robust and resilient workflows.
An atomic action is a single, indivisible operation that either completes successfully or fails entirely, leaving no partial state.
Think of a bank transfer. It’s not two separate steps ("subtract money from Account A," then "add money to Account B"). It’s a single transaction. If the second step fails, the entire operation is rolled back as if it never happened. You're never left in a state where money has vanished from one account but hasn't appeared in the other.
This all-or-nothing principle is what makes atomic actions so powerful in workflow automation. They eliminate the risk of inconsistent states and the chaos of partial failures. Examples include:
action.do provides a simple, elegant API to define and execute these atomic actions within any application or agentic workflow. It's designed around a simple mantra: Execute. Audit. Repeat.
Here’s how easy it is to execute a predefined action, like sending a welcome email, 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 wrapping your tasks in this structure, you gain three critical superpowers for your workflows.
With action.do, every task invocation is atomic. The action send-welcome-email either succeeds completely, or it fails cleanly, reporting an error. There is no in-between state. This simple guarantee is the foundation of a reliable system.
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 resilient systems that can recover from network glitches or temporary outages. If your workflow runner isn't sure an action completed, it can safely retry it. With idempotency, you can be confident you won’t accidentally send a customer five welcome emails or charge their credit card multiple times for the same purchase. action.do helps you build idempotent actions to prevent these costly mistakes.
Because every task is an explicit, named action.do call, you get a perfect, centralized audit trail for free. For any workflow, you can see:
This level of insight is invaluable for debugging, compliance, and understanding exactly what your autonomous agents are doing.
So, if action.do is for single steps, how do you handle complex business processes like user onboarding?
That's where workflow.do comes in. A workflow.do is a sequence or graph of atomic action.do calls, orchestrated to achieve a larger business outcome.
A workflow.do for "New User Onboarding" might look like this:
action.do provides the reliable, lego-like bricks, and workflow.do provides the instructions to build them into something meaningful. By separating the what (the action) from the how (the workflow), you create a more modular, maintainable, and robust system.
The best part? You're not limited to a pre-built library of actions. The .do platform allows you to define your own custom actions from your existing code. You can wrap a microservice endpoint or a serverless function and register it as a named action.
This powerful feature allows you to turn your existing business logic into standardized, reusable, auditable components that any agent or workflow in your organization can leverage securely.
As agentic workflows become more prevalent, the need for reliability, auditability, and resilience is no longer a luxury—it's a requirement. Building on a foundation of atomic actions is the most effective way to meet that need.
action.do gives you the simple, powerful primitive to execute, audit, and repeat these actions flawlessly, paving the way for the next generation of business automation.
What constitutes an 'atomic action'?
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.
Why is idempotency important for actions?
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.
How does action.do relate to a workflow.do?
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.
Can I define my own custom 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.