In the world of automation, we often find ourselves wrestling with complex, monolithic scripts. They start simple, but as business logic grows, they become tangled, fragile, and difficult to maintain. A small change in one part can unexpectedly break another. What if we could build powerful automations not from tangled scripts, but from simple, solid, reusable building blocks?
This is the promise of agentic workflows built on the .do platform, and it all starts with a single, powerful concept: the atomic action.
An atomic action is the fundamental building block of work. It’s a self-contained, indivisible, and programmable task designed to do one thing exceptionally well. Think of it as the atom in the molecule of your business process.
Welcome to the atomic unit of work. Let's break it down.
Drawing from physics, "atomic" means indivisible. In the context of action.do, an atomic action is the smallest possible unit of a workflow that still performs a meaningful function. It's not a line of code; it's a complete, executable task.
Consider these examples:
Each of these is a discrete task. It takes a defined set of inputs and produces a predictable output. This is the core of an atomic action: a black box that reliably performs its designated job.
If actions are the LEGO bricks, then workflows are the castles you build with them. An agentic workflow is the orchestration of multiple atomic actions to accomplish a complex business goal.
The beauty of this model is its modularity. Need to change how you send emails? You only update the send-welcome-email action, and every workflow that uses it is instantly upgraded. This "business as code" approach makes your systems more robust, scalable, and dramatically easier to maintain.
Theory is great, but let's see how simple it is to define and execute an atomic action using the .do SDK. Here, we'll transform the business process of "sending a welcome email" into a reusable, programmable asset.
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 quickly break this down:
You’ve just codified a business process into a discrete, testable, and reusable component that can be plugged into any workflow.
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 shifting your mindset from monolithic scripts to a library of atomic actions, you unlock a new level of power and flexibility in your task automation. You build systems that are not only more resilient but also faster to develop and easier to understand.
Ready to build your first atomic action? The future of agentic workflows is composed of simple, powerful parts. Start building yours on the .do platform today.