tasks/. Run them locally with veryfront task <name> or in the cloud as task runs.
Prerequisites
- A Veryfront project with the
tasks/directory available (see Create project). - For cloud execution: a
VERYFRONT_API_TOKENand a project reference (see Configuration).
Quick start
Create a task file:Task definition
A task file exports aTaskDefinition object as its default export:
| Field | Required | Description |
|---|---|---|
name | No | Human-readable name |
description | No | What the task does |
inputSchema | No | JSON-schema-like input contract for APIs and UIs |
outputSchema | No | JSON-schema-like output contract |
schedulable | No | Whether it can be used as a schedule target |
run | Yes | The function to execute |
Task context
Therun function receives a TaskContext:
env: filtered environment variables (useenvAllowlistto restrict)config: run configuration (passed when run in the cloud)projectId: project identifier (available in cloud context)
Discovery
Tasks are discovered automatically from thetasks/ directory:
.ts, .tsx, .js, .jsx are supported. Test files and node_modules are ignored.
Running tasks
CLI
tasks/.
As a cloud run
Tasks withschedulable: true can be targeted by runs and schedules:
Verify it worked
Run the task locally first:console.log output, exits with status 0, and
returns the value you returned from run as the final JSON line.
For cloud execution, create a run that targets the task and check Studio for
a completed status. See the verification block in Runs for the
SDK-driven check.