CONFIDENTIAL CLIENT
How we helped a lawtech structure the architecture of its legal generative AI product
Redesigning a legal GenAI product architecture with agent orchestration
Intelligent orchestration of specialized agentsStructured evaluation to balance accuracy, latency, and costScalable architecturebuilt for high demand
While building version 1 of its new AI platform for the legal sector, a Brazilian lawtech with more than 15 years in the market ran into a classic, critical challenge in generative AI projects: how to balance technical accuracy, response time, and financial sustainability in an increasingly complex architecture. As new features were added, multiple models, APIs, and separate services piled up. The result was a fragmented structure, hard to manage, with significant swings in latency and cost. Working with BlueMetrics, the company completely redesigned its AI architecture around an intelligent agent orchestration layer, a systematic model evaluation process, and a scalable cloud foundation. The result was a platform that answers 95% of queries in under 5 seconds, with accuracy above 90% and simultaneous processing of more than 1,000 requests with no noticeable drop in performance, setting a solid base for sustainable growth.
Overview
Known for its work in legal security and cryptography, the lawtech in question saw an inevitable market shift coming: AI would stop being a differentiator and become a competitive requirement.
The new platform was designed to support lawyers in tasks such as:
- Legislation research
- Doctrine analysis
- Drafting legal documents
- Generating contextualized answers based on interaction history
The concept was promising. Execution, though, exposed real structural challenges. With multiple models under test and different query flows running side by side, the architecture grew steadily more complex. Every new feature demanded more integrations, latency tuning, and another look at costs.
Three variables started to concentrate the tension in the project:
- Legal accuracy of the answers
- Low latency for a smooth experience
- Sustainable operating costs
Without an architectural overhaul, the risk was clear: both the user experience and the product’s ability to scale were on the line.
Problem: growing complexity and no standardization
As the product evolved, the lack of structured criteria for model evaluation and agent orchestration began to show concrete effects:
- Significant latency swings depending on which model was called
- Costs climbing fast as volume grew
- Difficulty comparing model performance objectively
- Fragmented orchestration across multiple agents and APIs
Beyond the technical challenges, there was business pressure: launch a mature, reliable, competitive solution in a legal market that leans more on technology every year.
It was clear the problem was not just performance. It was architecture.
Solution: a generative AI architecture built on intelligent orchestration
BlueMetrics led a full architecture rebuild around three central pillars: structured model evaluation, intelligent agent orchestration, and native cloud scalability.
1. Structured, continuous model evaluation
We defined objective criteria to select and compare language models, looking at:
- Latency
- Legal accuracy
- Contextual relevance
- Cost per request
With standardized tests and validation by legal experts, the team moved to a continuous evaluation process. That removed decisions based purely on subjective perception and brought technical and financial predictability to the product.
2. Orchestration with a master agent and specialized subagents
One of the biggest steps forward was an orchestration layer with a master agent that interprets each query and routes it to the right flow.
This central agent coordinates specialized subagents, such as:
- Information retrieval agents (RAG)
- External API integration agents
- Custom agents for specific legal tasks
Communication between these agents was standardized, ensuring interoperability, structure, and room to evolve later.
The result was a modular architecture, more predictable and far simpler to maintain.
3. Vector search and legal contextualization
To keep answers coherent and deep, we implemented advanced vector search techniques that allow:
- Precise retrieval of legal documents
- Answers grounded in relevant context
- Continuity across interactions based on the user’s history
This layer was essential to raise the technical quality of the answers, bringing the system’s behavior closer to the reasoning expected in a legal setting.
4. Cloud scalability and governance
The architecture was built to scale horizontally, absorbing demand spikes without any drop in performance.
On top of the serverless processing layer and secure storage, we put in robust mechanisms for:
- Monitoring
- Structured logging
- Traceability of models and interactions
- Data governance
That delivered not only performance but also reliability and easy auditing, a critical factor in the legal sector.
Results:
The new architecture delivered strong gains across four main dimensions.
Performance
- 95% of queries answered in under 5 seconds
- More than 1,000 simultaneous requests processed with no noticeable degradation
- Startup time under 2 seconds
Accuracy and relevance
- Accuracy above 90%
- Average rating above 4/5 from legal experts
- Coherent, contextualized answers aligned with the user’s history
Operational efficiency
Standardizing the orchestration cut the complexity of managing the architecture significantly. The team gained more control over how the product evolves, how new models are tested, and how costs are forecast.
Scalability and sustainability
The infrastructure now scales automatically with demand, holding the balance between performance and operating cost, which is essential as the user base grows.
Conclusion:
This project shows that in generative AI solutions applied to law, the competitive edge is not just the model you pick but the architecture behind its operation.
By building a robust agent orchestration layer, running careful model evaluation, and securing scalability with governance, the lawtech turned its AI from a promising technical experiment into a core strategic asset of the product.
More than improving performance, the company raised its architectural maturity, creating a solid base for continuous innovation and sustainable growth.