BaseGuardrail

Abstract base class for custom guardrails. Implement check and async_check to validate run input.

BaseGuardrail is the abstract base class for guardrails. Subclass it and implement check and async_check to build a custom guardrail.

from agno.guardrails import BaseGuardrail

Methods

check

Perform the guardrail checks synchronously.

Parameters:

  • run_input (RunInput | TeamRunInput): The input provided to the Agent or Team when invoking the run.

Returns: None

async_check

Perform the guardrail checks asynchronously.

Parameters:

  • run_input (RunInput | TeamRunInput): The input provided to the Agent or Team when invoking the run.

Returns: None