Cross-agent guardrails to apply
Source/observer agent context
Standard guardrail context
Source agent's output stream
Stream options
Supervised stream with cross-agent guardrail filtering
// Supervisor monitors worker agent
const supervisedStream = wrapWithCrossAgentGuardrails(
[qualityGate, policyEnforcer],
{
sourceAgentId: 'worker-analyst',
observerAgentId: 'supervisor',
agencyId: 'research-agency'
},
guardrailContext,
workerStream,
{ streamId: 'stream-xyz' }
);
for await (const chunk of supervisedStream) {
// Chunk has been approved/modified by cross-agent guardrails
yield chunk;
}
Wrap an agent's output stream with cross-agent guardrail supervision.
Creates an async generator that evaluates each chunk through applicable cross-agent guardrails before yielding. If any guardrail returns BLOCK (and has
canInterruptOthers: true), the stream is terminated.