Local Development with Kubernetes Environment#

If you are deploying ACE Agent as part of a more complex Kubernetes environment, for example, to create an interactive avatar experience with multiple ACE microservices, you will often want to test the bot you are developing directly in the setup environment. Testing the bot as part of the Kubernetes deployment will allow you to check the multimodal aspects of the interaction like the animations of the avatar, the voice, timings of response and more.

To simplify this workflow and to allow for fast iteration times, it is possible to run the Chat Engine in your local Python environment and connect it to your running Kubernetes deployment. In this case, you can test changes to the Colang scripts or bot configurations simply by restarting the Chat Engine locally.

In this section, we will showcase steps for using the local Chat Engine in the event interface, but similar steps should work for the Chat Engine server interface also.

  1. Replace the Chat Engine microservice from your UCS application specification with local chat engine deployment by updating connection for Chat Controller egress endpoint chat_api.

    dependencies:
    [...]
    - ucf.svc.riva.speech-skills:2.15.1
    # Remove chat-engine from the dependency list
    <Remove>- ucf.svc.ace-agent.chat-engine:4.0.0</Remove>
    - ucf.svc.ace-agent.chat-controller:4.0.0
    
    [...]
    
    components:
    [...]
    # Remove the chat-engine from the list of components
    <Remove>- name: chat-engine
    type: ucf.svc.ace-agent.chat-engine
    parameters:
        imagePullSecrets:
        - name: ngc-docker-reg-secret
    secrets:
        ngc-api-key-secret: k8sSecret/ngc-api-key-secret/NGC_CLI_API_KEY
        openai-key-secret: k8sSecret/openai-key-secret/OPENAI_API_KEY</Remove>
    [...]
    # Add the local chat engine as external endpoint to the component list
    - name: engine-placeholder
    type: ucf.svc.external-endpoint
    parameters:
        # Update Local Chat Engine deployment IP Port
        service: 127.0.0.1
        port: 8000
    
    [...]
    
    connections:
    [...]
    # Remove outgoing connections from chat-engine (since we removed it above)
    <Remove>  chat-engine/plugin-server: plugin-server/http-api
    chat-engine/redis: redis-timeseries/redis</Remove>
    # Point the chat-api egress connection to the engine-placeholder
    chat-controller/chat-api: engine-placeholder/endpoint
    
  2. Redeploy your UCS application by following the Kubernetes environment section.

  3. In a separate terminal, use port forwarding or exposing nodePort to connect to the Redis time series microservice inside the cluster.

    kubectl port-forward $(kubectl get pods | grep redis-timeseries | awk '{print $1}') 30379:6379
    
  4. Start ACE Agent locally in your Python environment (refer to Python Environment for more information).

    aceagent chat event -c bots/your_bot/ --event-provider-port 30379 --log-level=INFO
    
  5. Edit the Colang Script and any bot configurations, save any changes to disk and simply restart the ACE Agent (CTRL+C and repeat the previous step) to test your changes.