Task Schemas
Tasks in Autoken are defined using a simplified JSON schema format. This page documents the schema structure and conventions.
Overview
Each task is defined in a JSON file with the following structure:
{
"name": "task-name",
"description": "Human-readable description of the task",
"category": "category-name",
"icon": "lucide-icon-name",
"pricingModel": { ... },
"input": { ... },
"output": { ... },
"schemas": { ... },
"methods": { ... }
}Simplified Schema Format
The input and output fields use a simplified format where each field is defined directly without wrapping in properties.
✓ Simplified Format
{
"input": {
"query": {
"type": "string",
"description": "Search query",
"required": true
},
"limit": {
"type": "number",
"default": 10
}
}
}✗ Old Format (Not Used)
{
"inputSchema": {
"type": "object",
"properties": {
"query": {
"type": "string"
}
},
"required": ["query"]
}
}Key differences: In the simplified format, fields are defined directly under input/output, and required: true is set on individual fields instead of a separate array.
Field Types
| Type | Description | Example |
|---|---|---|
string | Text values | "hello" |
number | Numeric values (integer or float) | 42, 3.14 |
boolean | True/false values | true |
object | Nested structured data | { "key": "value" } |
array | Lists of items | [1, 2, 3] |
artifact | Binary file reference (SHA-256 hash) | "abc123..." |
schema | Data structure definition | { "type": "object", ... } |
Field Properties
required
Set to true to mark a field as required.
"query": { "type": "string", "required": true }default
Specify a default value for optional fields.
"limit": { "type": "number", "default": 10 }description
Human-readable description of the field.
"query": { "type": "string", "description": "The search query" }enum
Restrict values to a specific set of options.
"format": { "type": "string", "enum": ["mp3", "wav", "ogg"] }items
Define the type of items in an array.
"tags": { "type": "array", "items": { "type": "string" } }Pricing Model
The pricingModel field defines how the task is priced. Providers set actual USD prices when they register.
{
"pricingModel": {
"unit": "megabyte",
"unitLabel": "MB",
"outputField": "megabytesUsed",
"modifiers": {
"type": ["datacenter", "residential", "mobile"]
}
}
}| Field | Description |
|---|---|
unit | Unit of measurement (e.g., "request", "character", "megabyte", "second") |
unitLabel | Human-readable label for the unit |
inputField | Input field used for cost calculation |
outputField | Output field used for cost calculation |
modifiers | Input options that affect pricing (e.g., quality tiers) |
Exported Schemas
Tasks can export reusable schemas that other tasks can reference using the schemas field.
{
"name": "social-search",
"schemas": {
"post": {
"platform": { "type": "string", "required": true },
"content": { "type": "string", "required": true },
"url": { "type": "string", "required": true },
"author": { "type": "string" },
"timestamp": { "type": "string" }
}
},
"output": {
"results": {
"type": "array",
"items": { "$ref": "#/schemas/post" }
}
}
}Reference Formats
#/schemas/post- Reference a schema within the same tasksocial-search.post- Reference a schema from another task
Task Methods
Methods allow operations on an existing task execution. They're defined in the methods field.
{
"name": "proxy-rent",
"methods": {
"extend": {
"description": "Extend an existing proxy rental",
"input": {
"duration": {
"type": "number",
"description": "Additional seconds",
"required": true
}
},
"output": {
"expiresAt": { "type": "string" },
"additionalCost": { "type": "number" }
}
}
}
}Complete Example
{
"name": "translate-text",
"description": "Translate text between languages",
"category": "language",
"icon": "languages",
"pricingModel": {
"unit": "character",
"unitLabel": "char",
"inputField": "text"
},
"input": {
"text": {
"type": "string",
"description": "Text to translate",
"required": true
},
"language": {
"type": "string",
"description": "Target language code (e.g., 'es', 'fr', 'de')",
"required": true
},
"sourceLanguage": {
"type": "string",
"description": "Source language (auto-detected if not specified)"
}
},
"output": {
"translatedText": {
"type": "string",
"description": "The translated text"
},
"detectedLanguage": {
"type": "string",
"description": "The detected source language"
},
"characterCount": {
"type": "number",
"description": "Number of characters translated"
}
}
}