In the rapidly evolving world of automation, "agentic workflows" are the new frontier. We're moving beyond simple, linear automations to intelligent, dynamic AI agents that can reason, plan, and execute complex tasks. But with great power comes a great challenge: how do you build these sophisticated agents to be reliable, scalable, and easy to manage?
The answer isn't to build bigger, more monolithic systems. Instead, it's to think smaller. Much smaller.
Enter the atomic action—the fundamental building block of every powerful agentic workflow on the .do platform. It's the atomic unit of work, and it's the key to unlocking your AI's true potential.
Imagine building a complex machine. You wouldn't start by melting down a huge block of iron. You'd start with individual, well-defined components: screws, gears, levers, and circuits. Each component does one thing, and it does it perfectly.
That's precisely what an atomic action is in an agentic workflow.
An atomic action is the smallest, indivisible unit of work. It's a self-contained, executable task designed to do one thing well—like sending an email, querying a database, or calling an external API.
Instead of writing a single, massive script that handles user onboarding from start to finish, you break it down into atomic actions:
Each action is independent, testable, and, most importantly, reusable.
Adopting an action-oriented mindset isn't just about clean code; it's about building fundamentally better systems. Here’s why atomic actions are the perfect tools for AI agents.
Define an action once, and use it everywhere. The send-welcome-email action you build for your main user onboarding workflow can be reused by a marketing agent for a newsletter campaign or by a support agent for a follow-up sequence. This "Define Once, Run Anywhere" principle is the core of our philosophy: Execute. Automate. Scale. You stop reinventing the wheel and start building with a trusted set of components.
When a 500-line script fails, where do you even begin to look? When a workflow built from atomic actions fails, you know exactly which step broke. If a new user didn't get their welcome email, you can isolate the send-welcome-email action, check its inputs, and review its logs. This granular visibility turns hours of frustrating debugging into minutes of targeted problem-solving.
This is where it gets truly exciting for AI. By providing an agent with a toolkit of well-defined atomic actions, you're not just giving it instructions; you're giving it capabilities. The agent can then intelligently choose, sequence, and compose these actions on the fly to accomplish a goal.
Need to handle a new support ticket? The agent can:
This transforms your automation from a rigid script into a dynamic, thinking process.
Theory is great, but implementation is what matters. With the .do TypeScript SDK, defining your unique business operations as programmable building blocks is incredibly straightforward.
Let's look at我们的sendWelcomeEmail action:
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:
You've just turned a business process into a discrete, testable, and reusable piece of code. This is Business as Code.
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.
As AI agents become more prevalent, the ability to build, manage, and scale their capabilities will be the defining factor for success. Monolithic, fragile scripts won't survive in this new world.
The future of automation is composable. It's built on a foundation of discrete, reliable, and intelligent atomic actions. By breaking down your operations into these fundamental units of work, you're not just creating automations; you're building a powerful, flexible, and scalable "operating system" for your business.
Ready to build your first atomic action? Dive into the .do platform and start defining the building blocks of your next agentic workflow.