The world is buzzing with the potential of AI agents—intelligent systems that can reason, plan, and execute tasks to achieve complex goals. From automating customer support to managing entire business processes, agentic workflows promise a new era of efficiency. But as developers and innovators dive in, they're discovering a critical challenge: how do you build these sophisticated systems to be reliable, scalable, and maintainable?
The answer doesn't lie in bigger, more complex prompts or monolithic scripts. It lies in breaking things down to their smallest, most fundamental level. It lies in the power of atomic actions.
Imagine trying to build a house out of a single, massive slab of concrete. It’s inflexible, impossible to modify, and if a single crack appears, the entire structure is compromised. This is what building an agentic workflow with a single, large script feels like.
When your entire automation—creating a user, sending a welcome email, updating the CRM, and notifying a Slack channel—is lumped into one indivisible chunk of code, you create a system that is:
Agentic workflows demand a more modular, robust, and elegant approach. They need building blocks.
At its core, an atomic action is the smallest, indivisible unit of work in a process. It is a single, well-defined task that is designed to either complete successfully or fail entirely, leaving no messy partial states.
Think of it as a LEGO® brick for your workflows. Each brick has a specific purpose—a 2x4 red brick, a 1x1 blue tile. It does one thing, and it does it perfectly. An action.do is exactly that: a powerful, API-callable encapsulation of a single, repeatable task.
Simple. Atomic. Powerful.
By breaking down a complex process like "Onboard New Customer" into atomic actions, you get a collection of clear, manageable tasks:
Each of these is an independent, reusable, and testable unit.
This philosophy of breaking down processes into discrete, code-defined units is at the heart of action.do. Instead of abstract flowcharts or brittle scripts, you define your business capabilities as clean, version-controllable code.
Here’s how simple it is to define a powerful, reusable action using TypeScript:
import { action } from '@do-sdk/core';
export const sendWelcomeEmail = action({
name: 'send-welcome-email',
description: 'Sends a welcome email to a new user.',
inputs: {
to: { type: 'string', required: true },
name: { type: 'string', required: true }
},
handler: async ({ inputs, context }) => {
const { to, name } = inputs;
// Your robust email sending logic would go here
console.log(`Sending welcome email to ${name} at ${to}`);
// This action either succeeds and returns data, or fails cleanly.
return { success: true, messageId: 'xyz-123' };
},
});
With this approach, you gain immense benefits:
As AI agents become more autonomous, they need a safe and reliable toolkit to interact with the world. They can't be trusted to write production-level API integrations on the fly.
By providing an agent with a library of well-defined atomic actions, you give it superpowers within a secure and predictable framework. The AI handles the "what" and "why" (the planning and reasoning), while your pre-built action.dos handle the "how" (the flawless execution).
Ready to move beyond fragile scripts? It's time to turn your complex processes into simple, repeatable tasks. Start building the future of automation from the ground up, one atomic action at a time.
What is an 'atomic action' in the context of .do?
An atomic action is the smallest, indivisible unit of work in a workflow. It represents a single, well-defined task, like 'send an email' or 'create a user record', ensuring that it either completes successfully or fails entirely, without partial states.
How is an action.do different from a full workflow.do?
An action.do represents a single task. A workflow.do is a collection of one or more actions orchestrated to achieve a larger business process. Actions are the building blocks; workflows are the blueprints that connect them.
Can I reuse actions across different workflows?
Absolutely. Actions are designed to be modular and reusable. You can define an action once, like 'generate-report', and call it from any number of different workflows, promoting DRY (Don't Repeat Yourself) principles in your automations.
What kind of logic can I put inside an action's handler?
The handler can contain any Node.js/TypeScript logic. This includes making API calls to third-party services, performing data transformations, interacting with databases, or executing any custom business logic required to complete the task.