In modern software, business logic can feel like a tangled web. It’s spread across microservices, serverless functions, and third-party APIs, making it brittle, difficult to track, and a nightmare to debug. What if you could define your business processes with the same clarity and precision as your infrastructure? This is the promise of Business-as-Code, and its foundation is the humble but powerful atomic action.
At .do, we believe that robust automation is built from the ground up. It starts with defining granular, single-responsibility tasks as powerful API endpoints using action.do. From there, you can orchestrate them into complex, resilient processes with workflow.do.
Let's break down how this powerful paradigm shift can transform your automations.
Before you can build a skyscraper, you need a brick. In workflow automation, that brick is the atomic action.
So, what is an 'atomic action'?
An atomic action is a self-contained, single-responsibility task that either completes successfully or fails entirely, without leaving the system in a partial, inconsistent state.
Think of it as the smallest indivisible unit of work in your workflow. It does one thing, and it does it well. Examples include:
By enforcing this principle of single responsibility, you gain immense benefits: reusability, testability, and clarity. When a process fails, you know exactly which "brick" failed, not just that the "wall" has a crack somewhere.
action.do provides the API to bring this concept to life. It lets you define and execute these granular tasks flawlessly, turning a piece of business logic into a reliable, callable endpoint.
Here's how simple it is to execute a predefined atomic action using the .do SDK in TypeScript:
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, we’re not just running a function; we're executing a managed, transactional business operation. The successful response doesn't just tell us it worked—it gives us a transactionId for logging, auditing, and traceability. This is the first step toward building truly robust agentic workflows.
While action.do executes a single action, its true power is realized when actions are composed into a larger workflow.do. This is where you orchestrate complex processes by sequencing these atomic building blocks.
Imagine a new user signing up for your service. This single business event triggers a sequence of actions:
By chaining these actions within a workflow.do, you create a clear, maintainable, and version-controlled representation of your business process—Business-as-Code. If the provision-initial-resources action fails, the workflow stops, and you know exactly where the problem occurred without affecting the other steps.
This is a common question. While a serverless function can execute a single piece of logic, action.do is a higher-level abstraction designed specifically for business logic within agentic workflows. It provides built-in orchestration, state management, logging, and security context that you would otherwise have to build and manage yourself on top of a generic FaaS platform.
Because actions are transactional, they are designed for resilience. If an action fails, it returns a clear error state. Within a workflow.do, this failure can trigger automated retries with exponential backoff, fire notifications to an operations team, or route the process down an alternative path. This ensures your automations are not just powerful but also robust.
True workflow automation isn't about writing giant, monolithic scripts. It's about engineering a system from reliable, independent components.
By starting with atomic, single-responsibility action.do endpoints, you create the foundation for scalable and maintainable automations. From there, workflow.do gives you the power to orchestrate these actions into sophisticated business logic that is as reliable as your code.
Ready to start building? Explore the .do platform and turn your business processes into flawless, executable code.