Skip to main content
Jobs allow you to run many AI tasks in parallel using batch processing. Read the introduction for a lexicon on jobs, tasks, and executions.

Quickstart

It is required to have npm (TypeScript) or uv (Python) installed to use the following command.
You can quickly initialize a new job from scratch by using CLI command bl new.
bl new job
This will create a pre-scaffolded local directory where your entire code can be added. In the generated folder, you’ll find a boilerplate job with multiple steps in the entrypoint file index.ts.
import { blStartJob, withSpan } from '@blaxel/core'; // You can load any Blaxel SDK function
import '@blaxel/telemetry'; // This import is required to connect all the metrics and tracing with blaxel platform
import step1 from './steps/step1';
import step2 from './steps/step2';
import step3 from './steps/step3';

type JobArguments = {
  name: string;
}

async function myJob({name}: JobArguments) {
  console.log(`Hello, world ${name}!`);

  // You can call standard Javascript functions
  await step1();
  await step2();
  ...
}

// You need to use a Blaxel SDK function to wrap your job, this is the only requirement to make it work with Blaxel 
blStartJob(myJob);

Start the job locally:
# Run the job with a sample batch file
bl run job <<JOB-NAME>> --local --file batches/sample-batch.json

# Or directly with --data argument
bl run job <<JOB-NAME>> --local --data '{"tasks": [{"name": "John"}]}'

# Or without blaxel CLI
pnpm start --name John

Deploy a job

Learn how to deploy your AI batch jobs on Blaxel as a serverless auto-scalable endpoint.
I