Skip to main content

Overview

The async API pattern is ideal when you want to submit multiple long-running tasks and check their status later. Instead of waiting for each run to complete, you submit all requests and get back run IDs that you can poll for completion.

How It Works

  1. Submit requests to /v1/automation/run-async, which returns corresponding run_ids, which you will need if you want to check the status of a particular run.
  2. Check individual runs with GET /v1/runs/:id to check status
  3. Or fetch all runs with GET /v1/runs to monitor batch progress

Basic Example

Submit multiple TinyFish Web Agent runs and poll for completion:

Fire and Forget Pattern

Submit tasks without waiting for completion:

When to Use Async vs Sync

Best Practices

Polling Interval

  • Short tasks (under 1 min): Poll every 2-3 seconds
  • Medium tasks (1-5 min): Poll every 5-10 seconds
  • Long tasks (over 5 min): Poll every 30-60 seconds

Error Handling

Always check run status and handle failures:
Python

API Reference

Run Async

Start TinyFish Web Agent run asynchronously

List Runs

Get all runs

Get Run by ID

Check individual run status

Cancel Run

Cancel a running automation

Concurrent Requests

Sync API for immediate results

Web Scraping

Extract data from pages