:doc:`AgentsforBedrock <../../bedrock-agent>` / Client / associate_agent_knowledge_base

******************************
associate_agent_knowledge_base
******************************



.. py:method:: AgentsforBedrock.Client.associate_agent_knowledge_base(**kwargs)

  

  Associates a knowledge base with an agent. If a knowledge base is associated and its ``indexState`` is set to ``Enabled``, the agent queries the knowledge base for information to augment its response to the user.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-2023-06-05/AssociateAgentKnowledgeBase>`_  


  **Request Syntax**
  ::

    response = client.associate_agent_knowledge_base(
        agentId='string',
        agentVersion='string',
        knowledgeBaseId='string',
        description='string',
        knowledgeBaseState='ENABLED'|'DISABLED'
    )
    
  :type agentId: string
  :param agentId: **[REQUIRED]** 

    The unique identifier of the agent with which you want to associate the knowledge base.

    

  
  :type agentVersion: string
  :param agentVersion: **[REQUIRED]** 

    The version of the agent with which you want to associate the knowledge base.

    

  
  :type knowledgeBaseId: string
  :param knowledgeBaseId: **[REQUIRED]** 

    The unique identifier of the knowledge base to associate with the agent.

    

  
  :type description: string
  :param description: **[REQUIRED]** 

    A description of what the agent should use the knowledge base for.

    

  
  :type knowledgeBaseState: string
  :param knowledgeBaseState: 

    Specifies whether to use the knowledge base or not when sending an `InvokeAgent <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html>`__ request.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'agentKnowledgeBase': {
              'agentId': 'string',
              'agentVersion': 'string',
              'knowledgeBaseId': 'string',
              'description': 'string',
              'createdAt': datetime(2015, 1, 1),
              'updatedAt': datetime(2015, 1, 1),
              'knowledgeBaseState': 'ENABLED'|'DISABLED'
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **agentKnowledgeBase** *(dict) --* 

        Contains details about the knowledge base that has been associated with the agent.

        
        

        - **agentId** *(string) --* 

          The unique identifier of the agent with which the knowledge base is associated.

          
        

        - **agentVersion** *(string) --* 

          The version of the agent with which the knowledge base is associated.

          
        

        - **knowledgeBaseId** *(string) --* 

          The unique identifier of the association between the agent and the knowledge base.

          
        

        - **description** *(string) --* 

          The description of the association between the agent and the knowledge base.

          
        

        - **createdAt** *(datetime) --* 

          The time at which the association between the agent and the knowledge base was created.

          
        

        - **updatedAt** *(datetime) --* 

          The time at which the association between the agent and the knowledge base was last updated.

          
        

        - **knowledgeBaseState** *(string) --* 

          Specifies whether to use the knowledge base or not when sending an `InvokeAgent <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html>`__ request.

          
    
  
  **Exceptions**
  
  *   :py:class:`AgentsforBedrock.Client.exceptions.ThrottlingException`

  
  *   :py:class:`AgentsforBedrock.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`AgentsforBedrock.Client.exceptions.ValidationException`

  
  *   :py:class:`AgentsforBedrock.Client.exceptions.InternalServerException`

  
  *   :py:class:`AgentsforBedrock.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`AgentsforBedrock.Client.exceptions.ConflictException`

  
  *   :py:class:`AgentsforBedrock.Client.exceptions.ServiceQuotaExceededException`

  