# A Modular Framework for Domain-Specific Conversational Systems Powered by Never-Ending Learning
## 3 Architecture
### Scalable Architecture  
In addition to being functional, a conversational system architecture must be scalable and support a set of nonfunctional requirements.  
When considering the proposed architecture, the system execution environment must be able to scale up and scale down (ideally in a preventive manner) to avoid the need for contingency actions for availability and performance requirements. The system must serve multiple users with low latency.  
The solution proposed is an architecture based on microservices implemented in containers to promote the scalability of the execution environment. For communication between containers, the system uses message queues based on Kafka technology. Microservices act as specific servers, being defined by a specific functionality or responsibility for action. The microservices mentioned are organized in a communication infrastructure (execution environment) that allows them to interoperate with the required scalability.  
In order to map the components in microservices, the processing times obtained in experiments carried out were taken into account, as well as the degree of coupling between the components. Therefore, the implementation of the following microservices and their respective containers was proposed:  
* NLU: a microservice that mainly contains the existing NLU component;
* BeliefTracker, Policy, and KnowledgeManagement (KM): microservices that contain the aforementioned components. Note that KM is included not as a component but, rather, as a library;
* NLG: a microservice that mainly contains the NLG component and KnowledgeManagement (KM). Again, KM is included as a library;
* Conversational Agent: a microservice that contains the main code (orchestrator) of the conversational agent. In an orchestrated microservices architecture, this is the central microservice.  
In addition to the mentioned microservices, there are also other components designed exclusively for the proposed solution:  
Figure 3: Never-ending learning process.  
* Session: a microservice to simulate the opening of a user session with the system;
* RLog: a component for capturing performance metrics;
* Queues: Kafka technology for asynchronous communication;
* Containers: Docker technology to facilitate the deployment of each microservice with the management of its dependencies;
* Container manager: Kubernetes technology, which consists of an open source container management platform, is also an orchestrator of these containers, their resources, and their scale. After generating the Docker image for each microservice, by using Kubernetes, it is possible to manage the resources that each one will use and scale from, depending on the availability of resources and demand.  
In an orchestrated architecture, there is a central element that makes the decision on the flow to be followed to carry out the processing. In the case of the conversational system, this central element is the Conversational Agent microservice. Figure 4 presents the centralization of logical communication with the Conversational Agent microservice, which decides which microservice to call at each processing step.