In the world of workflow automation and "Business as Code," complexity is the enemy. As we build sophisticated agentic workflows to handle everything from user onboarding to financial reconciliation, a single point of failure can bring the entire process to a halt. How do you debug a workflow that's half-finished? What happens when a crucial step is accidentally run twice?
The answer lies in breaking down complexity into its smallest, most fundamental component: the atomic action.
This is the philosophy behind action.do. It's a tool designed to do one thing perfectly: execute single, atomic actions within your agentic workflows. It provides a reliable, auditable, and idempotent way to perform tasks, transforming fragile scripts into robust, enterprise-grade processes.
At its core, action.do is about building robust systems by composing them from simple, single-purpose actions. It’s the foundational building block for your Business-as-Code, enabling you to Execute. Audit. Repeat.
Instead of monolithic scripts, imagine a workflow as a series of distinct, manageable steps. Need to send a welcome email? That's one action. Need to create a user in your database? That's another.
Here’s how simple it is to execute a specific, pre-defined action using the .do TypeScript 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 clean, declarative approach is the starting point for building truly dependable automation.
Before we go further, let's clarify what we mean by "atomic."
An atomic action is a single, indivisible operation that either completes successfully or fails entirely, leaving no partial state.
Think of it like a database transaction. You wouldn't want to withdraw money from one account without depositing it in another. The entire operation must succeed or fail as a single unit. In workflow automation, this principle is just as critical.
Examples of atomic actions include:
By defining tasks at this granular level, you drastically simplify error handling and debugging. There's no "in-between" state to worry about. An action either worked or it didn't.
One of the most powerful features action.do enforces is idempotency.
Idempotency ensures that executing the same action multiple times with the same parameters has the exact same effect as executing it once.
Why is this so important? In any distributed system, network glitches, timeouts, and server restarts are a fact of life. A client might send a request but never receive the response, leading it to retry. Without idempotency, this could lead to disaster:
action.do solves this by design. When you execute an action, you can be confident that retrying upon failure won't cause unintended side effects. This makes your workflows resilient and capable of self-healing without manual intervention.
If action.do represents the individual Lego bricks, workflow.do is the blueprint for the entire castle. You compose complex business processes by sequencing these atomic actions.
A workflow.do is simply a sequence or graph of action.do calls orchestrated to achieve a larger business outcome.
Consider a new user signup process:
Each step is an atomic, auditable, and idempotent action.do execution. If step 3 fails, it can be retried safely. If the entire workflow is interrupted, you know exactly which actions completed and which one to restart. The workflow engine orchestrates these steps, handling the logic, branching, and error propagation, while action.do guarantees each step is executed flawlessly.
Q: What constitutes an 'atomic action'?
A: 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.
Q: Why is idempotency important for actions?
A: 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.
Q: How does action.do relate to a workflow.do?
A: 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.
Q: Can I define my own custom actions?
A: 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.