In a world of distributed systems and microservices, failure is not an "if," but a "when." Transient network hiccups, temporary API unavailability, or rate limiting can unexpectedly derail your most critical business processes. A failed customer payment, a stalled onboarding sequence, or a lost order notification can have real-world consequences.
Traditionally, developers spend countless hours writing complex, boilerplate-heavy logic to handle these scenarios. You build try...catch blocks, implement exponential backoff strategies, manage retry counters, and design fallback mechanisms. This code is difficult to write, harder to test, and distracts you from what you really want to build: your core product features.
What if you could offload that complexity? With the .do Agentic Workflow Platform and our official SDKs, you can build robust, fault-tolerant applications by default, letting you focus on your business logic, not on failure recovery.
Building a resilient system requires more than just wrapping an API call in a loop. You need to distinguish between different types of errors:
A robust system needs to intelligently retry the first kind while gracefully handling and flagging the second. The .do platform is engineered to do exactly this.
When you use the .do SDK to run a workflow, you're not just making a simple API call. You are handing off the execution of a multi-step process to a platform designed for reliability. Here’s how it works under the hood.
When a step in your .do workflow fails with a transient error, the platform doesn't just give up. It automatically triggers a retry mechanism. Crucially, it uses exponential backoff, which means it waits progressively longer between each attempt (e.g., 1s, 2s, 4s, 8s...). This smart approach gives a struggling downstream service time to recover without overwhelming it with rapid-fire requests.
The best part? This happens entirely on the .do platform. Your application code remains clean and simple.
The .do SDK provides a simple interface to this powerful backend. Your code is responsible for initiating the workflow. The platform handles the rest.
Let's look at an example. The try...catch block here handles errors that might prevent the workflow from starting, such as an invalid API key or a non-existent workflow name.
import { Do, DoApiError } from '@do-platform/sdk';
const doClient = new Do({
apiKey: process.env.DO_API_KEY,
});
async function triggerCustomerOnboarding(customerData: any) {
try {
const result = await doClient.workflows.run({
name: 'customer-onboarding-workflow',
input: { customer: customerData },
});
console.log(`Workflow ${result.runId} successfully started.`);
// The .do platform now manages the execution, including retries.
} catch (error) {
// This catch block only handles errors *initiating* the workflow.
if (error instanceof DoApiError) {
console.error(`API Error [${error.status}]: Failed to start workflow.`, error.body);
} else {
console.error('An unexpected local error occurred:', error);
}
// You might add the failed initiation to a local queue for later.
}
}
Once doClient.workflows.run() completes successfully, your job is done. The .do platform takes over, executing each step and managing any transient errors along the way. Your application is free and unburdened by the workflow's long-running state.
What happens when a step fails after all retry attempts are exhausted? This indicates a more permanent problem. Instead of letting the workflow vanish into the ether, .do moves the failed execution and its complete state into a Dead-Letter Queue (DLQ).
The DLQ is a critical safety net that ensures:
This mechanism isolates failures, prevents a single bad process from blocking others, and gives you the tools to resolve issues without writing a single line of custom DLQ code.
By combining intelligent automatic retries with a robust Dead-Letter Queue, the .do platform provides a resilient execution environment out of the box. The .do SDK is your elegant, lightweight key to unlocking that power.
Stop letting transient errors dictate your architecture and development cycles. Embrace a platform that handles failure gracefully so you can stay focused on innovation.
Ready to build more reliable applications? Get your API key from the .do dashboard and check out our developer documentation to get started in minutes.