In the world of workflow automation, complexity is the enemy. As our automations and agentic workflows grow, they often become tangled webs of logic—fragile, difficult to debug, and nearly impossible to maintain. A single failure point can bring an entire process crashing down. What if we could build our automations not as monolithic scripts, but as a series of robust, independent, and reusable steps?
This is the principle behind atomic actions, and it's the core philosophy of action.do.
action.do helps you define granular, single-responsibility tasks as powerful API endpoints. It’s about taking your complex processes and breaking them down into their smallest, most fundamental units of work. The result? Robust, scalable, and maintainable agentic workflows that just work.
Think about a standard user onboarding automation. A single script might be responsible for:
What happens if the mailing list API is down? In a monolithic script, the entire process might halt, leaving the user in a broken state—created in the database but without an email or a license. Debugging this requires sifting through logs to find where the chain broke. Reusing the "send a welcome email" logic in another workflow means copy-pasting code, a recipe for future headaches.
This approach isn't scalable. It’s not reliable. It's not the future of Business-as-Code.
An atomic action is a self-contained, single-responsibility task. It operates on a simple, powerful principle: it either completes successfully, or it fails entirely, leaving no messy partial states. It’s the smallest indivisible unit of work in your workflow.
By embracing this model, you gain incredible benefits:
action.do is the engine designed to bring the power of atomic actions to your agentic workflows. It provides a simple yet powerful API to define, execute, and monitor these granular tasks.
Let's see how easy it is to execute an action. Using the @do-sdk/core, you can trigger any pre-defined action with a simple call:
import { Dō } from '@do-sdk/core';
const dō = new Dō({ apiKey: 'YOUR_API_KEY' });
// Define and execute a single, atomic action
const result = await dō.action.execute({
name: 'send-welcome-email',
input: {
userId: 'user-12345',
template: 'new-user-welcome',
},
});
console.log(result);
// { success: true, transactionId: 'txn_abc_123' }
In this example, we’re not embedding the email logic directly into our application code. Instead, we're calling a named action, send-welcome-email, and providing the necessary input. action.do handles the execution, logging, and state management, returning a clear success or failure. This separation of concerns is the key to building clean and robust systems.
While action.do is focused on executing a single atomic action, it's designed as a fundamental building block. Complex processes are created by sequencing these actions within a larger workflow orchestrator, like workflow.do.
Think of it like LEGOs:
This compositional approach allows you to BUILD, EXECUTE, and AUTOMATE with unprecedented flexibility and reliability.
Q: What is an 'atomic action' in the context of .do?
A: An atomic action is a self-contained, single-responsibility task that either completes successfully or fails entirely, without partial states. Think of it as the smallest indivisible unit of work in your workflow, like 'send-email', 'create-user', or 'charge-card'.
Q: How is action.do different from a serverless function?
A: While similar, action.do is designed specifically for agentic workflows. It provides built-in orchestration, state management, logging, and security context that serverless functions require you to build and manage yourself. It's a higher-level abstraction for business logic.
Q: Can actions be chained together?
A: Absolutely. While action.do executes a single action, it's designed to be a fundamental building block within a larger workflow.do. You compose complex processes by sequencing these atomic actions to create robust Services-as-Software.
Q: What kind of error handling does action.do support?
A: Actions are designed for transactional integrity. If an action fails, it returns a clear error state and can trigger automated retries, notifications, or alternative workflow paths, ensuring your automations are robust and resilient.