AgentProps

class aws_cdk.aws_bedrock_alpha.AgentProps(*, foundation_model, instruction, action_groups=None, agent_collaboration=None, agent_name=None, code_interpreter_enabled=None, custom_orchestration_executor=None, description=None, existing_role=None, force_delete=None, idle_session_ttl=None, kms_key=None, memory=None, prompt_override_configuration=None, should_prepare_agent=None, user_input_enabled=None)

Bases: object

(experimental) Properties for creating a CDK managed Bedrock Agent.

TODO: Knowledge bases configuration will be added in a future update TODO: Guardrails configuration will be added in a future update TODO: Inference profile configuration will be added in a future update

Parameters:
  • foundation_model (IBedrockInvokable) – (experimental) The foundation model used for orchestration by the agent.

  • instruction (str) – (experimental) The instruction used by the agent. This determines how the agent will perform his task. This instruction must have a minimum of 40 characters.

  • action_groups (Optional[Sequence[AgentActionGroup]]) – (experimental) The Action Groups associated with the agent. Default: - Only default action groups (UserInput and CodeInterpreter) are added

  • agent_collaboration (Optional[AgentCollaboration]) – (experimental) Configuration for agent collaboration settings, including AgentCollaboratorType and AgentCollaborators. This property allows you to define how the agent collaborates with other agents and what collaborators it can work with. Default: - No agent collaboration configuration.

  • agent_name (Optional[str]) – (experimental) The name of the agent. This will be used as the physical name of the agent. Default: - A name is generated by CDK. Supported pattern : ^([0-9a-zA-Z][_-]?){1,100}$

  • code_interpreter_enabled (Optional[bool]) – (experimental) Select whether the agent can generate, run, and troubleshoot code when trying to complete a task. Default: - false

  • custom_orchestration_executor (Optional[CustomOrchestrationExecutor]) – (experimental) The Lambda function to use for custom orchestration. If provided, custom orchestration will be used. If not provided, default orchestration will be used. Default: - Default orchestration

  • description (Optional[str]) – (experimental) A description of the agent. Default: - No description is provided.

  • existing_role (Optional[IRole]) – (experimental) An existing IAM Role to associate with this agent. Use this property when you want to reuse an existing IAM role rather than create a new one. The role must have a trust policy that allows the Bedrock service to assume it. Default: - A new role is created for you.

  • force_delete (Optional[bool]) – (experimental) Whether to delete the resource even if it’s in use. Default: - false

  • idle_session_ttl (Optional[Duration]) – (experimental) How long sessions should be kept open for the agent. If no conversation occurs during this time, the session expires and Amazon Bedrock deletes any data provided before the timeout. Default: - 10 minutes

  • kms_key (Optional[IKey]) – (experimental) The KMS key of the agent if custom encryption is configured. Default: - An AWS managed key is used.

  • memory (Optional[Memory]) – (experimental) The type and configuration of the memory to maintain context across multiple sessions and recall past interactions. This can be useful for maintaining continuity in multi-turn conversations and recalling user preferences or past interactions. Default: - No memory will be used. Agents will retain context from the current session only.

  • prompt_override_configuration (Optional[PromptOverrideConfiguration]) – (experimental) Overrides some prompt templates in different parts of an agent sequence configuration. Default: - No overrides are provided.

  • should_prepare_agent (Optional[bool]) – (experimental) Specifies whether to automatically update the DRAFT version of the agent after making changes to the agent. The DRAFT version can be continually iterated upon during internal development. Default: - false

  • user_input_enabled (Optional[bool]) – (experimental) Select whether the agent can prompt additional information from the user when it does not have enough information to respond to an utterance. Default: - false

Stability:

experimental

ExampleMetadata:

fixture=default infused

Example:

parser_function = lambda_.Function(self, "ParserFunction",
    runtime=lambda_.Runtime.PYTHON_3_10,
    handler="index.handler",
    code=lambda_.Code.from_asset("lambda")
)

agent = bedrock.Agent(self, "Agent",
    foundation_model=bedrock.BedrockFoundationModel.AMAZON_NOVA_LITE_V1,
    instruction="You are a helpful assistant.",
    prompt_override_configuration=bedrock.PromptOverrideConfiguration.with_custom_parser(
        parser=parser_function,
        pre_processing_step=bedrock.PromptPreProcessingConfigCustomParser(
            step_type=bedrock.AgentStepType.PRE_PROCESSING,
            use_custom_parser=True
        )
    )
)

Attributes

action_groups

(experimental) The Action Groups associated with the agent.

Default:
  • Only default action groups (UserInput and CodeInterpreter) are added

Stability:

experimental

agent_collaboration

(experimental) Configuration for agent collaboration settings, including AgentCollaboratorType and AgentCollaborators.

This property allows you to define how the agent collaborates with other agents and what collaborators it can work with.

Default:
  • No agent collaboration configuration.

Stability:

experimental

agent_name

(experimental) The name of the agent.

This will be used as the physical name of the agent.

Default:

  • A name is generated by CDK.

Supported pattern : ^([0-9a-zA-Z][_-]?){1,100}$

Stability:

experimental

code_interpreter_enabled

(experimental) Select whether the agent can generate, run, and troubleshoot code when trying to complete a task.

Default:
  • false

Stability:

experimental

custom_orchestration_executor

(experimental) The Lambda function to use for custom orchestration.

If provided, custom orchestration will be used. If not provided, default orchestration will be used.

Default:
  • Default orchestration

Stability:

experimental

description

(experimental) A description of the agent.

Default:
  • No description is provided.

Stability:

experimental

existing_role

(experimental) An existing IAM Role to associate with this agent.

Use this property when you want to reuse an existing IAM role rather than create a new one. The role must have a trust policy that allows the Bedrock service to assume it.

Default:
  • A new role is created for you.

Stability:

experimental

force_delete

(experimental) Whether to delete the resource even if it’s in use.

Default:
  • false

Stability:

experimental

foundation_model

(experimental) The foundation model used for orchestration by the agent.

Stability:

experimental

idle_session_ttl

(experimental) How long sessions should be kept open for the agent.

If no conversation occurs during this time, the session expires and Amazon Bedrock deletes any data provided before the timeout.

Default:
  • 10 minutes

Stability:

experimental

instruction

(experimental) The instruction used by the agent.

This determines how the agent will perform his task. This instruction must have a minimum of 40 characters.

Stability:

experimental

kms_key

(experimental) The KMS key of the agent if custom encryption is configured.

Default:
  • An AWS managed key is used.

Stability:

experimental

memory

(experimental) The type and configuration of the memory to maintain context across multiple sessions and recall past interactions.

This can be useful for maintaining continuity in multi-turn conversations and recalling user preferences or past interactions.

Default:
  • No memory will be used. Agents will retain context from the current session only.

See:

https://docs.aws.amazon.com/bedrock/latest/userguide/agents-memory.html

Stability:

experimental

prompt_override_configuration

(experimental) Overrides some prompt templates in different parts of an agent sequence configuration.

Default:
  • No overrides are provided.

Stability:

experimental

should_prepare_agent

(experimental) Specifies whether to automatically update the DRAFT version of the agent after making changes to the agent.

The DRAFT version can be continually iterated upon during internal development.

Default:
  • false

Stability:

experimental

user_input_enabled

(experimental) Select whether the agent can prompt additional information from the user when it does not have enough information to respond to an utterance.

Default:
  • false

Stability:

experimental