In the world of software development, we've established powerful principles for building reliable systems: version control, modularity, testing, and the single responsibility principle. We treat our application code with discipline because we know it's the foundation of our product. But what about our business processes?
Too often, critical business workflows—customer onboarding, order fulfillment, invoicing—are trapped in brittle scripts, opaque third-party UIs, or a tangled web of microservices. They are difficult to version, impossible to test reliably, and a nightmare to update.
What if we applied the same rigor we use for software development to our business operations? This is the philosophy of Business-as-Code, and it's the core principle behind the .do platform.
Business-as-Code is a paradigm that treats your business logic and workflows as first-class citizens of your codebase. Instead of being abstract concepts or diagrams on a whiteboard, your processes become version-controlled, composable, and testable modules of code.
This approach transforms operations from a fragile black box into a transparent, agile, and scalable system. It means your "business logic" isn't just a description; it's a tangible, executable asset.
The fundamental building block in the Business-as-Code universe is the atomic action.
An atomic action is a self-contained, single-responsibility task that is guaranteed to either complete successfully or fail entirely, leaving no messy partial states. It's the smallest indivisible unit of work in your workflow.
Think of actions like:
Each action does one thing and does it well. This is the Single Responsibility Principle applied to your business processes. By defining these granular tasks as powerful API endpoints with action.do, you gain incredible leverage.
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' }
When you execute 'send-welcome-email', you don't need to worry about the SMTP configuration, the template rendering engine, or the retry logic. You simply declare your intent, and the action handles the execution flawlessly. The result is a clear success or failure, complete with a transaction ID for perfect auditability.
While action.do focuses on executing a single action perfectly, its true power is realized when these actions are composed into larger sequences. This is where you build robust, scalable, and maintainable automations.
Imagine a new user signup process:
Instead of one giant, monolithic script, you compose a workflow from four distinct, reusable, and independently testable atomic actions. Need to change your CRM provider? You only update the add-to-crm action. The rest of the workflow remains untouched, stable, and reliable. This is how you build true Services-as-Software.
This philosophy is not just about organizing code; it's about preparing for the future of automation: agentic workflows. AI agents need a reliable set of tools to interact with the world. They can't work with fragile, undocumented internal APIs or complex, multi-step processes.
By defining your business capabilities as a library of atomic actions, you are creating the perfect tool-belt for an AI agent. The agent can intelligently decide which action to execute—charge-card, issue-refund, escalate-ticket—based on its goal, and action.do guarantees the transactional integrity of that execution.
BUILD, EXECUTE, AUTOMATE. This isn't just a tagline; it's the cycle of modern business operations. You build atomic actions, an agent executes them, and you automate your entire business as a result.
The philosophy of Business-as-Code is about bringing clarity, reliability, and agility to the core of your operations. By embracing atomic actions, you're not just writing better code—you're building a better business.
What is an 'atomic action' in the context of .do?
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'.
How is action.do different from a serverless function?
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.
Can actions be chained together?
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.
What kind of error handling does action.do support?
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.