Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Infrastructure for Agents

Free · sign in to start and track progress

1 · Compute and execution

  • 1Where agents run
  • 2Sandboxes for agent code
  • 3Durable execution engines
  • 4Queues, schedules and background jobs

    Exercise answers

    • Answer: Simulate leases, redelivery and fairness
    • Answer: An idempotent consumer against a local queue

2 · State, access and delivery

  • 5State, sessions and checkpoints
  • 6Secrets, identity and tenant isolation
  • 7AI gateways
  • 8Environments and delivery for agents
CapstoneA production platform slice for one agentReference implementation

Module 1 · Compute and execution · Lesson 4

Queues, schedules and background jobs

How to buffer bursts, fan out events, keep one customer from starving another, and schedule work for days or weeks, with at-least-once queues, per-tenant concurrency, Little's law sizing and the right scheduler for each wait.

70 min 1 video 3 exercises 7-question quiz Answers
Setup for the exercises:Install Claude CodePython with uvDeploy to Vercel

By the end of this lesson you can

  • Explain at-least-once delivery, leases (visibility timeouts), acknowledgement, retries and idempotent publishing
  • Choose between a queue, a durable workflow and a scheduler for a given piece of agent work
  • Size consumer concurrency with Little's law and set leases and retry caps from processing times
  • Apply per-tenant concurrency keys so one tenant's backlog can't starve another
  • Implement a queue consumer in Python with idempotent handling, backoff and a poison-message cap

On this page

  • Intuition: the post room and the diary
  • Queue semantics, precisely
  • Queue, workflow or scheduler?
  • Flow control: concurrency, throttling and fairness
  • Worked example: sizing the nightly sweep
  • Leases must outlast the work
  • Poison messages cost money
  • Code: an idempotent consumer in Python
  • Schedules: diarising work
  • Misconceptions and limits
  • Connections
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01Intuition: the post room and the diary
  2. 02Queue semantics, precisely
  3. 03Queue, workflow or scheduler?
  4. 04Flow control: concurrency, throttling and fairness
  5. 05Worked example: sizing the nightly sweep
  6. 06Code: an idempotent consumer in Python
  7. 07Schedules: diarising work
  8. 08Misconceptions and limits
  9. 09Connections
  10. 10Summary

Sources & further reading

  • A Fault-Tolerance Shim for Serverless ComputingPaper · Sreekanti, Wu, Chhatrapati, Gonzalez, Hellerstein, Faleiro · UC Berkeley · 2020EuroSys 2020. Shows why retry-based fault tolerance, the default for functions and queue consumers, can persist partial updates to shared state, and what atomic visibility requires. The motivation section is the best short explanation of why at-least-once consumers must be idempotent.
  • Serverless Computing: One Step Forward, Two Steps BackPaper · Hellerstein, Faleiro, Gonzalez, Schleier-Smith, Sreekanti et al. · UC Berkeley · 2018Its critique that functions can only coordinate through slow storage and queues, with no addressable state, explains why chains of queues are a poor substrate for multi-step stateful logic and why workflow engines appeared.
  • Vercel Queues conceptsDocs · VercelTopics and consumer groups, at-least-once delivery, the 60-second default visibility timeout, retention from 60 seconds to 7 days, idempotency keys, approximate ordering, deployment partitioning and the cost of failed deliveries. The most complete public write-up of these semantics.
  • Vercel Queues: Python SDK ReferenceDocs · Vercelsend with idempotency_key and delay, @subscribe with max_concurrency and max_attempts, delivery_count, RetryAfter and the embedded queue service for tests.
  • Inngest concurrencyDocs · InngestConcurrency limits with keys evaluated per event (one limit per tenant), scopes, and the difference between concurrency and throttling. Steps above the limit are queued, not dropped.
  • Vercel Cron Jobs usage and pricingDocs · Vercel100 cron jobs per project; once per day with hourly precision on Hobby, once per minute on Pro. Useful for planning sweeps.
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 10 more sections
  • 3 hands-on exercises
  • A 7-question quiz
  • Progress, quiz scores and bookmarks