In the world of building intelligent agentic workflows, having a solid foundation is crucial. You need units of logic that are reliable, reusable, and easy to manage. This is where function.do on the .do platform comes in – the atomic building block for turning your business processes into executable code.
At its core, a function.do represents a single, encapsulated piece of business logic. Think of it as the smallest, independent unit of action within your system. Whether it's creating a new user, processing an order, or sending an email, each of these distinct actions can be defined as a function.do.
This atomic approach offers significant advantages:
Defining a function.do on the .do platform is straightforward, leveraging standard programming languages you're already familiar with. Here's a simple example in TypeScript using the .do SDK's agent function:
export const createService = agent(async (input: { name: string, description?: string }) => {
// Logic to create a new service
const newService = {
id: generateId(),
name: input.name,
description: input.description || '',
createdAt: new Date()
};
console.log(`Created service: ${newService.name}`);
return newService;
});
In this example, createService is a function.do specifically designed to handle the creation of a new service. It takes defined input parameters, executes its business logic, and returns a result. This simple function represents a single, distinct step in a potentially larger business process.
The real power of function.do is realized when they are used as the building blocks for agentic workflows. By orchestrating a series of function.do, you can automate complex, multi-step business processes. For instance, a "New Customer Onboarding" workflow might involve a sequence of function.do:
Each of these is a distinct function.do, working together within a larger agentic workflow, managed and executed by the .do platform.
Once defined, your function.do are deployed and managed directly within the .do platform. This provides a centralized location for your business logic, making it easily discoverable, executable, and scalable. The platform handles the execution environment, scaling, and monitoring of your function.do, allowing you to focus on defining your business logic.
By embracing the concept of function.do, you're moving towards a "Business-as-Code" paradigm, where your operational logic is not just documented, but actively executable, reusable, and manageable. Discover the power of atomic business logic and start building your agentic workflows on the .do platform today.