Developer services are revolutionizing how businesses operate, turning complex processes into streamlined, accessible code. Imagine transforming your business logic, from generating an invoice to onboarding a new customer, into a simple API call or an SDK function. This is the power of "business as code" and "services as software," and it's here to stay.
At developer.services.do, we're unleashing this power with our AI-powered Agentic Workflow Platform. Our platform empowers developers to build, automate, and deliver valuable business services as code, making them easily consumable APIs and SDKs.
One of the core ways you interact with the .do platform is through our intuitive SDK. In this blog post, we'll walk you through creating your very first workflow using the .do SDK, turning a common business task into code.
Before we dive into the code, let's quickly touch on the benefits of this approach:
The .do SDK is your gateway to defining and managing workflows on our platform. It provides the tools to set up your workflow, define inputs, manage agents, and run executions.
For this tutorial, we'll create a simple workflow to generateInvoice. This workflow will take customer and item information as input and, in a real-world scenario, would handle the logic to generate and potentially send an invoice.
First, you'll need to install the .do SDK in your project. You can do this using npm or yarn:
npm install @dotdo/sdk
# or
yarn add @dotdo/sdk
Now, let's define our generateInvoice workflow using the SDK.
import { Workflow } from "@dotdo/sdk";
// Create a new Workflow instance with a unique name
const myWorkflow = new Workflow("generateInvoice");
Here, we import the Workflow class from the SDK and create a new instance named "generateInvoice". This name will be used to identify and trigger your workflow on the .do platform.
Workflows often require input data to execute their logic. For our invoicing workflow, we need information about the customer and the items being purchased. We can set this input data using the setInput method:
myWorkflow.setInput({
customer: {
name: "Acme Corp",
email: "info@acmecorp.com"
},
items: [
{ name: "Product A", quantity: 2, price: 100 },
{ name: "Product B", quantity: 1, price: 50 }
]
});
The setInput method takes an object where you structure the data your workflow requires. The keys and structure of this object depend on how your workflow is defined on the .do platform (e.g., what inputs your agents or steps expect).
With the workflow defined and input data provided, you can now execute the workflow using the run method:
const result = await myWorkflow.run();
The run() method asynchronously triggers the execution of your workflow on the .do platform. It returns a promise that resolves with the result of the workflow execution. The structure of the result object will depend on what your workflow is designed to output.
After the workflow completes, you can access and process the result:
console.log(result);
In our generateInvoice example, the result might contain information about the generated invoice, such as an invoice ID, a URL to the invoice document, or a success status.
Here's the complete code for our simple generateInvoice workflow:
import { Workflow } from "@dotdo/sdk";
// Create a new Workflow instance
const myWorkflow = new Workflow("generateInvoice");
// Set the input data for the workflow
myWorkflow.setInput({
customer: {
name: "Acme Corp",
email: "info@acmecorp.com"
},
items: [
{ name: "Product A", quantity: 2, price: 100 },
{ name: "Product B", quantity: 1, price: 50 }
]
});
// Run the workflow and get the result
const result = await myWorkflow.run();
// Log the result
console.log(result);
This simple example demonstrates the fundamental steps of using the .do SDK to trigger a workflow. In a real-world scenario, you would likely integrate this code into your application's backend or a serverless function to automate tasks based on user interactions or system events.
This tutorial covered a very basic workflow execution. The .do platform and SDK offer much more power and flexibility, including:
By transforming your business processes into callable code using the .do platform and SDK, you unlock a new level of automation, efficiency, and scalability. Stop building one-off scripts and start defining "business as code" for a more streamlined and powerful operation.
Ready to unleash the power of developer services? Learn more about developer.services.do and start building your own business services as code today!
What is .do?
.do is an AI-powered Agentic Workflow Platform designed to transform complex business processes into executable code workflows, making them simple APIs and SDKs.
How can I build business services with .do?
Our platform allows you to define, automate, and expose business services as code, enabling seamless integration and delivery of value through simple APIs.
What tools does .do offer for developers?
.do provides a comprehensive SDK and intuitive tools to define workflows, manage agents, and handle inputs and outputs for your business services.
What kinds of business services can I create?
You can transform any business process or service into code, such as generating invoices, managing customer onboarding, processing orders, and much more.
How does AI fit into the platform?
.do leverages AI agents to perform tasks and make decisions within your workflows, enabling more dynamic and intelligent automation.