Task Definitions
Utilizing the TaskDefinition Component in doable.sh
The TaskDefinition component from the Doable AI SDK is a powerful way to define and execute tasks within your application. It allows you to set up structured workflows that your AI operator can carry out efficiently and consistently.
Why Use TaskDefinition?
The TaskDefinition component helps you automate repetitive or complex workflows. Instead of manually guiding users through multiple steps, you can define the entire process once, and your operator will handle it from there. This improves accuracy, efficiency, and user experience.
Key Benefits:
- Automates multi-step tasks efficiently.
- Ensures consistency in executing actions.
- Reduces human error by following predefined instructions.
- Easily integrates with existing UI components.
Installation and Setup
Before using TaskDefinition, make sure the Doable AI SDK is installed:
npm install @doable.sh/sdk
pnpm i @doable.sh/sdk
yarn add @doable.sh/sdk
Next, import the component in your React app:
Real-World Example:
The TaskDefinition component allows you to define a sequence of steps for a specific task. You give it an ID, a name, a description, and a list of steps, and the operator takes care of the rest.
In our dashboard, we use it to automate the creation of a new operator. Instead of clicking through the UI, you can set up a task as follows:
Use Cases
1. Operator Configuration
When setting up a new operator, you may want the AI to follow a sequence of actions to configure it correctly. Use TaskDefinition to automate this setup.
Example:
- Create a new operator
- Set the allowed domains
- Configure the model and voice settings
2. Data Entry Automation
If your application requires repetitive data entry, use TaskDefinition to automate the process.
Example:
- Open the data entry form
- Fill in user details
- Submit the form
3. Multi-Step Navigation
For apps with multi-page forms or wizards, you can use TaskDefinition to guide the AI through each step.
Example:
- Go to the dashboard
- Navigate to the settings tab
- Open the preferences page
- Save changes
4. Complex Workflows
When a task involves multiple components or requires navigating between pages, TaskDefinition ensures that the process flows smoothly without user intervention.
Example:
- Start a new project
- Add team members
- Assign tasks
- Save project settings
Best Practices
- Keep Steps Clear: Use simple, precise language to describe each step.
- Break Down Complex Workflows: Instead of one long task, break it into smaller, manageable actions.
- Test Thoroughly: Verify that each step works as expected before deploying.
- Name Tasks Logically: Choose names that make the purpose of the task obvious.
Advanced Usage
You can combine TaskDefinition with startTask to trigger tasks programmatically:
This approach is useful when you want to start a task automatically based on user actions or specific conditions.
Summary
The TaskDefinition component is essential for creating repeatable and efficient workflows. By defining tasks declaratively, you eliminate human error and improve the consistency of your operator's actions. Use TaskDefinition to automate common tasks like setup, data entry, or complex multi-step processes.
By implementing TaskDefinition in your app, you empower your AI operator to perform tasks faster and more accurately, enhancing user experience and productivity.