Skip to main content

Async Jobs

Async Jobs provide a server-based approach to running recipes and agents. Jobs are submitted to an API server, persisted, and can be monitored, streamed, and cancelled. Ideal for production deployments with multiple clients.

Python API

Submitting a Job

JobHandle Methods

Waiting for Completion

Using the Jobs API Directly

Starting the Jobs Server

Server Configuration

Job Status Values

  • queued - Job is waiting to be processed
  • running - Job is currently executing
  • succeeded - Job completed successfully
  • failed - Job failed with an error
  • cancelled - Job was cancelled

Webhooks

Configure webhooks to receive notifications when jobs complete:
Webhook payload:

Idempotency

Prevent duplicate job submissions with idempotency keys:

Idempotency Scopes

TEMPLATE.yaml Runtime Block

Configure job defaults in your recipe:

Error Handling

Best Practices

  1. Use idempotency keys - Prevent duplicate submissions
  2. Set appropriate timeouts - Match job complexity
  3. Configure webhooks - For async notification
  4. Monitor job status - Use streaming for real-time updates
  5. Handle failures gracefully - Implement retry logic

See Also