In the world of software development, we chase reliability. We build intricate systems, complex automations, and now, increasingly sophisticated agentic workflows. But as complexity grows, so does fragility. A single failure point in a long chain of operations can bring an entire process crashing down, leaving systems in a confusing, partially completed state. What if we could build our workflows from indestructible, single-purpose building blocks?
This is the core principle behind action.do — a powerful API for defining and executing atomic, single-responsibility actions. It’s about taming complexity, not by avoiding it, but by composing it from fundamentally reliable parts. It’s about building flawless Business-as-Code.
At its heart, an atomic action is a task that adheres to a simple, powerful guarantee: it either completes successfully, or it fails entirely. There is no in-between.
Think of it like a database transaction. You wouldn't want to transfer money from one account to another and only have the "debit" part succeed. The entire operation—debit and credit—must succeed or fail as a single unit. An atomic action applies this same all-or-nothing principle to any business task.
Examples of atomic actions include:
By adopting the philosophy of the Single Responsibility Principle, each action is designed to do one thing and do it well. This makes your workflows clearer, easier to debug, and infinitely more reusable.
Talk is one thing, but code speaks volumes. action.do makes executing these powerful, granular tasks incredibly simple. Using the SDK, you can define and run an action with just a few lines of code.
Here’s how you would execute a send-welcome-email action:
import { Dō } from '@do-sdk/core';
const dō = new Dō({ apiKey: 'YOUR_API_KEY' });
// Define and execute a single, atomic action
const result = await dō.action.execute({
name: 'send-welcome-email',
input: {
userId: 'user-12345',
template: 'new-user-welcome',
},
});
console.log(result);
// { success: true, transactionId: 'txn_abc_123' }
In this example, the seemingly simple dō.action.execute call abstracts away all the underlying complexity. You don't need to manage SMTP connections, render email templates, or implement logging. You simply declare what you want to do (send-welcome-email) and provide the necessary data. action.do handles the execution, ensuring it either succeeds and returns a transaction ID or fails cleanly with a descriptive error.
"Isn't this just a serverless function?" It's a fair question. While both execute code on demand, action.do is a higher-level abstraction designed specifically for the context of business and agentic workflows.
A serverless function provides the raw compute, but you are still responsible for the "glue" that makes it useful in a business process:
action.do provides this critical "glue" out of the box. It’s not just about running a piece of code; it's about executing a business-aware task within a larger, managed ecosystem.
The power of action.do isn't just in executing a single task, but in its composability. These atomic actions are the fundamental building blocks for creating sophisticated, resilient services.
While action.do executes a single action, it's designed to be a core component within a larger workflow.do. You can chain these atomic actions together to orchestrate complex processes like user onboarding:
Because each step is atomic, the entire workflow becomes incredibly robust. If the provision-initial-data action fails, the system knows exactly where the process stopped. The user account has been created and the email sent, but nothing further. There's no partial state to clean up. The transactional integrity of action.do allows you to retry the failed step or trigger an alert with confidence, knowing exactly what has and has not been done.
By breaking down complex automations into a series of atomic actions, you build systems that are not only more reliable but also easier to understand, maintain, and scale. You transform brittle scripts into robust, executable business logic.
Ready to build your automations on a foundation of certainty? Get started with action.do and see how atomic actions can revolutionize your agentic workflows.
Q: What is an 'atomic action' in the context of .do?
A: An atomic action is a self-contained, single-responsibility task that either completes successfully or fails entirely, without partial states. Think of it as the smallest indivisible unit of work in your workflow, like 'send-email', 'create-user', or 'charge-card'.
Q: How is action.do different from a serverless function?
A: While similar, action.do is designed specifically for agentic workflows. It provides built-in orchestration, state management, logging, and security context that serverless functions require you to build and manage yourself. It's a higher-level abstraction for business logic.
Q: Can actions be chained together?
A: Absolutely. While action.do executes a single action, it's designed to be a fundamental building block within a larger workflow.do. You compose complex processes by sequencing these atomic actions to create robust Services-as-Software.
Q: What kind of error handling does action.do support?
A: Actions are designed for transactional integrity. If an action fails, it returns a clear error state and can trigger automated retries, notifications, or alternative workflow paths, ensuring your automations are robust and resilient.