Skip to content

Bedrock Agent  >  Operations  >  create_agent

create_agent

Operation

create_agent async

create_agent(input: CreateAgentInput, plugins: list[Plugin] | None = None) -> CreateAgentOutput

Creates an agent that orchestrates interactions between foundation models, data sources, software applications, user conversations, and APIs to carry out tasks to help customers.

  • Specify the following fields for security purposes.

  • agentResourceRoleArn -- The Amazon Resource Name (ARN) of the role with permissions to invoke API operations on an agent.

  • (Optional) customerEncryptionKeyArn -- The Amazon Resource Name (ARN) of a KMS key to encrypt the creation of the agent.

  • (Optional) idleSessionTTLinSeconds -- Specify the number of seconds for which the agent should maintain session information. After this time expires, the subsequent InvokeAgent request begins a new session.

  • To enable your agent to retain conversational context across multiple sessions, include a memoryConfiguration object. For more information, see Configure memory.

  • To override the default prompt behavior for agent orchestration and to use advanced prompts, include a promptOverrideConfiguration object. For more information, see Advanced prompts.

  • If your agent fails to be created, the response returns a list of failureReasons alongside a list of recommendedActions for you to troubleshoot.

  • The agent instructions will not be honored if your agent has only one knowledge base, uses default prompts, has no action group, and user input is disabled.

Parameters:

Name Type Description Default
input CreateAgentInput

An instance of CreateAgentInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
CreateAgentOutput

An instance of CreateAgentOutput.

Input

CreateAgentInput dataclass

Dataclass for CreateAgentInput structure.

Attributes

agent_collaboration class-attribute instance-attribute
agent_collaboration: AgentCollaboration | None = None

The agent's collaboration role.

agent_name class-attribute instance-attribute
agent_name: str | None = None

A name for the agent that you create.

agent_resource_role_arn class-attribute instance-attribute
agent_resource_role_arn: str | None = None

The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the agent.

client_token class-attribute instance-attribute
client_token: str | None = None

A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency.

custom_orchestration class-attribute instance-attribute
custom_orchestration: CustomOrchestration | None = None

Contains details of the custom orchestration configured for the agent.

customer_encryption_key_arn class-attribute instance-attribute
customer_encryption_key_arn: str | None = None

The Amazon Resource Name (ARN) of the KMS key with which to encrypt the agent.

description class-attribute instance-attribute
description: str | None = None

A description of the agent.

foundation_model class-attribute instance-attribute
foundation_model: str | None = None

The identifier for the model that you want to be used for orchestration by the agent you create.

The modelId to provide depends on the type of model or throughput that you use:

guardrail_configuration class-attribute instance-attribute
guardrail_configuration: GuardrailConfiguration | None = None

The unique Guardrail configuration assigned to the agent when it is created.

idle_session_ttl_in_seconds class-attribute instance-attribute
idle_session_ttl_in_seconds: int | None = None

The number of seconds for which Amazon Bedrock keeps information about a user's conversation with the agent.

A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and Amazon Bedrock deletes any data provided before the timeout.

instruction class-attribute instance-attribute
instruction: str | None = field(repr=False, default=None)

Instructions that tell the agent what it should do and how it should interact with users.

memory_configuration class-attribute instance-attribute
memory_configuration: MemoryConfiguration | None = None

Contains the details of the memory configured for the agent.

orchestration_type class-attribute instance-attribute
orchestration_type: OrchestrationType | None = None

Specifies the type of orchestration strategy for the agent. This is set to DEFAULT orchestration type, by default.

prompt_override_configuration class-attribute instance-attribute
prompt_override_configuration: PromptOverrideConfiguration | None = field(repr=False, default=None)

Contains configurations to override prompts in different parts of an agent sequence. For more information, see Advanced prompts.

tags class-attribute instance-attribute
tags: dict[str, str] | None = None

Any tags that you want to attach to the agent.

Output

CreateAgentOutput dataclass

Dataclass for CreateAgentOutput structure.

Attributes

agent instance-attribute
agent: Agent

Contains details about the agent created.