Strands Agents Typescript SDK
    Preparing search index...

    Class GuardContentBlock

    Guard content block for guardrail evaluation. Marks content that should be evaluated by guardrails for safety, grounding, or other policies. Can be used in both message content and system prompts.

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    type: "guardContentBlock" = ...

    Discriminator for guard content.

    Text content with evaluation qualifiers.

    Image content with evaluation qualifiers.

    Methods

    • Serializes the GuardContentBlock to a JSON-compatible ContentBlockData object. Called automatically by JSON.stringify(). Uint8Array image bytes are encoded as base64 string.

      Returns {
          guardContent: {
              text?: { qualifiers: GuardQualifier[]; text: string };
              image?: { format: GuardImageFormat; source: { bytes: string } };
          };
      }

    • Creates a GuardContentBlock instance from its wrapped data format. Base64-encoded image bytes are decoded back to Uint8Array.

      Parameters

      • data: {
            guardContent: {
                text?: { qualifiers: GuardQualifier[]; text: string };
                image?: {
                    format: GuardImageFormat;
                    source: { bytes: string | Uint8Array<ArrayBufferLike> };
                };
            };
        }

        Wrapped GuardContentBlockData to deserialize (accepts both string and Uint8Array for image bytes)

      Returns GuardContentBlock

      GuardContentBlock instance