:doc:`AgentsforBedrockRuntime <../../bedrock-agent-runtime>` / Client / put_invocation_step

*******************
put_invocation_step
*******************



.. py:method:: AgentsforBedrockRuntime.Client.put_invocation_step(**kwargs)

  

  Add an invocation step to an invocation in a session. An invocation step stores fine-grained state checkpoints, including text and images, for each interaction. For more information about sessions, see `Store and retrieve conversation history and context with Amazon Bedrock sessions <https://docs.aws.amazon.com/bedrock/latest/userguide/sessions.html>`__.

   

  Related APIs:

   

  
  * `GetInvocationStep <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_GetInvocationStep.html>`__
   
  * `ListInvocationSteps <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_ListInvocationSteps.html>`__
   
  * `ListInvocations <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_ListInvocations.html>`__
   
  * `ListSessions <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_ListInvocations.html>`__
  

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/PutInvocationStep>`_  


  **Request Syntax**
  ::

    response = client.put_invocation_step(
        invocationIdentifier='string',
        invocationStepId='string',
        invocationStepTime=datetime(2015, 1, 1),
        payload={
            'contentBlocks': [
                {
                    'image': {
                        'format': 'png'|'jpeg'|'gif'|'webp',
                        'source': {
                            'bytes': b'bytes',
                            's3Location': {
                                'uri': 'string'
                            }
                        }
                    },
                    'text': 'string'
                },
            ]
        },
        sessionIdentifier='string'
    )
    
  :type invocationIdentifier: string
  :param invocationIdentifier: **[REQUIRED]** 

    The unique identifier (in UUID format) of the invocation to add the invocation step to.

    

  
  :type invocationStepId: string
  :param invocationStepId: 

    The unique identifier of the invocation step in UUID format.

    

  
  :type invocationStepTime: datetime
  :param invocationStepTime: **[REQUIRED]** 

    The timestamp for when the invocation step occurred.

    

  
  :type payload: dict
  :param payload: **[REQUIRED]** 

    The payload for the invocation step, including text and images for the interaction.

    .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``contentBlocks``. 

  
    - **contentBlocks** *(list) --* 

      The content for the invocation step.

      

    
      - *(dict) --* 

        A block of content that you pass to, or receive from, a Amazon Bedrock session in an invocation step. You pass the content to a session in the ``payLoad`` of the `PutInvocationStep <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_PutInvocationStep.html>`__ API operation. You retrieve the content with the `GetInvocationStep <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_GetInvocationStep.html>`__ API operation.

         

        For more information about sessions, see `Store and retrieve conversation history and context with Amazon Bedrock sessions <https://docs.aws.amazon.com/bedrock/latest/userguide/sessions.html>`__.

        .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``image``, ``text``. 

      
        - **image** *(dict) --* 

          The image in the invocation step.

          

        
          - **format** *(string) --* **[REQUIRED]** 

            The format of the image.

            

          
          - **source** *(dict) --* **[REQUIRED]** 

            The source for the image.

            .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``bytes``, ``s3Location``. 

          
            - **bytes** *(bytes) --* 

              The raw image bytes for the image. If you use an Amazon Web Services SDK, you don't need to encode the image bytes in base64.

              

            
            - **s3Location** *(dict) --* 

              The path to the Amazon S3 bucket where the image is stored.

              

            
              - **uri** *(string) --* **[REQUIRED]** 

                The path to the Amazon S3 bucket where the image is stored.

                

              
            
          
        
        - **text** *(string) --* 

          The text in the invocation step.

          

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

    The unique identifier for the session to add the invocation step to. You can specify either the session's ``sessionId`` or its Amazon Resource Name (ARN).

    

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

    
    ::

      {
          'invocationStepId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **invocationStepId** *(string) --* 

        The unique identifier of the invocation step in UUID format.

        
  
  **Exceptions**
  
  *   :py:class:`AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundException`

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

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

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

  
  *   :py:class:`AgentsforBedrockRuntime.Client.exceptions.ThrottlingException`

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

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

  