Core Components
Defining the core components of the Task API
In the Task API, we define three core components: Task, Run, and Runner.
Defining Task Components
Tasks
A task is a reusable template for web research and analysis. Think of it like a function that takes structured inputs and returns structured outputs and executes web research operations in between. Each Task requires the following components:
Component | Definition |
---|---|
Name | Identifier for the Task |
Task Spec | Natural language instructions defining what to research and analyze |
Input Schema | Definition of required input parameters |
Output Schema | Structure of the expected results |
Processor | Chosen Parallel processor that will execute the research |
Task Specification
Instructions written in natural language and can include:
-
Research objectives
-
Analysis instructions
-
Source requirements
-
Validation criteria
-
Output formatting
It can be hyper-specific to your use case. Think of the task specification as the instructions you would
provide a competent research analyst with. Variables in the Task Spec are marked with curly braces
(e.g., find the population of {state}
, identify the name of the CEO for {company}
) and are replaced
with input values when the task runs.
Input and Output Schema
Tasks can take various types of inputs and outputs. Inputs can be required or optional, allowing for flexibility across Task runs. The Input schema corresponds to the input variables included as part of the Task Spec. It can be adapted to your use case. For example, in a company research use case, {company_name} and {company_website} may both be required inputs:
Below is an example of a complex output with structured data that illustrates the flexibility of the schema:
Processors
Component | Description |
---|---|
Task | The specification of your web research task |
Run | An individual execution of your Task |
Runner | The engine that executes your Task |
A single Task can have multiple Runs. For example, you may want to run the same Task on thousands of sets of inputs. At each execution, you can specify a Runner. The Runner you choose will determine complexity and cost of outputs.
You can learn more about each of the core components in our Docs.