DEV Community

Aghiles DJEBARA
Aghiles DJEBARA

Posted on

The hidden pain of scheduling tasks (and what I did about it)

Orkera: Scheduling Tasks Without Cron Job Nightmares

Every developer I know has a story about fighting with scheduled tasks.

  • Cron jobs that mysteriously stop running.
  • Queues that silently fail.
  • Time zones that turn a simple “run at 3 pm” into a debugging nightmare.

I’ve been there too — too many times.

In several of my past projects, what should have been a small feature (like sending a report at a specific time, or following up with a user later) turned into days of setup: workers, brokers, retry logic, monitoring. None of it was the actual business logic I was supposed to deliver.

And now, with the rise of AI agents, this problem is even louder. Agents often need to schedule reminders, delayed tasks, or periodic syncs. Yet every team ends up reinventing the same messy infrastructure just to get there.

So I decided to solve it once and for all.


What I built: Orkera

Orkera is a lightweight service for scheduling tasks without the headaches of cron jobs, queues, or complex infrastructure.

Here’s the workflow:

  1. You send Orkera a task with a payload, a schedule time, and a callback URL.
  2. Orkera stores the task, monitors it, retries on failure, and delivers it at the exact right time.
  3. On your side, you execute the task immediately in a webhook endpoint.

You can use it via a Python SDK or a REST API. You also get visibility into past and future tasks, their status, and the ability to cancel them.


Step 1: Schedule a task with Orkera SDK

This can run anywhere — a script, a backend job, or even a CLI:

from orkera import OrkeraClient
from datetime import datetime, timedelta

# Initialize Orkera client
client = OrkeraClient(api_key="your_api_key")

# Schedule a task to calculate a sum in 10 seconds
task_id = client.schedule_task(
    task_name="calculate_sum",
    task_kwargs={"a": 10, "b": 20},
    schedule_time=datetime.utcnow() + timedelta(seconds=10),
    callback_url="https://your-domain.com/callback"  # Your webhook endpoint
)
Enter fullscreen mode Exit fullscreen mode

✅ Orkera handles retries, backoff, and exact timing — all you do is schedule the task.


Step 2: Set up a webhook to execute the task

Here’s a minimal FastAPI example that executes the task when Orkera calls your webhook:

from fastapi import FastAPI, Request, HTTPException

app = FastAPI()

@app.post("/callback")
async def receive_callback(request: Request):
    """Webhook endpoint to receive Orkera's callback and execute the task"""
    data = await request.json()
    task_name = data.get("task_name")
    task_kwargs = data.get("task_kwargs", {})
    # Execute task based on name
    if task_name == "calculate_sum":
        a = task_kwargs.get("a", 0)
        b = task_kwargs.get("b", 0)
        result = a + b
        print(f"Sum of {a} + {b} = {result}")
        return {"status": "ok", "result": result}

    # Unknown task
    raise HTTPException(status_code=400, detail=f"No implementation for task: {task_name}")
Enter fullscreen mode Exit fullscreen mode

✅ Now, if Orkera POSTs to /callback with an unknown task name, it clearly returns a 400 Bad Request.

You can extend the if/else to add more tasks as needed.


How it works

  1. You schedule a task with the SDK.
  2. Orkera triggers the /callback endpoint at the scheduled time.
  3. The webhook executes the correct task immediately.
  4. You get the result in the callback response (and can store or log it as needed).

This pattern keeps the scheduling logic independent from your app while still letting you run tasks immediately when the webhook is triggered.


Why it matters

  • Developers no longer have to reinvent cron, queues, or retries.
  • Teams building AI agents can schedule reminders, follow-ups, or periodic syncs without boilerplate infra.
  • You can focus on business logic instead of plumbing, which is where the real value lies.

Feedback wanted 🚀

This is still a side project, and I’m looking for as much feedback as I can get from other developers.

👉 Does this sound useful to you? What would make it better?

👉 Check out Orkera here: [https://orkera.com]

Top comments (0)