Open Agent Loops
API Reference

ModelGate

@open-agent-loops/core


type ModelGate = (request) => void | Promise<void>;

Defined in: compose.ts:68

A pre-call admission gate awaited before each model request.

Parameters

ParameterTypeDescription
requestModelRequestThe request about to be sent.

Returns

void | Promise<void>

Remarks

Receives the outgoing ModelRequest — including its signal — and resolves to admit the call or rejects to refuse it. A gate that waits for capacity (a live concurrency budget) MUST honor request.signal, so a run cancelled while parked in the gate unwinds instead of hanging.

On this page