October 26, 2026
Container-based managed SaaS architecture for multichannel communication with messaging and generative artificial intelligence
Rensi Copari Arteaga; Diego Marques de Carvalho
DOI: 10.22167/2675-6528-202603438
Article derived from a Course Conclusion Work (TCC), with content based on the student’s original work and adapted to the editorial format of the E&S Magazine with the support of the ResumeAI tool, an artificial intelligence solution developed by Instituto Pecege for textual synthesis and organization.
Summary
A multi-channel communication SaaS architecture, based on containers managed by AWS Fargate, was developed with serverless characteristics, such as the absence of direct server management and automatic scalability. The solution was designed to simplify integration with different messaging providers, such as email and WhatsApp, using AWS services and Apache Kafka for event-driven asynchronous processing. The objective was to propose and validate a scalable and extensible architecture, equipped with mechanisms for resilience and integrated with large language models (LLMs) for automated responses and the execution of external functions through function calling. The methodology included test-driven development (TDD), the implementation of a functional Minimum Viable Product (MVP), and load testing with the k6 tool. The results demonstrated the elastic behavior of the architecture and its technical viability in the experimental environment, with 0% HTTP failures in the evaluated acceptance endpoint. However, the absence of real failover tests, complete end-to-end latency measurement, and systematic evaluation of LLMs prevented confirmation of its production readiness.
Keywords: Event-driven architecture; Intelligent automation; Cloud computing; Horizontal scalability; Asynchronous messaging.
1. Introduction
Digital communication has evolved significantly in recent years, resulting in an expansion of touchpoints through which customers interact with companies. In this scenario, the integration between various channels has become crucial to provide a consistent experience throughout the customer journey, as highlighted by Verhoef, Kannan, and Inman (2015) and Lemon and Verhoef (2016). This need drives the development of systems capable of managing interactions across multiple media in a unified way.
From a technical point of view, integrating different message and service providers presents complex challenges. These include the need to decouple components, ensure elasticity, handle failures robustly, and manage dependency on external providers (Hohpe and Woolf, 2012; Newman, 2015). Monolithic architectures, by their nature, often demonstrate limitations in these contexts, especially regarding on-demand scalability and isolation between system parts (Newman, 2015).
To overcome such challenges, the adoption of event-driven architectures, combined with containerized computing managed under the serverless paradigm, emerges as a promising alternative (Hohpe and Woolf, 2012; Jonas et al., 2019). Asynchronous messaging, exemplified by Apache Kafka, allows for decoupling between event producers and consumers, in addition to enabling reprocessing and delivery guarantees (Kleppmann, 2017; Narkhede et al., 2022). Complementarily, AWS Fargate offers the execution of containers without the need to manage underlying servers, promoting automatic scalability and operational efficiency (AWS, 2024; Jonas et al., 2019).
Additionally, the advancement of Large Language Models (LLMs) introduces new possibilities for response automation and the execution of dynamic logic based on natural language. This capability significantly expands the functionalities of communication systems, enabling more intelligent and personalized interactions (Bommasani et al., 2021; Zhao et al., 2023). The integration of LLMs into multichannel communication architectures can, therefore, transform the way companies interact with their customers.
The choice of an asynchronous approach is a fundamental premise for building systems that demand high concurrency and resilience. It allows decoupling the API from communication channels, LLMs, and other providers, absorbing demand peaks through the messaging layer, and scaling the API, workers, and artificial intelligence components independently. This approach also facilitates backpressure control and event reprocessing, preserving data integrity during temporary unavailability. However, the effectiveness of an event-driven SaaS architecture, based on asynchronous messaging and managed containers, in supporting multichannel communication integrated with language models, and its behavior in terms of scalability, latency, and stability in an experimental environment, still require practical validation.
Given this context, this work has as its main objective to validate, through practical experimentation, the viability of an architecture based on managed containers (AWS Fargate), event-driven and integrated with language models (LLMs), to support multichannel communication systems.
2. Material and Methods
The present research was characterized as applied, with an experimental approach, focusing on the development of a Minimum Viable Product (MVP). The adopted methodology was based on the incremental implementation of the proposed solution, allowing for the validation of architectural and technical decisions throughout the development and evaluation of the proposal’s viability in controlled scenarios.
The solution development was conducted incrementally, starting with the definition of the architecture and the implementation of a functional MVP. This approach allowed for the progressive validation of the main solution components, including the messaging layer, integration with external providers, and asynchronous processing.
During development, architectural decisions were guided by criteria of scalability, decoupling, and fault tolerance. The event-driven architecture, with Apache Kafka, favored isolation between components and reduced the immediate impact of unavailability in external services. The adoption of managed containers on AWS Fargate enabled observing auto-scaling activation without direct server management.
The solution’s architecture was designed according to the Software as a Service (SaaS) model, allowing web access and enabling the evolution to a logically multi-tenant environment. The solution adopted an event-driven approach, using messaging to promote decoupling between components, increase scalability, and reduce the impact of failures in external services (Hohpe and Woolf, 2012; Richards and Ford, 2020).
The asynchronous approach was adopted as an architectural premise, due to the requirements of decoupling, peak absorption, reprocessing, and integration with external providers subject to availability variations. It allowed decoupling the API from channels, the LLM, and other providers, responding quickly with HTTP acceptance, absorbing peaks through the messaging layer, and scaling API, workers, and AI independently.
The choice of technologies used in the MVP development considered requirements for high concurrency, scalability, and asynchronous processing. The Go programming language was selected based on its ability to handle a large volume of simultaneous requests and the availability of libraries and tools for integration with external services.
For messaging, Apache Kafka was adopted, due to its support for high throughput, topic partitioning, and parallel message consumption, essential characteristics for the proposed scenario. The cloud infrastructure was implemented on AWS, using Amazon ECS with AWS Fargate for orchestration and execution of containers without server management, with CPU-based auto scaling.
Amazon Bedrock was used for access to large-scale language models (LLMs) via a managed API, without operating its own ML infrastructure. The database used was Amazon RDS (Aurora MySQL-compatible), ensuring ACID transactions, backups, and managed high availability.
The validation strategy adopted combined different levels of testing. Test-Driven Development (TDD) was used to validate business rules and application layer behaviors, following the Red-Green-Refactor cycle for incremental implementation (Beck, 2003). Automated tests were implemented in Go, using `go test`, the `testing` package, `Testify` for assertions, `httptest` for simulating HTTP endpoints, and dependency mocks like `go-sqlmock`.
This approach allowed for the validation of critical system components without direct dependency on external infrastructure, covering input validation, business rules, message persistence, error handling and propagation, API Key authentication, middleware behaviors, and handler responses. The execution of the suites included multiple success and error scenarios, encompassing modules such as internal chat channels, handlers, middleware, models, and persistence.
Load and performance tests were carried out in two experimental stages with distinct objectives, rates, and configurations. The first stage focused on initial flow validation, with rates between 1 and 5 requests per second, using a fixed task and without an auto-scaling policy. The second stage aimed to observe the auto-scaling behavior, with a progressive target rate between 100 and 3,000 requests per second and a limit of three tasks.
In the second stage, the load was applied with a “ramping arrival rate” model, starting with 100 requests per second and gradually increasing over 2 minutes to 3,000 requests per second. The load was sustained for 6 minutes, followed by a 2-minute gradual reduction phase. A maximum of 5,000 virtual users were allowed, with 1,000 pre-allocated, to ensure maximum pressure on the system.
For the execution of load tests, the k6 tool was used, with npm scripts for orchestration and reporting, executed on an EC2 instance to generate the load. AWS CloudWatch was used to collect logs and metrics of CPU, memory, number of tasks, and throughput during the tests, allowing observation of the system’s behavior under load.
During the execution of the tests, metrics were collected such as HTTP acceptance latency (time between request submission and endpoint response), p95 and p99 percentiles of the HTTP acceptance endpoint, effective throughput (requests effectively initiated per second in relation to the target rate), HTTP failures and “dropped iterations” (iterations that k6 could not initiate), in addition to CPU consumption, memory, and number of tasks to observe auto scaling activation.
The internal evaluation criteria defined included p95 latency below 100 ms on the HTTP acceptance endpoint, HTTP error rate below 1% on the evaluated endpoint, effective throughput and efficiency relative to the target rate, and an increase in the number of tasks in response to load growth for elasticity. The 100 ms limit for latency was adopted as an internal experiment criterion and does not represent an end-to-end delivery SLA.
The architecture incorporated a generative AI component to interpret messages and execute dynamic logic. The MVP separated the messaging service, responsible for channels, persistence, and Kafka events, from the ai-worker, responsible for asynchronous processing with LLM. This division allowed communication and AI to be scaled independently.
The integration with LLM was performed through Amazon Bedrock, using its conversation API (Converse API). In the experiment, the Anthropic Claude 3 Haiku model (anthropic.claude-3-haiku-20240307-v1:0) was used, in the us-east-1 region, with a temperature of 0.7 and a limit of 1,024 tokens. The LLM driver abstraction layer allows configuring the model and region, facilitating the replacement or extension to other providers.
The LLM processing flow involved receiving the message via REST API or webhook, validation, and association with the vendor, channel, and conversation. The system then selected the appropriate assistant and published the message to the Kafka input topic for asynchronous processing. The ai-worker consumed the event, constructed the prompt, loaded available functions, and invoked the language model.
In the execution of “function calling”, the model received the prompt and a list of available functions, deciding between producing a final response or requesting an external function. When a function was requested, the system extracted the JSON parameters, executed the HTTP call, and returned the result to the model. After processing, the response was published to the output topic and sent to the channel by a messaging worker, with logging of messages and executed functions for traceability.
The logical data model adopted in the MVP was designed to ensure end-to-end traceability of messages, conversations, and events associated with different communication channels. The modeling included entities for vendors, channel configurations, incoming and outgoing messages, conversations, and webhook delivery mechanisms. The MVP used API Key and encryption for sensitive channel configurations, and the vendor association prepared the evolution towards multi-tenancy.
3. Results and Discussion
The present research validated a multi-channel communication SaaS architecture, based on containers managed by AWS Fargate, with serverless characteristics, and event-driven, using Apache Kafka for asynchronous messaging. The results demonstrated the technical viability of the solution in an experimental environment, confirming the functional integration of various channels and the capacity for intelligent automation through Large Language Models (LLMs). Load tests evidenced the elastic behavior of the architecture and its stability, with 0% HTTP failures in the evaluated acceptance endpoint, although important limitations were identified, which prevent affirming its readiness for large-scale production.
Functional system validation
The functional validation of the system was performed by executing different usage scenarios, including sending messages via email, integration with external APIs, and authentication by access key. Additional tests for channel listing and message sending confirmed the correct implementation of the REST API. The system demonstrated appropriate behavior when receiving a request with an invalid API key, returning an HTTP 401 authentication error. In contrast, using valid credentials resulted in an HTTP 202 Accepted response, evidencing the effective implementation of the security mechanism.
To complement the functional validation, a web demonstration interface was developed, which allowed direct interaction with the proposed architecture. This testing environment, accessible via browser, enabled users to send messages directly to the system, interact with the LLM-based agent, test automated responses in real-time, and access integration with the WhatsApp channel. The interface demonstrated the fluid integration between the frontend, the backend in managed containers, and the artificial intelligence services, reinforcing the practical proof of the solution in an experimental environment.
WhatsApp Channel Validation and LLM Integration
The integration with the WhatsApp channel was successfully implemented, using webhooks from the Meta platform for real-time message reception. The system demonstrated the ability to receive messages from users, process the content using a Large Language Model (LLM), generate automatic responses, and send them back to the user via WhatsApp. This functionality validated the solution’s capability to operate as a real-time conversational assistant, managing the complete flow of communication and user interaction.
One of the main differentials of the system was the implementation of the “function calling” functionality with LLMs, which allows the dynamic execution of external functions based on natural language. The system was able to interpret a user request, such as an inquiry about a city’s weather, execute an external function to obtain geographic coordinates, invoke a second API for meteorological data, and consolidate the response for the user. This process highlighted the integration between the language model and the execution of external functions, expanding the system’s capabilities.
The integration with the LLM was performed through Amazon Bedrock, using its conversation API (Converse API). In the experiment, the Anthropic Claude 3 Haiku model was employed, configured with a temperature of 0.7 and a limit of 1,024 tokens. The choice of Amazon Bedrock was due to its managed integration and Converse API support, without a quality or cost comparison with other providers. An LLM driver abstraction layer was implemented to allow model and region configuration, facilitating future replacements or extensions to other providers.
The LLM processing flow involved receiving the message via REST API or webhook, validating it, and associating it with a vendor, channel, and conversation. The system prioritized selecting an assistant associated with the conversation, channel, or vendor default. The message was published to an input Kafka topic for asynchronous processing. The ai-worker consumed the event, constructed the prompt, loaded available functions, and invoked the language model, managing the retry loop until the final response was generated. After processing, the response was published to an output topic and sent to the channel by a messaging worker.
The system logged received and sent messages, executed functions, and model responses to maintain flow traceability. However, the validation performed only proved the functional flow, without a systematic evaluation of model unavailability, timeouts, retries, backoff, unprocessed message queues, or recovery after failures. These mechanisms, essential for production resilience, were not presented as validated results, and the accuracy of external sources or the overall quality of the model’s responses were not systematically assessed.
Logical data model
The logical data model adopted in the Minimum Viable Product (MVP) was designed to ensure end-to-end traceability of messages, conversations, and events associated with the different communication channels. The modeling included entities for vendors, channel configurations, incoming and outgoing messages, conversations, and delivery mechanisms via webhooks. For enhanced security, sensitive columns, such as connection configurations for external providers (SendGrid, Facebook) in the “vendor_channels” table, were encrypted.
Security, logical isolation and data protection
The MVP used API Key for authentication and encryption of sensitive channel configurations. Vendor-based association was implemented to prepare for the evolution to a multi-tenant environment, but complete isolation between tenants was not proven. For a production deployment, additional requirements are necessary such as per-tenant authorization, secure secret management, least privilege IAM, webhook protection, rate limiting, retention and deletion policies, data minimization, and control of personal information sent to LLMs and external providers, ensuring LGPD compliance.
Infrastructure on AWS Fargate
The architecture’s services were executed in containers on AWS Fargate, with CPU-based auto scaling, which allowed for automatic scalability according to demand. The configuration of a typical task used 1 vCPU and 3 GB of memory. This serverless approach eliminated the need for direct server management, optimizing operation and resource allocation. The auto scaling capability of AWS Fargate was a central element in demonstrating the architecture’s elasticity in response to load variations.
Automated test results (TDD)
The execution of automated tests, based on the Test-Driven Development (TDD) methodology, confirmed the validation of the main behaviors of the application layer. The test suites included multiple success and error scenarios, covering modules such as internal chat channels, handlers, middleware, models, and persistence. This approach contributed to the reduction of regressions during development and increased system reliability, especially in a distributed architecture with multiple integration points. 77 automated test functions were implemented, in addition to several subtests, covering the main flows and components of the application.
Automated tests covered input validation, API Key authentication, message persistence, and error handling, ensuring the correct functioning of business rules and the integration between components. Code coverage was used as an auxiliary indicator by package, for diagnostic purposes, and not as an absolute quality goal. This decision stemmed from the fact that a relevant part of the architecture depends on external integrations and asynchronous behavior, aspects that are not adequately represented by a global unit coverage metric, being more appropriately evaluated by integration tests and observation in an integrated environment.
Load test results
The load and performance tests were divided into two experimental stages with distinct objectives and configurations, without the intention of a controlled causal comparison. The first stage focused on initial flow validation, with a load rate between 1 and 5 requests per second, using a fixed task and without an auto-scaling policy. During this phase, the endpoint responded without HTTP failures at the applied rates, confirming the basic functional stability of the architecture under low load.
The second stage aimed to observe the auto scaling behavior under a progressive load, with target rates varying between 100 and 3,000 requests per second and a configured limit of three tasks. The auto scaling mechanism was triggered correctly, and the service reached the maximum limit of three tasks in response to the increased load. The observed effective rates were approximately 810 requests per second for a target of 1,000, 1,605 requests per second for 2,000, and 2,388 requests per second for 3,000, demonstrating that the effective throughput remained below the target rate at all levels.
Although the effective throughput was below the target rates, no HTTP failures occurred at the evaluated acceptance endpoint, indicating the architecture’s stability even under controlled saturation. Efficiencies between effective throughput and target rate were 81.0%, 80.25%, and 79.6%, respectively, with 0% HTTP failures. The acceptance HTTP latency for the target rate of 3,000 requests per second was 96.04 ms at the 95th percentile (p95) and 231.72 ms at the 99th percentile (p99). It is important to note that these values do not include queue time, LLM inference, external provider submission, or final user response delivery.
During load tests, 13,109 “dropped iterations” were recorded, indicating that the k6 tool failed to initiate all planned iterations. This behavior may have limited the load effectively applied to the system, influencing the ability to assert that the target rate was fully received. The tests were conducted in a controlled environment, using an EC2 instance as a load generator, which implies that network latency between the generator and the system under test may not fully reflect real-world distributed production scenarios.
Auto scaling assessment
The architecture demonstrated the activation of automatic horizontal scalability through AWS Fargate in the experimental environment. The number of tasks increased to the configured maximum of three in response to the CPU metric, evidencing the elasticity of the evaluated configuration. This behavior confirms AWS Fargate’s ability to dynamically adjust resources based on demand, a fundamental requirement for high-concurrency systems. However, this observation does not prove production readiness, given the limitations of the experimental environment.
Descriptive analysis of the experimental stages
The experimental stages had distinct purposes: the first verified the flow with reduced load, while the second observed the activation of auto scaling under increasing load. Due to the non-equivalent rates and durations, the results do not allow quantifying the exclusive gain of auto scaling nor directly comparing latency and throughput between the stages. A future controlled comparison would require repeating the same script, duration, and rates, contrasting scenarios with a fixed task and with auto scaling to isolate the effects.
The results demonstrated the functional integration of the channels, asynchronous processing, the use of LLM with function calling, and the activation of auto scaling in the experimental environment. The architecture incorporates mechanisms for decoupling and fault handling, but its resilience was not validated by real failover tests. The integration with LLMs allowed the system to go beyond deterministic flows, enabling natural language interpretation and dynamic execution of external actions, which, together, demonstrate the technical viability of the architecture in the evaluated experimental environment.
From an engineering perspective, AWS Fargate triggered auto scaling in the experimental setup. However, the maximum limit of three tasks and the absence of a controlled comparison require caution when extrapolating performance and cost to production environments. In future runs, the maximum number of tasks and the scalability policy should consider performance, messaging backlog, and operational cost. The use of Apache Kafka proved effective for decoupling and asynchronous processing, although it implies an increase in operational complexity.
Usage metrics and cost estimation
The experiment did not consolidate the total number of invocations, input and output tokens, inference latency, or cost per conversation. Consequently, it was not possible to validate the economic feasibility of the solution. A future evaluation should calculate the AI cost based on input and output tokens, and separate the costs of Fargate, Kafka, RDS/Aurora, CloudWatch, data transfer, Bedrock, and channel providers. Without real financial measurement, the values should be presented only as an estimate of the experimental environment, which limits the ability to project costs for a production scenario.
The proposed architecture is especially indicated for systems that demand high message volume, multiple communication channels, and the need for intelligent automation based on natural language. On the other hand, it may not be the best choice for low-scale applications or those with simple requirements, where the additional complexity introduced by an event-driven, serverless architecture integrated with LLMs may not be justified in terms of cost-benefit or operationality. In lower volume scenarios, simpler solutions, such as managed queues (e.g., AWS SQS), may offer a better cost-benefit ratio.
In summary, the experimental validation confirmed the functional integrity of the proposed SaaS architecture for multichannel communication, demonstrating the successful integration of asynchronous messaging channels via Apache Kafka and the capability for dynamic automation by LLMs with function calling. The elastic behavior under load, with AWS Fargate scaling tasks and maintaining 0% HTTP failures at the acceptance endpoint, supports the technical viability of the solution in a controlled environment, addressing the objective of validating a scalable, event-driven architecture integrated with LLMs.
4. Conclusion
This work aimed to validate, through practical experimentation, the viability of an architecture based on managed containers (AWS Fargate), event-driven and integrated with language models (LLMs), to support multichannel communication systems. The technical viability of the solution was verified in an experimental environment, demonstrating the functional integration of various asynchronous messaging channels, such as email and WhatsApp. The capacity for intelligent automation through LLMs was identified, using the function calling feature for dynamic execution of external functions based on natural language. The elastic behavior of the architecture under load was observed, with AWS Fargate automatically scaling tasks and maintaining 0% HTTP failures at the evaluated acceptance endpoint. The use of Apache Kafka proved effective for decoupling producers and consumers and for asynchronous message processing. The main contribution of the study lies in the proposition and validation of a scalable and extensible SaaS architecture, which extends multichannel communication systems beyond deterministic flows, allowing for natural language interpretation and dynamic execution of external actions.
However, the study presented important limitations that prevent affirming the architecture’s readiness for large-scale production. These include the absence of real failover tests, complete end-to-end latency measurement, and a systematic evaluation of LLMs, including their unavailability and response quality. The economic feasibility of the solution was not validated, as the consolidated cost per conversation and detailed service costs were not recorded. The experimental environment, with non-equivalent load stages and a limit of three tasks, restricts the extrapolation of results to production scenarios. For future studies, it is suggested to conduct a controlled comparison of auto-scaling policies, failover and multi-region tests, and complete end-to-end latency and consumer lag measurement. A systematic evaluation of LLMs is also recommended, with complete guardrails and human confirmation for critical actions, in addition to the integral validation of security, multi-tenancy, and LGPD compliance, and cost optimization.
Bibliographic References
AWS. 2024. AWS Fargate Documentation. Disponível em: https://docs.aws.amazon.com/fargate/. Acesso em: 2026.
Beck, K. 2003. Test-Driven Development: By Example. Addison-Wesley, Boston, MA, USA.
Bommasani, R. et al. 2021. On the Opportunities and Risks of Foundation Models. arXiv preprint arXiv:2108.07258. DOI: https://doi.org/10.48550/arXiv.2108.07258
Hohpe, G.; Woolf, B. 2012. Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions. Addison-Wesley, Boston, MA, USA.
Jonas, E. et al. 2019. Cloud Programming Simplified: A Berkeley View on Serverless Computing. arXiv preprint arXiv:1902.03383. DOI: https://doi.org/10.48550/arXiv.1902.03383
Kleppmann, M. 2017. Designing Data-Intensive Applications. O’Reilly Media, Sebastopol, CA, USA.
Lemon, K. N.; Verhoef, P. C. 2016. Understanding Customer Experience Throughout the Customer Journey. Journal of Marketing, 80(6): 69-96. DOI: https://doi.org/10.1509/jm.15.0420
Narkhede, N.; Shapira, G.; Palino, T. 2022. Kafka: The Definitive Guide. 2nd ed. O’Reilly Media, Sebastopol, CA, USA.
Newman, S. 2015. Building Microservices: Designing Fine-Grained Systems. O’Reilly Media, Sebastopol, CA, USA.
Richards, M.; Ford, N. 2020. Fundamentals of Software Architecture: An Engineering Approach. O’Reilly Media, Sebastopol, CA, USA.
Verhoef, P. C.; Kannan, P. K.; Inman, J. J. 2015. From Multi-Channel Retailing to Omni-Channel Retailing: Introduction to the Special Issue on Multi-Channel Retailing. Journal of Retailing, 91(2): 174–181. DOI: https://doi.org/10.1016/j.jretai.2015.02.005
Zhao, W. X. et al. 2023. A Survey of Large Language Models. arXiv preprint arXiv:2303.18223. DOI: https://doi.org/10.48550/arXiv.2303.18223
Article originating from the Final Course Work of the Specialization in Software Engineering of the MBA USP/Esalq
To learn more about the course, click here and access the MBX Academy platform