AgentsforBedrock / Client / create_agent

create_agent#

AgentsforBedrock.Client.create_agent(**kwargs)#

Creates an Amazon Bedrock Agent

See also: AWS API Documentation

Request Syntax

response = client.create_agent(
    agentName='string',
    clientToken='string',
    instruction='string',
    foundationModel='string',
    description='string',
    idleSessionTTLInSeconds=123,
    agentResourceRoleArn='string',
    customerEncryptionKeyArn='string',
    tags={
        'string': 'string'
    },
    promptOverrideConfiguration={
        'promptConfigurations': [
            {
                'promptType': 'PRE_PROCESSING'|'ORCHESTRATION'|'POST_PROCESSING'|'KNOWLEDGE_BASE_RESPONSE_GENERATION',
                'promptCreationMode': 'DEFAULT'|'OVERRIDDEN',
                'promptState': 'ENABLED'|'DISABLED',
                'basePromptTemplate': 'string',
                'inferenceConfiguration': {
                    'temperature': ...,
                    'topP': ...,
                    'topK': 123,
                    'maximumLength': 123,
                    'stopSequences': [
                        'string',
                    ]
                },
                'parserMode': 'DEFAULT'|'OVERRIDDEN'
            },
        ],
        'overrideLambda': 'string'
    }
)
Parameters:
  • agentName (string) –

    [REQUIRED]

    Name for a resource.

  • clientToken (string) –

    Client specified token used for idempotency checks

    This field is autopopulated if not provided.

  • instruction (string) – Instruction for the agent.

  • foundationModel (string) – ARN or name of a Bedrock model.

  • description (string) – Description of the Resource.

  • idleSessionTTLInSeconds (integer) – Max Session Time.

  • agentResourceRoleArn (string) –

    [REQUIRED]

    ARN of a IAM role.

  • customerEncryptionKeyArn (string) – A KMS key ARN

  • tags (dict) –

    A map of tag keys and values

    • (string) –

      Key of a tag

      • (string) –

        Value of a tag

  • promptOverrideConfiguration (dict) –

    Configuration for prompt override.

    • promptConfigurations (list) – [REQUIRED]

      List of BasePromptConfiguration

      • (dict) –

        BasePromptConfiguration per Prompt Type.

        • promptType (string) –

          Prompt Type.

        • promptCreationMode (string) –

          Creation Mode for Prompt Configuration.

        • promptState (string) –

          Prompt State.

        • basePromptTemplate (string) –

          Base Prompt Template.

        • inferenceConfiguration (dict) –

          Configuration for inference in prompt configuration

          • temperature (float) –

            Controls randomness, higher values increase diversity

          • topP (float) –

            Cumulative probability cutoff for token selection

          • topK (integer) –

            Sample from the k most likely next tokens

          • maximumLength (integer) –

            Maximum length of output

          • stopSequences (list) –

            List of stop sequences

            • (string) –

        • parserMode (string) –

          Creation Mode for Prompt Configuration.

    • overrideLambda (string) –

      ARN of a Lambda.

Return type:

dict

Returns:

Response Syntax

{
    'agent': {
        'agentId': 'string',
        'agentName': 'string',
        'agentArn': 'string',
        'agentVersion': 'string',
        'clientToken': 'string',
        'instruction': 'string',
        'agentStatus': 'CREATING'|'PREPARING'|'PREPARED'|'NOT_PREPARED'|'DELETING'|'FAILED'|'VERSIONING'|'UPDATING',
        'foundationModel': 'string',
        'description': 'string',
        'idleSessionTTLInSeconds': 123,
        'agentResourceRoleArn': 'string',
        'customerEncryptionKeyArn': 'string',
        'createdAt': datetime(2015, 1, 1),
        'updatedAt': datetime(2015, 1, 1),
        'preparedAt': datetime(2015, 1, 1),
        'failureReasons': [
            'string',
        ],
        'recommendedActions': [
            'string',
        ],
        'promptOverrideConfiguration': {
            'promptConfigurations': [
                {
                    'promptType': 'PRE_PROCESSING'|'ORCHESTRATION'|'POST_PROCESSING'|'KNOWLEDGE_BASE_RESPONSE_GENERATION',
                    'promptCreationMode': 'DEFAULT'|'OVERRIDDEN',
                    'promptState': 'ENABLED'|'DISABLED',
                    'basePromptTemplate': 'string',
                    'inferenceConfiguration': {
                        'temperature': ...,
                        'topP': ...,
                        'topK': 123,
                        'maximumLength': 123,
                        'stopSequences': [
                            'string',
                        ]
                    },
                    'parserMode': 'DEFAULT'|'OVERRIDDEN'
                },
            ],
            'overrideLambda': 'string'
        }
    }
}

Response Structure

  • (dict) –

    Create Agent Response

    • agent (dict) –

      Contains the information of an agent

      • agentId (string) –

        Identifier for a resource.

      • agentName (string) –

        Name for a resource.

      • agentArn (string) –

        Arn representation of the Agent.

      • agentVersion (string) –

        Draft Agent Version.

      • clientToken (string) –

        Client specified token used for idempotency checks

      • instruction (string) –

        Instruction for the agent.

      • agentStatus (string) –

        Schema Type for Action APIs.

      • foundationModel (string) –

        ARN or name of a Bedrock model.

      • description (string) –

        Description of the Resource.

      • idleSessionTTLInSeconds (integer) –

        Max Session Time.

      • agentResourceRoleArn (string) –

        ARN of a IAM role.

      • customerEncryptionKeyArn (string) –

        A KMS key ARN

      • createdAt (datetime) –

        Time Stamp.

      • updatedAt (datetime) –

        Time Stamp.

      • preparedAt (datetime) –

        Time Stamp.

      • failureReasons (list) –

        Failure Reasons for Error.

        • (string) –

          Failure Reason for Error.

      • recommendedActions (list) –

        The recommended actions users can take to resolve an error in failureReasons.

        • (string) –

          The recommended action users can take to resolve an error in failureReasons.

      • promptOverrideConfiguration (dict) –

        Configuration for prompt override.

        • promptConfigurations (list) –

          List of BasePromptConfiguration

          • (dict) –

            BasePromptConfiguration per Prompt Type.

            • promptType (string) –

              Prompt Type.

            • promptCreationMode (string) –

              Creation Mode for Prompt Configuration.

            • promptState (string) –

              Prompt State.

            • basePromptTemplate (string) –

              Base Prompt Template.

            • inferenceConfiguration (dict) –

              Configuration for inference in prompt configuration

              • temperature (float) –

                Controls randomness, higher values increase diversity

              • topP (float) –

                Cumulative probability cutoff for token selection

              • topK (integer) –

                Sample from the k most likely next tokens

              • maximumLength (integer) –

                Maximum length of output

              • stopSequences (list) –

                List of stop sequences

                • (string) –

            • parserMode (string) –

              Creation Mode for Prompt Configuration.

        • overrideLambda (string) –

          ARN of a Lambda.

Exceptions

  • AgentsforBedrock.Client.exceptions.ThrottlingException

  • AgentsforBedrock.Client.exceptions.AccessDeniedException

  • AgentsforBedrock.Client.exceptions.ValidationException

  • AgentsforBedrock.Client.exceptions.InternalServerException

  • AgentsforBedrock.Client.exceptions.ConflictException

  • AgentsforBedrock.Client.exceptions.ServiceQuotaExceededException