Interface ResourceControls

Resource limits applied to the entire agency run. The onLimitReached policy determines whether a breach is fatal.

interface ResourceControls {
    maxTotalTokens?: number;
    maxCostUSD?: number;
    maxDurationMs?: number;
    maxAgentCalls?: number;
    maxStepsPerAgent?: number;
    maxEmergentAgents?: number;
    onLimitReached?: "error" | "stop" | "warn";
}

Properties

maxTotalTokens?: number

Maximum total tokens (prompt + completion) across all agents and steps.

maxCostUSD?: number

Maximum USD cost cap across the entire run.

maxDurationMs?: number

Wall-clock time budget for the run in milliseconds.

maxAgentCalls?: number

Maximum number of agent invocations (across all agents).

maxStepsPerAgent?: number

Maximum steps per individual agent invocation.

maxEmergentAgents?: number

Maximum number of emergent agents the orchestrator may synthesise.

onLimitReached?: "error" | "stop" | "warn"

Action taken when any resource limit is breached.

  • "stop" — gracefully stop and return partial results.
  • "warn" — emit a limitReached event and continue.
  • "error" — throw an error and halt immediately.