Skip to main content
For AI agents: a documentation index is available at https://docs.parallel.ai/llms.txt. The full text of all docs is at https://docs.parallel.ai/llms-full.txt. You may also fetch any page as Markdown by appending .md to its URL or sending Accept: text/markdown.

Task Spec

A Task Specification (Task Spec) is a declarative template that defines the structure and requirements for the outputs of a web research operation. While optional in each Task Run, Task Specs provide significant advantages when you need precise control over your research data. Task Specs ensure consistent results by enforcing a specific output structure across multiple runs. They validate schema against expected formats and create reusable templates for common research patterns. By defining the expected outputs clearly, they also serve as self-documentation for your tasks, making them easier to understand and maintain.
ComponentRequiredPurposeFormat
Output SchemaYesDefines the structure and fields of the task resultJSON Schema or Text
Input SchemaNoSpecifies expected input parameters and their formatsJSON Schema or Text

Task Spec Structure

A Task Spec consists of:
FieldTypeRequiredDescription
output_schemaSchema object or stringYesDescription and structure of the desired output
input_schemaSchema object or stringNoDescription and structure of input parameters
When providing a bare string for input_schema or output_schema, it’s equivalent to a text schema with that string as the description.

Schema Types

Task Spec supports three schema formats:
When using the Python SDK, Parallel Tasks also support Pydantic objects in Task Spec
auto mode enables Deep Research style outputs only in processors pro and above. Read more about Deep Research here.
{
  "json_schema": {
    "type": "object",
    "properties": {
      "population": {
        "type": "string",
        "description": "Current population with year of estimate"
      },
      "area": {
        "type": "string",
        "description": "Total area in square kilometers and square miles"
      }
    },
    "required": ["population", "area"]
  },
  "type": "json"
}
See Best Practices for guidance on writing effective Task Specs.

Output Schema Validation Rules

The Task API enforces several restrictions on output schemas to ensure compatibility and performance:

Schema Structure Rules

RuleTypeDescription
Root type must be objecterrorThe root schema must have "type": "object"
Root must have propertieserrorThe root object must have a properties field
Root cannot use anyOferrorThe root level cannot use anyOf
Standalone null typeerrornull type is only allowed in union types or anyOf
All fields must be requiredwarningAll properties should be listed in the required array
additionalProperties must be falsewarningAll object types should set additionalProperties: false
While all fields must be required in the schema, you can create optional parameters by using a union type with null. For example, "type": ["string", "null"] allows a field to be either a string or null, effectively making it optional while maintaining schema compliance.

Size and Complexity Limits

25,000 character limit: The combined length of your task specification AND input data cannot exceed 25,000 characters. This includes:
  • All field names and descriptions in your schemas
  • The objective or description text
  • Your input data (the entity you’re researching)
If you hit this limit, simplify your schema descriptions or reduce input size. For large input data, consider splitting into multiple tasks.
RuleTypeLimitDescription
Nesting deptherror5 levelsMaximum nesting depth of objects and arrays
Total propertieserror100Maximum total number of properties across all levels
Total string lengtherror25,000 charsMaximum total string length for names and values
Enum valueserror500Maximum number of enum values across all properties
Large enum string lengtherror7,500 charsMaximum string length for enums with >250 values
Task spec sizeerror15,000 charsMaximum length of the task specification alone
Total sizeerror25,000 charsMaximum combined length of task specification + input data

Unsupported Keywords

The following JSON Schema keywords are not supported in output schemas: contains, format, maxContains, maxItems, maxLength, maxProperties, maximum, minContains, minItems, minLength, minimum, minProperties, multipleOf, pattern, patternProperties, propertyNames, uniqueItems, unevaluatedItems, unevaluatedProperties irements: it has an object root type with properties, all fields are required, and additionalProperties is set to false.

Common Schema Errors to Avoid

Here are examples of common schema errors and how to fix them:
{
  "type": "array",  // Error: Root type must be "object"
  "items": {
    "type": "object",
    "properties": {
      "name": { "type": "string" }
    }
  }
}
Fix: Change the root type to “object” and move array properties to a field:
{
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": { "type": "string" }
        },
        "required": ["name"]
      }
    }
  },
  "required": ["items"],
  "additionalProperties": false
}