Skip to content

BedrockClient.create_guardrail

rboto-bedrock==0.4.0 · Service index · Types

Model summary (excerpt): Creates a guardrail to block topics and to implement safeguards for your generative AI applications. You can configure the following policies in a guardrail to avoid undesirable and harmful content, filter out denied topics and words, and remove sensitive information for privacy protection. Content filters - Adjust filter strengths to block input prompts or model responses containing harmful...

Install and imports

python -m pip install "rboto[bedrock]==0.4.0"
from rboto import BedrockClient
from collections.abc import Sequence
from rboto_bedrock.types import (
    CreateGuardrailOutput,
    GuardrailAutomatedReasoningPolicyConfig,
    GuardrailContentPolicyConfig,
    GuardrailContextualGroundingPolicyConfig,
    GuardrailCrossRegionConfig,
    GuardrailSensitiveInformationPolicyConfig,
    GuardrailTopicPolicyConfig,
    GuardrailWordPolicyConfig,
    Tag,
)

Signature

async def create_guardrail(
    *,
    name: str,
    blocked_input_messaging: str,
    blocked_outputs_messaging: str,
    description: str | None = None,
    topic_policy_config: GuardrailTopicPolicyConfig | None = None,
    content_policy_config: GuardrailContentPolicyConfig | None = None,
    word_policy_config: GuardrailWordPolicyConfig | None = None,
    sensitive_information_policy_config: GuardrailSensitiveInformationPolicyConfig | None = None,
    contextual_grounding_policy_config: GuardrailContextualGroundingPolicyConfig | None = None,
    automated_reasoning_policy_config: GuardrailAutomatedReasoningPolicyConfig | None = None,
    cross_region_config: GuardrailCrossRegionConfig | None = None,
    kms_key_id: str | None = None,
    tags: Sequence[Tag] | None = None,
    client_request_token: str | None = None,
) -> CreateGuardrailOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
name Yes The name to give the guardrail.
blocked_input_messaging Yes The message to return when the guardrail blocks a prompt.
blocked_outputs_messaging Yes The message to return when the guardrail blocks a model response.
description No A description of the guardrail.
topic_policy_config No The topic policies to configure for the guardrail.
content_policy_config No The content filter policies to configure for the guardrail.
word_policy_config No The word policy you configure for the guardrail.
sensitive_information_policy_config No The sensitive information policy to configure for the guardrail.
contextual_grounding_policy_config No The contextual grounding policy configuration used to create a guardrail.
automated_reasoning_policy_config No Optional configuration for integrating Automated Reasoning policies with the new guardrail.
cross_region_config No The system-defined guardrail profile that you're using with your guardrail. Guardrail profiles define the destination Amazon Web Services Regions where guardrail inference requests can be automatically routed. For more information, see the Amazon Bedrock User Guide .
kms_key_id No The ARN of the KMS key that you use to encrypt the guardrail.
tags No The tags that you want to attach to the guardrail.
client_request_token No A unique, case-sensitive identifier to ensure that the API request completes no more than once. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency in the Amazon S3 User Guide .

Output

CreateGuardrailOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
guardrail_id str Always present —
guardrail_arn str Always present —
version str Always present —
created_at str Always present —

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

CreateGuardrailOutput, GuardrailAutomatedReasoningPolicyConfig, GuardrailContentPolicyConfig, GuardrailContextualGroundingPolicyConfig, GuardrailCrossRegionConfig, GuardrailSensitiveInformationPolicyConfig, GuardrailTopicPolicyConfig, GuardrailWordPolicyConfig, Tag

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_bedrock.exceptions:

AccessDeniedError, ConflictError, InternalServerError, ResourceNotFoundError, ServiceQuotaExceededError, ThrottlingError, TooManyTagsError, ValidationError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model