In today's fast-paced digital landscape, manual, repetitive tasks are more than just a drag on productivity—they're a barrier to scale. Every minute spent copying data, sending templated emails, or running routine checks is a minute not spent on innovation. The solution isn't just automation; it's a fundamental shift in how we think about our operations. It's time to embrace "Business as Code."
This new paradigm treats your business processes with the same rigor and precision as a software development lifecycle. But to build a robust system, you need a reliable foundation. You need a primitive, a single, trustworthy unit that can be composed into something greater.
This is the power of the atomic action—the fundamental building block for every powerful agentic workflow on the .do platform.
What exactly is an atomic action?
Think of it as the smallest, indivisible unit of work in any process. It's a self-contained, executable task designed to do one thing and do it well.
In the same way that atoms combine to form molecules, atomic actions are the Lego bricks you use to construct complex, automated workflows. Each action is independent, testable, and reusable, bringing unparalleled clarity and reliability to your automations.
Theory is great, but the real power of action.do lies in its simplicity and developer-first approach. Let's transform a common business task—sending a welcome email to a new user—into a reusable atomic action.
Here’s how you can define, execute, and scale this individual, self-contained task using the .do SDK:
import { Action } from '@do-co/agent';
// Define a new atomic action to send a welcome email
const sendWelcomeEmail = new Action('send-welcome-email', {
title: 'Send Welcome Email',
description: 'Sends a standardized welcome email to a new user.',
input: {
to: { type: 'string', required: true },
name: { type: 'string', required: true },
},
async handler({ to, name }) {
console.log(`Sending email to ${to}...`);
// Actual email sending logic (e.g., using an SMTP service) would go here
const message = `Welcome to the platform, ${name}!`;
console.log(message);
return { success: true, messageId: `msg_${Date.now()}` };
},
});
// Execute the action with specific inputs
const result = await sendWelcomeEmail.run({
to: 'new.user@example.com',
name: 'Alex',
});
console.log(result);
Let's break this down:
With just a few lines of code, you've transformed a manual process into a programmable, repeatable, and scalable building block.
An atomic action is powerful, but its true potential is unlocked when it's composed into a larger sequence. Actions are the individual steps; workflows are the orchestration of those steps.
Imagine a complete user onboarding process. Instead of one giant, monolithic script, you can build an agentic workflow by combining simple, reusable actions:
This approach has massive advantages:
Q: What is an atomic action in the .do platform?
A: An atomic action is the smallest, indivisible unit of work in a workflow. It's a self-contained, executable task—like sending an email, querying a database, or calling an external API. Each action is designed to do one thing well.
Q: How are actions different from workflows?
A: Actions are the individual steps, while workflows are the orchestration of multiple actions in a specific sequence or logic. You build complex workflows by composing simple, reusable actions together.
Q: Can I create my own custom actions?
A: Absolutely. The .do SDK allows you to define custom actions with specific inputs, outputs, and business logic. This transforms your unique business operations into reusable, programmable building blocks for any workflow.
By breaking down complex processes into their smallest constituent parts, you gain the ability to build robust, scalable, and intelligent automated systems. This is the essence of "Business as Code." It's about taking the logic that runs your company and making it as transparent, versionable, and reliable as your software.
Ready to define the atomic units of your business? Start building your first atomic action and turn your operations into code.
Explore the future of agentic workflows at .do.