entorin

Agentic search (fanout)

Schedule N parallel branches, merge the results, audit the structural fork/join. Cumulative cost capped by the same budget gate as everything else.

Schedule N parallel branches, merge the results, audit the structural fork/join. BudgetGate on the run-shared Ledger naturally caps cumulative cost across all branches; per-branch slicing is the caller’s closure.

from entorin.search import fanout, best_of_n

async def branch(i):
    ...                              # call your Model with a per-branch budget hint
    return result

best = await fanout(
    [lambda i=i: branch(i) for i in range(5)],
    ctx=ctx, bus=bus,
    parent_node="search",
    merge=best_of_n(scorer=lambda r: r.confidence),
)

Merges

best_of_n ships. Anything else — majority vote, judge-pick, domain-specific scoring — you build. Merge is a plain Callable[[Sequence[T]], R] alias.

Budget

The parent run’s BudgetGate enforces cumulative cost across every branch. There is no per-branch budget primitive: if you want one, slice your principal’s cap before opening the fanout, or pass a per-branch hint into branch() and check it inside.