In the world of workflow automation and agentic systems, reliability is not a feature—it's the foundation. Every developer who has built a complex business process knows the pain of a workflow failing halfway through, leaving data in an inconsistent state. Did the payment go through but the confirmation email fail? Was the user created in the database but not in the CRM? These partial failures create technical debt and erode user trust.
The solution lies in decomposing complex processes into their smallest, most fundamental parts. We need a way to execute single, indivisible tasks with absolute certainty. This is the principle behind action.do: a platform for executing atomic actions flawlessly.
But before you can execute an action, you must first define it. This is where your custom code becomes a powerful, reusable component. Let's explore how you can go from a simple function to a managed, atomic action within the .do ecosystem.
Modern applications are a mesh of internal services and third-party APIs. A single "new user onboarding" workflow might involve:
If any one of these steps fails, what happens? Without careful, complex error handling, you risk chaos. A network glitch could prevent the Stripe call, leaving you with a user in your database who can't pay. Even worse, if a retry mechanism isn't idempotent, you might accidentally send a dozen welcome emails to the same confused user.
This is where the concept of atomic actions becomes a game-changer.
An atomic action is a single, indivisible operation that either completes successfully or fails entirely, leaving no partial state. It's the building block for reliable Business-as-Code.
With action.do, you don't just run a script; you execute a managed task with built-in guarantees:
Execute. Audit. Repeat. It’s that simple.
Executing an action is as simple as making an API call. The .do SDK makes this trivial. Here’s how you would execute a pre-defined send-welcome-email action using TypeScript:
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);
}
In this example, we’re not just calling a function. We are instructing the .do platform to perform a specific, named action with a set of parameters. The platform handles the underlying execution, logging, and error management, returning a clear success or failure state.
This is where your business logic comes to life. While action.do is the engine for executing tasks, function.do is the factory for defining them.
The .do platform allows you to deploy your own code—as simple functions or entire microservices—and register them as named actions. A Node.js function that validates a user's address, a Python script that generates a report, or a Go program that interfaces with a legacy system can all be transformed into reusable, atomic actions.
This process turns your isolated business logic into discoverable, auditable, and robust components that anyone in your organization can use to build powerful workflows. You write the code once, deploy it as a function.do, and execute it countless times as an action.do.
It's important to understand the hierarchy.
You compose robust, complex workflows from simple, single-purpose actions. This separation of concerns makes your system easier to build, debug, and maintain.
Stop wrestling with brittle scripts and inconsistent states. By embracing atomic actions, you shift from writing code that simply runs to building business processes that are fundamentally reliable.
function.do allows you to package your unique business logic into manageable units, and action.do gives you the power to execute them with confidence. It's the most robust way to turn your code into meaningful, repeatable business outcomes.
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.