In today's fast-paced business environment, efficiency is king. Yet, many teams are still bogged down by complex, repetitive, and time-consuming tasks. Think about generating quarterly reports, onboarding new clients, or analyzing market data. These processes often involve multiple steps, various data sources, and significant manual effort—making them ripe for errors and delays.
What if you could delegate these entire workflows to an intelligent agent? Not just a simple script, but an autonomous digital worker capable of understanding your objectives and executing them from start to finish.
Meet Lena, the autonomous AI agent from .do.
Lena is designed to be a digital member of your team. You can delegate complex business workflows and operational tasks to her, and she executes with precision, speed, and intelligence. This guide will walk you through transforming a complex business process into a simple, callable service using Lena and the .do API. You'll see just how easy it is to build powerful automations with only a few lines of code.
Before we dive into the code, let's clarify what makes Lena different. Unlike traditional automation tools that follow rigid, pre-programmed steps, Lena operates as an autonomous agent.
Essentially, Lena bridges the gap between your business logic and automated execution, allowing you to create robust services without the complex engineering overhead.
Let's imagine a common business task: creating the quarterly sales report. Manually, this process is a headache. It involves:
This multi-step process can take hours, if not days, and is prone to human error. Now, let's turn this entire workflow into a single API call with Lena.
We'll use the .do SDK to assign this task to Lena.
First, you'll need to have Node.js installed. Then, install the .do SDK into your project.
npm install @do-inc/sdk
You will also need an API key from the .do platform. For security, it's best practice to store this key as an environment variable (e.g., DO_API_KEY).
In your TypeScript or JavaScript file, import the Do class and create a new agent instance using your API key.
import { Do } from '@do-inc/sdk';
// The SDK automatically finds the DO_API_KEY in your environment variables
const agent = new Do(process.env.DO_API_KEY);
This agent object is now your direct line of communication to the .do platform and its autonomous workers, including Lena.
This is where the magic happens. We'll use the agent.lena.assign method to delegate our reporting task. We define our objective in natural language and provide the specific parameters Lena needs to execute the task precisely.
import { Do } from '@do-inc/sdk';
const agent = new Do(process.env.DO_API_KEY);
// Assign a complex task to Lena
const task = await agent.lena.assign({
objective: 'Generate a comprehensive quarterly sales report.',
parameters: {
quarter: 'Q3',
year: 2024,
outputFormat: 'pdf',
distributionList: ['ceo@example.com', 'sales-leads@example.com']
}
});
console.log(`Task ${task.id} assigned to Lena. Status: ${task.status}`);
Let's break that down:
When you run this code, Lena immediately gets to work. The response you get back contains a task.id and a status.
Task <some-unique-id> assigned to Lena. Status: active
The id allows you to track the progress of the task asynchronously. Lena is now autonomously working in the background—pulling data, running analysis, and compiling your report. This non-blocking, fire-and-forget model is perfect for long-running business processes.
With just those few lines of code, you've automated a complex workflow. But the real power comes when you wrap this logic into an API endpoint. Imagine creating a simple endpoint in your application:
POST /api/reports/generate
When you call this endpoint, it executes the code we just wrote. Suddenly, a multi-day manual process is transformed into a reliable, on-demand service that anyone in your organization can use.
This is the future of business automation. You don't build brittle scripts; you compose intelligent services by delegating objectives to autonomous agents like Lena.
Generating reports is just the beginning. Any business process you can define as a workflow is a candidate for Lena. For example:
If you can define the objective, Lena can get it done.
You’ve just seen how simple it is to transform complex business logic into a powerful, automated service with Lena. By delegating high-level objectives, you free up your team from tedious, manual work and empower them to focus on what truly matters: innovation and growth.
Ready to delegate your first task? Visit lena.do to get your API key and start building your autonomous workforce today.