Skip to main content
The Jobs Service enables you to schedule recurring tasks, create webhook-triggered automations, and manually trigger job executions. Jobs can execute predefined agents, teams, or workflows at specified intervals or on-demand.

Quick Start

Features

Cron Scheduling

Schedule recurring tasks with cron expressions

Webhook Triggers

Trigger jobs via secure webhook endpoints

Manual Execution

Manually trigger jobs on-demand

Execution History

Track job execution history and status

List Jobs

Retrieve all jobs with optional filtering:
Parameters:
  • enabled (bool, optional): Filter by enabled status (True/False)
  • trigger_type (str, optional): Filter by trigger type: ‘cron’, ‘webhook’, or ‘manual’
Returns: List of job dictionaries

Get Job

Retrieve a specific job by ID:
Parameters:
  • job_id (str, required): Job ID (format: job_<uuid>)
Returns: Dictionary containing job details

Create Job

Cron Job

Create a job that runs on a schedule:

Webhook Job

Create a job triggered via webhook:

Manual Job

Create a job for manual triggering only:
Parameters:
  • job_data (dict, required): Job configuration
    • name (str, required): Job name
    • trigger_type (str, required): ‘cron’, ‘webhook’, or ‘manual’
    • cron_schedule (str): Cron expression (required for cron trigger)
    • cron_timezone (str): Timezone for cron (default: ‘UTC’)
    • planning_mode (str): ‘on_the_fly’, ‘predefined_agent’, ‘predefined_team’, or ‘predefined_workflow’
    • entity_type (str): ‘agent’ or ‘team’ (for predefined modes)
    • entity_id (str): Entity UUID (for predefined modes)
    • prompt_template (str): Prompt with placeholders
    • system_prompt (str, optional): System prompt override
    • executor_type (str): ‘auto’, ‘specific_queue’, or ‘environment’
    • worker_queue_name (str): Worker queue name (for specific_queue)
    • environment_name (str): Environment name (for environment executor)
    • config (dict, optional): Additional configuration
    • execution_environment (dict, optional): Execution environment config
    • enabled (bool): Whether job is enabled (default: True)
    • description (str, optional): Job description
Returns: Dictionary containing created job with webhook_url if applicable
For webhook jobs, save the webhook_url and webhook_secret - the secret is only shown once at creation time.

Update Job

Update an existing job (partial update):
Parameters:
  • job_id (str, required): Job ID
  • job_data (dict, required): Fields to update
    • name (str): Job name
    • description (str): Job description
    • enabled (bool): Whether job is enabled
    • cron_schedule (str): Cron expression
    • cron_timezone (str): Timezone
    • planning_mode (str): Planning mode
    • entity_type (str): Entity type
    • entity_id (str): Entity ID
    • prompt_template (str): Prompt template
    • system_prompt (str): System prompt
    • executor_type (str): Executor type
    • worker_queue_name (str): Worker queue name
    • environment_name (str): Environment name
    • config (dict): Configuration
    • execution_environment (dict): Execution environment
Returns: Dictionary containing updated job details
Updating cron_schedule will recreate the Temporal Schedule, which may briefly pause execution.

Delete Job

Delete a job and its Temporal Schedule:
Parameters:
  • job_id (str, required): Job ID
Returns: None (204 No Content on success)

Job Execution

Manual Trigger

Manually trigger a job execution:
Parameters:
  • job_id (str, required): Job ID
  • parameters (dict, optional): Parameters to substitute in prompt template
  • config_override (dict, optional): Config overrides for this execution
Returns: Dictionary with workflow_id, execution_id, and status

Enable/Disable Job

Enable or disable a job:
Parameters:
  • job_id (str, required): Job ID
Returns: Dictionary containing updated job details
For cron jobs, enabling creates the Temporal Schedule if it doesn’t exist, and disabling pauses it.

Get Execution History

Retrieve execution history for a job:
Parameters:
  • job_id (str, required): Job ID
  • limit (int): Max executions to return (default: 50)
  • offset (int): Number to skip (default: 0)
Returns: Dictionary with total_count and executions list

Webhook Triggers

Trigger via Webhook

Trigger a job using its webhook endpoint:
Parameters:
  • webhook_path (str, required): Unique webhook identifier from webhook URL
  • payload (dict, required): Webhook payload
    • parameters (dict): Parameters for prompt template
    • config_override (dict, optional): Config overrides
    • metadata (dict, optional): Additional metadata
  • signature (str, required): HMAC-SHA256 signature (hex)
Returns: Dictionary with workflow_id, execution_id, and status
Always validate webhook signatures to prevent unauthorized job executions. Never expose webhook secrets in client-side code.

Complete Example

Here’s a complete example of creating and managing a scheduled job:

Error Handling

Handle job-related errors:

Cron Schedule Examples

Common cron schedule patterns:
Use crontab.guru to validate and understand cron expressions.

Best Practices

Job Design

  • Idempotent Jobs: Design jobs to be safely re-runnable
  • Clear Naming: Use descriptive names indicating purpose and frequency
  • Reasonable Timeouts: Set appropriate execution timeouts
  • Error Handling: Include error handling in prompt templates

Scheduling

  • Timezone Awareness: Always specify timezone explicitly
  • Off-Peak Hours: Schedule heavy jobs during low-traffic periods
  • Avoid Overlap: Ensure jobs don’t overlap if they access shared resources
  • Test Manually First: Test with manual trigger before enabling cron

Webhook Security

  • Always Validate Signatures: Never trust unsigned webhooks
  • Secure Secret Storage: Store webhook secrets securely (env vars, secrets manager)
  • Rate Limiting: Implement rate limiting on webhook endpoints
  • Audit Logs: Monitor webhook trigger patterns

Monitoring

  • Check Execution History: Regularly review execution status
  • Set Up Alerts: Alert on consecutive failures
  • Track Duration: Monitor job duration trends
  • Disable Failed Jobs: Temporarily disable repeatedly failing jobs

API Reference

Next Steps

Agents Service

Create agents for job execution

Teams Service

Use teams in jobs

Workers Service

Configure worker queues

Environments Service

Manage execution environments