Function evaluateCrossAgentGuardrails

  • Evaluate a chunk through all applicable cross-agent guardrails.

    Filters guardrails to only those observing the source agent, then evaluates the chunk through each. Respects canInterruptOthers flag.

    Parameters

    Returns Promise<CrossAgentEvaluationResult>

    Evaluation result with blocked status and any modifications

    Example

    const result = await evaluateCrossAgentGuardrails(
    crossAgentGuardrails,
    { sourceAgentId: 'worker-1', observerAgentId: 'supervisor' },
    guardrailContext,
    textDeltaChunk
    );

    if (result.blocked) {
    // Terminate the source agent's stream
    } else if (result.modifiedChunk) {
    // Use the sanitized chunk
    }