Gobii Logo

Synchronous Tasks

Waiting for short-running jobs right inside the HTTP call can simplify your workflow—no polling loop, no extra queues. Gobii lets you do that with the wait parameter.

Why wait?

  • Immediate results for tasks that usually finish in a few seconds
  • Easier to integrate in serverless / request–response environments
  • No additional billing or limitations beyond the regular task quotas

How it works

  1. Submit a task and include a wait field (0–900 seconds).
  2. The request thread blocks while the task is executed by our Celery worker.
  3. The response you receive depends on how quickly the task finishes:
  4. completed – full result payload
  5. failederror_message
  6. in_progress – still running, keep polling the normal /result/ endpoint

The task itself continues even if the timeout expires.

API example (curl)

curl -X POST \
  -H "X-Api-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  https://getgobii.com/api/v1/tasks/browser-use/ \
  -d '{
        "prompt": "Count the number of <h1> tags on https://example.com",
        "wait": 45
      }'

Possible responses

// completed (within 45 s)
{
  "id": "...",
  "status": "completed",
  "result": { "h1_count": 1 },
  "agent_id": null
}

// still running after 45 s
{
  "id": "...",
  "status": "in_progress",
  "agent_id": null
}

Using the TypeScript client

const task = await api.assignTask(agent.id, {
  prompt: "Scrape the main heading",
  wait: 30,
});

if (task.status === "completed") {
  console.log(task.result);
} else {
  console.log(`Status: ${task.status}`);
}

Tips & caveats

  • wait should be set conservatively—remember your HTTP client & gateway timeouts.
  • Synchronous waiting does not guarantee success; always handle the in_progress case.
  • Large wait values will tie up a worker thread in your application server; consider asynchronous patterns for long-running jobs.

Next steps

Need predictable JSON output? Continue to our Structured Output guide.