Automating a single task is one thing. Sending a notification, creating a user, updating a database record—these are the solved problems of modern development. But what happens when your business process isn't just one task, but a dozen? When it involves conditional logic, error handling, and passing data between steps?
Too often, these complex processes become a tangled web of brittle scripts, hard-to-maintain serverless functions, and cron jobs that no one dares to touch. State is managed in temporary files, error handling is an afterthought, and versioning the entire process feels impossible.
While action.do gives you the power to execute flawless, atomic actions—the fundamental verbs of your business—workflow.do provides the grammar to compose them into a powerful narrative. It’s how you turn a collection of single-responsibility tasks into a robust, version-controlled, and testable business process.
Executing a single, atomic action is powerful because of its reliability. It either succeeds completely or fails entirely. But real-world automations are sequences. Consider a standard user onboarding process:
If step #2 fails, you can't just stop. You need a way to roll back step #1 or at least flag the user's state as incomplete. You need to manage the flow, handle failures gracefully, and maintain state across every step. This is the job of an orchestrator, and building one from scratch is a significant engineering challenge.
workflow.do is the orchestration layer built on top of the atomic actions you define. It lets you chain these actions together, manage state, and handle complex logic, effectively turning your most sophisticated business processes into code.
Think of it this way:
This is the core of Business-as-Code: treating your operational processes with the same rigor as your application code.
While action.do executes a single command, a workflow.do definition describes the entire sequence, including how data flows from one step to the next.
Let's model our user onboarding process. You would have already defined atomic actions for create-user, add-user-to-crm, and send-welcome-email. Now, you orchestrate them:
import { Dō } from '@do-sdk/core';
const dō = new Dō({ apiKey: 'YOUR_API_KEY' });
// Define a multi-step workflow for user onboarding
const signupWorkflow = dō.workflow.define({
name: 'new-user-onboarding-flow',
trigger: { type: 'api' }, // Can be triggered by a webhook or API call
steps: [
{
id: 'createUser',
action: 'create-user-db',
input: {
email: '{{ trigger.body.email }}', // Data from the initial trigger
name: '{{ trigger.body.name }}',
plan: 'free-tier',
},
},
{
id: 'syncToCrm',
action: 'add-user-to-crm',
input: {
// Use the output from the previous step
userId: '{{ steps.createUser.output.userId }}',
email: '{{ trigger.body.email }}',
},
},
{
id: 'sendWelcome',
action: 'send-welcome-email',
input: {
userId: '{{ steps.createUser.output.userId }}',
template: 'new-user-welcome',
},
},
],
// Define what happens if any step fails
onFailure: {
action: 'notify-devops-team',
input: { message: 'Onboarding failed for {{ trigger.body.email }}' }
}
});
// To run the workflow:
// await signupWorkflow.execute({ body: { email: 'user@example.com', name: 'Alex' } });
This simple definition unlocks tremendous power:
When you model your agentic workflows and automations this way, you move from fragile scripting to professional software engineering.
Stop scripting and start orchestrating. By combining the transactional integrity of action.do with the intelligent orchestration of workflow.do, you can build automations that are not just powerful, but also reliable, scalable, and a pleasure to maintain.
This is the future of agentic workflows and Business-as-Code. It's time to treat your business logic like the critical asset it is.
Ready to turn your complex processes into reliable code? Explore the documentation and start building with workflow.do today.