Function Call Dispatcher

The dispatcher is where the harness pays for every promise the schema made. Timeouts, retries, dedupe, error mapping. All on one seam.

Build 1.5 hr Python

Prerequisites: Phase 13 lessons 01-07, Phase 14 lesson 01

#Learning Objectives

  • Wrap a tool handler in a per-call timeout that returns a typed error instead of hanging the loop.
  • Apply exponential backoff retry with jitter and a maximum attempt count.
  • Deduplicate retries on an idempotency key so a retry that races with a slow original does not run twice.
  • Map handler exceptions and transport faults onto a single error envelope the harness loop already understands.
  • Bound parallel dispatch with a concurrency limit so a fan-out of forty tool calls does not exhaust the event loop.
Full Access lesson

Keep going. The rest of this lesson is one step away.

Unlock all 503 lessons, video, code, quizzes and every future update. Pay in your own currency with Paystack.

The text and code of this lesson are based on AI Engineering from Scratch by Rohit Ghumare, MIT licensed.