AgentPromptVariantProps

class aws_cdk.aws_bedrock_alpha.AgentPromptVariantProps(*, model, variant_name, prompt_variables=None, agent_alias, prompt_text)

Bases: CommonPromptVariantProps

(experimental) Properties for creating an agent prompt variant.

Parameters:
  • model (IBedrockInvokable) – (experimental) The model which is used to run the prompt. The model could be a foundation model, a custom model, or a provisioned model.

  • variant_name (str) – (experimental) The name of the prompt variant.

  • prompt_variables (Optional[Sequence[str]]) – (experimental) The variables in the prompt template that can be filled in at runtime. Default: - No variables defined.

  • agent_alias (IAgentAlias) – (experimental) An alias pointing to the agent version to be used.

  • prompt_text (str) – (experimental) The text prompt. Variables are used by enclosing its name with double curly braces as in {{variable_name}}.

Stability:

experimental

ExampleMetadata:

fixture=default infused

Example:

cmk = kms.Key(self, "cmk")

# Assuming you have an existing agent and alias
agent = bedrock.Agent.from_agent_attributes(self, "ImportedAgent",
    agent_arn="arn:aws:bedrock:region:account:agent/agent-id",
    role_arn="arn:aws:iam::account:role/agent-role"
)

agent_alias = bedrock.AgentAlias.from_attributes(self, "ImportedAlias",
    alias_id="alias-id",
    alias_name="my-alias",
    agent_version="1",
    agent=agent
)

agent_variant = bedrock.PromptVariant.agent(
    variant_name="agent-variant",
    model=bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0,
    agent_alias=agent_alias,
    prompt_text="Use the agent to help with: {{task}}. Please be thorough and provide detailed explanations.",
    prompt_variables=["task"]
)

bedrock.Prompt(self, "agentPrompt",
    prompt_name="agent-prompt",
    description="Prompt for agent interactions",
    default_variant=agent_variant,
    variants=[agent_variant],
    kms_key=cmk
)

Attributes

agent_alias

(experimental) An alias pointing to the agent version to be used.

Stability:

experimental

model

(experimental) The model which is used to run the prompt.

The model could be a foundation model, a custom model, or a provisioned model.

Stability:

experimental

prompt_text

(experimental) The text prompt.

Variables are used by enclosing its name with double curly braces as in {{variable_name}}.

Stability:

experimental

prompt_variables

(experimental) The variables in the prompt template that can be filled in at runtime.

Default:
  • No variables defined.

Stability:

experimental

variant_name

(experimental) The name of the prompt variant.

Stability:

experimental