In the world of automation and software, we often think in terms of large, monolithic scripts or complex functions. A single script might onboard a user, send them an email, provision a database, and update a CRM. While functional, this approach is often brittle, hard to maintain, and nearly impossible to reuse. What if we could break these massive processes down to their fundamental components?
This is the philosophy behind action.do and the concept of the atomic action—the true atomic unit of work. An atomic action is a single, self-contained, and indivisible task. It's designed to do one thing, and do it exceptionally well. The real power, however, doesn't lie in executing a single action, but in orchestrating these simple, powerful building blocks to create robust and scalable agentic workflows.
Think of an action as a programmable tool in your toolkit. Instead of a generic function call, an action is a formal definition of a business task. It has a clear name, a description, defined inputs, and a predictable output.
Let's look at how you define an atomic action on the .do platform. Here’s a simple example for creating a send-welcome-email action using TypeScript:
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:
By codifying this small piece of business logic, we've created a reusable, testable, and scalable component. This is "business as code."
An atomic action is powerful on its own, but its true potential is unlocked when you compose multiple actions into a workflow. As our FAQ states, actions are the individual steps, while workflows are the orchestration of those steps.
Imagine your user onboarding process. Instead of one giant script, you can define it as a workflow composed of several atomic actions:
A workflow engine can now orchestrate these actions:
This approach offers immense benefits:
This is where the future of automation lies. An "agent" is an autonomous system that can plan and execute tasks to achieve a goal. To do this, it needs a reliable toolbox. Atomic actions are that toolbox.
An AI agent armed with a library of well-defined actions can dynamically construct workflows on the fly. You can give it a high-level goal like, "Onboard the new client 'MegaCorp' with ten enterprise seats."
The agent can then:
This transforms your static automations into dynamic, intelligent systems that can adapt and respond to complex, high-level commands.
Execute. Automate. Scale. It all starts with the atomic action—the fundamental building block for every powerful agentic 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.