In the world of software development and automation, complexity is the enemy. Monolithic services and tangled scripts are hard to build, difficult to debug, and nearly impossible to scale reliably. We dream of creating powerful, automated services, but the reality is often a web of dependencies and brittle logic. What if we could deconstruct this complexity? What if we could break down any large-scale business service into its fundamental, indivisible parts?
This is the philosophy behind action.do—the ultimate building block of automation. An action.do represents a single, executable step. By chaining these simple, powerful actions together as code, you can build sophisticated, automated services and deliver true Services-as-Software.
At the core of action.do is the concept of an atomic action. Think of it like a Lego brick. It's a single, self-contained unit that performs one job and does it well. In the context of workflow automation, an atomic action is the smallest, indivisible unit of work.
This could be:
By keeping actions atomic, you gain three incredible advantages:
The .do SDK makes defining these building blocks incredibly intuitive. Instead of abstract concepts, you work with clear, declarative code. Here’s how you would define an atomic action to send a welcome email using TypeScript.
import { action } from '@do-sdk/core';
// Define an action to send a welcome email
const sendWelcomeEmail = action.create({
id: 'send-welcome-email',
description: 'Sends a welcome email to a new user.',
execute: async ({ email, name }) => {
// Your email sending logic via an external API
console.log(`Sending welcome email to ${name} at ${email}...`);
return { success: true, messageId: 'xyz-123' };
}
});
// Execute the action
const result = await sendWelcomeEmail.execute({
email: 'jane.doe@example.com',
name: 'Jane Doe'
});
In this example, sendWelcomeEmail is a perfect atomic action. It takes an email and name as input, performs a single task (logging a message, which in a real-world scenario would be an API call), and returns a predictable result. This is task execution simplified.
So, if an action.do is a single step, how do we accomplish larger business goals? This is where workflow.do comes in. A workflow orchestrates multiple actions to achieve a broader outcome.
Imagine a "New User Onboarding" workflow. It's not a single task; it's a sequence of them. Using our atomic blocks, it might look like this:
Each step is a simple, reusable action.do. The workflow.do is the blueprint that chains them together, passing data from one step to the next. This compositional approach allows you to build incredibly complex and valuable automations without writing complex code. You're simply arranging the Lego bricks.
A critical feature of action.do is that actions are stateless. They don't remember anything about past executions. They receive input, perform their task, and produce output. That's it.
This isn't a limitation; it's a superpower. State is managed at the workflow level, which means your actions are:
This architecture is the foundation for turning your business logic into code (business as code) that is robust, maintainable, and ready for the future.
Q: What is an 'atomic action' in the context of .do?
A: An atomic action is the smallest, indivisible unit of work in a workflow. It performs a single, specific task, like 'send an email' or 'update a database record', ensuring that operations are reliable, testable, and easy to debug.
Q: How does an action.do differ from a workflow.do?
A: An action.do represents a single step, while a workflow.do orchestrates multiple actions to achieve a larger business outcome. You build powerful workflows by composing a series of simple actions.
Q: Can I create my own custom actions?
A: Yes. The .do platform is designed for extensibility. You can define your own custom actions using our SDK, encapsulating your specific business logic and integrating any third-party API to make them available in any workflow.
Q: Are actions stateful?
A: No, actions are stateless by design. They receive input, perform their task, and produce output without retaining memory of previous executions. State management is handled at the workflow level, ensuring actions are reusable and predictable.