class

Smith::Subagents::SpawnBudget

Inherits Reference < Object

How many subagents the whole run may spawn, shared by every level.

A per-supervisor counter would reset for each nested supervisor, so three levels of twenty would be eight thousand agents — each with its own API calls, each in its own fiber.

Constructors

new(limit : Int32 = Supervisor::MAX_CHILDREN_PER_SESSION)
Source

Instance methods

claim?

Check and decrement in one go. Children run in fibers, and although Crystal's are cooperative, a separate test-then-decrement would be a yield point away from handing out the same slot twice.

Source
exhausted?
Source
limit
Source
remaining
Source