In the age of AI and hyper-automation, businesses are racing to streamline operations, connect disparate systems, and build intelligent, agentic workflows. However, this rush often leads to a familiar pattern: a tangled web of brittle scripts, monolithic services, and hard-to-debug processes. When something breaks, identifying the point of failure is a nightmare. Scaling the system means facing a mountain of technical debt.
What if we could treat our business processes with the same rigor and discipline as our application code? This is the promise of Business-Process-as-Code—a paradigm where your operational logic is defined, versioned, tested, and deployed just like software.
The foundation of this powerful approach isn't a massive, all-encompassing engine. It's something much smaller, more elegant, and profoundly powerful: the atomic action.
An atomic action is the smallest, indivisible unit of work in an agentic workflow. Think of it as a single, self-contained verb in your business's language: send-email, update-crm, query-api, transcribe-audio. Each action performs one specific task perfectly.
With action.do, we provide the tools to encapsulate these individual tasks into manageable, reusable, and observable building blocks. By composing these simple, powerful units, you can construct complex, robust, and scalable workflows that are transparent and easy to maintain.
You might be thinking, "This just sounds like a function call." While an action.do wraps a core function, it adds a critical layer of structure and management that transforms it into an enterprise-grade component.
Here’s what makes an action different:
Let's see how simple it is to turn a basic task into a robust atomic action using action.do. Here, we'll define an action to send a transactional email.
import { Action } from '@do-co/core';
// Define the input for our action
interface SendEmailInput {
to: string;
subject: string;
body: string;
}
// Define the output of our action
interface SendEmailOutput {
messageId: string;
status: 'sent' | 'failed';
}
// Create the action as a service
const sendEmail = new Action<SendEmailInput, SendEmailOutput>({
name: 'send-email',
description: 'Sends a transactional email.',
handler: async (input) => {
// Integration with an email provider (e.g., SendGrid, SES)
// would happen here. For this example, we'll simulate it.
console.log(`Sending email to ${input.to}...`);
const messageId = `msg_${Date.now()}`;
return {
messageId,
status: 'sent',
};
},
});
// This action can now be executed within any workflow or agent.
In this example, we've done more than just write a function. We've created a standardized, self-documenting piece of our business logic.
This send-email action is now a reliable, reusable component that can be invoked by any workflow or agent across your organization, from sending welcome emails to notifying an on-call engineer of a critical alert.
The true power of action.do is realized when you start combining actions. They are the Lego bricks for your business processes. A higher-level orchestrator, like an AI agent or a workflow engine, can now dynamically chain these actions together to accomplish complex goals.
Consider a "new customer onboarding" workflow:
Each step is a distinct, observable, and reliable atomic action. If the CRM update fails, the system can automatically retry it without affecting the other steps. Your audit log will show exactly where the process stopped and why, making diagnosis instant.
This is the essence of Business-Process-as-Code: clear, modular, and auditable automation that can scale with your business.
Q: What is an 'atomic action' in the context of .do?
A: An atomic action is the smallest, indivisible unit of work in an agentic workflow. It's a self-contained function (like sending an email or updating a CRM record) with clear inputs and outputs, designed to be reliable, reusable, and observable.
Q: How does action.do differ from a simple function call?
A: While an action.do wraps a function, it adds a structured layer of observability, error handling, retries, and standardization. This transforms a simple function into a managed, enterprise-grade component for reliable automation.
Q: Can I combine multiple actions?
A: Absolutely. The core purpose of atomic actions is to serve as building blocks. They are designed to be orchestrated by higher-level services like workflow.do or agent.do to create complex, multi-step business processes.
Q: What are some common examples of an action.do?
A: Common actions include 'send-email', 'create-support-ticket', 'update-database-record', 'query-api', 'post-to-slack', or 'transcribe-audio'. Each action is focused on performing one specific task perfectly.