👉 Try the demo: https://github.com/LM-Kit/lm-kit-net-samples/tree/main/console_net/agents/multi_agent_document_review
Multi-Agent Document Review for C# .NET Applications
Purpose of the Sample
Multi-Agent Document Review demonstrates how to use LM-Kit.NET to build a parallel multi-perspective review system using the ParallelOrchestrator where multiple specialized agents analyze the same document simultaneously.
The sample shows how to:
- Create multiple specialized reviewer agents with distinct perspectives.
- Use
ParallelOrchestratorto run agents concurrently. - Aggregate multiple expert opinions into a comprehensive review.
- Display individual reviews and combined summaries.
- Measure execution timing for parallel operations.
Why Parallel Orchestration with LM-Kit.NET?
- Multi-perspective analysis: get diverse expert viewpoints on the same content.
- Time efficiency: parallel execution reduces total review time.
- Comprehensive coverage: each reviewer focuses on their specialty.
- Local-first: all reviews run on your hardware.
- Scalability: easily add more reviewers for additional perspectives.
Target Audience
- Enterprise Developers: build automated document review workflows.
- Legal & Compliance Teams: multi-faceted contract and policy analysis.
- Product Managers: evaluate proposals from technical, business, and risk angles.
- Investment Analysts: comprehensive due diligence reviews.
- Quality Assurance: parallel testing and validation workflows.
Problem Solved
- Comprehensive review: documents analyzed from technical, business, and compliance angles.
- Parallel processing: multiple reviews execute simultaneously.
- Expert perspectives: each reviewer brings domain-specific expertise.
- Unified output: aggregated findings from all reviewers.
- Time savings: parallel execution vs. sequential reviews.
Sample Application Description
Console app that:
- Lets you choose from 5 models suitable for analysis and reasoning.
- Creates three specialized reviewer agents (Technical, Business, Compliance).
- Sets up a ParallelOrchestrator to run all reviewers concurrently.
- Enters an interactive review loop where you can:
- Enter or paste a document/proposal (multi-line input).
- Watch all three reviewers analyze simultaneously.
- See individual reviews from each perspective.
- Receive an aggregated summary.
- Displays execution statistics (success, duration).
- Loops until you type
quitto exit.
Key Features
- ParallelOrchestrator: run multiple agents concurrently.
- Three Expert Reviewers: Technical, Business Analyst, Compliance.
- Chain-of-Thought Reasoning: structured analysis from each reviewer.
- Color-Coded Output: each reviewer's output in distinct colors.
- Timing Metrics: see how long parallel execution takes.
- Multi-Line Input: paste entire documents or proposals.
Built-In Models (menu)
On startup, the sample shows a model selection menu:
| Option | Model | Approx. VRAM Needed |
|---|---|---|
| 0 | Google Gemma 3 4B | ~4 GB VRAM |
| 1 | Microsoft Phi-4 Mini 3.8B | ~3.3 GB VRAM |
| 2 | Meta Llama 3.1 8B | ~6 GB VRAM |
| 3 | Alibaba Qwen-3 8B | ~5.6 GB VRAM |
| 4 | Microsoft Phi-4 14.7B | ~11 GB VRAM |
| other | Custom model URI | depends on model |
The same model is used for all three reviewers. Larger models provide more nuanced analysis.
Reviewer Perspectives
| Reviewer | Focus Areas | Deliverables |
|---|---|---|
| Technical Reviewer | Architecture, scalability, security, implementation complexity | Technical Assessment, Risks, Recommendations |
| Business Analyst | ROI, market impact, resource requirements, timeline | Business Impact, Resource Analysis, Recommendations |
| Compliance Reviewer | Data privacy, regulatory requirements, legal risks, governance | Compliance Assessment, Risk Areas, Required Actions |
Review Flow
Parallel Execution Process
- Document Input: user provides proposal or document to review.
- Parallel Dispatch: all three reviewers receive the document simultaneously.
- Concurrent Analysis: each reviewer analyzes from their perspective.
- Result Collection: orchestrator gathers all reviews.
- Aggregated Summary: combined findings presented to user.
Timing Benefits
Sequential: Technical (30s) + Business (30s) + Compliance (30s) = 90s
Parallel: All three run concurrently = ~30s
Example Documents to Review
Try the sample with:
Technology proposals:
We propose migrating our monolithic application to microservices architecture. This will require 6 months of development effort and $500K budget. Benefits include independent scaling, faster deployments, and technology flexibility.AI initiatives:
Our team recommends adopting AI-powered customer service chatbots to reduce support tickets by 40%. Implementation requires integration with our CRM and training on historical ticket data.Infrastructure changes:
We recommend moving our data center operations to a hybrid cloud model. Estimated cost: $2M over 3 years. Expected savings: $500K annually in operational costs with improved disaster recovery capabilities.
Agent Configuration
using LMKit.Agents;
using LMKit.Agents.Orchestration;
using LMKit.Model;
// Load model (shared by all reviewers)
LM model = new LM(new Uri(modelUri));
// Create specialized reviewer agents
var technicalReviewer = Agent.CreateBuilder(model)
.WithPersona(@"Technical Reviewer - Senior Technical Reviewer with 15+ years experience.
Focus on:
- Technical feasibility and architecture soundness
- Scalability and performance implications
- Security considerations
- Implementation complexity and risks
- Technology choices and alternatives
Provide: Technical Assessment, Risks, and Recommendations.")
.WithPlanning(PlanningStrategy.ChainOfThought)
.Build();
var businessAnalyst = Agent.CreateBuilder(model)
.WithPersona(@"Business Analyst - Expert in ROI analysis and strategic planning.
Focus on:
- Return on investment (ROI) and cost-benefit analysis
- Market impact and competitive advantage
- Resource requirements (budget, personnel, time)
- Business risks and mitigation strategies
- Alignment with business objectives
Provide: Business Impact, Resource Analysis, and Recommendations.")
.WithPlanning(PlanningStrategy.ChainOfThought)
.Build();
var complianceReviewer = Agent.CreateBuilder(model)
.WithPersona(@"Compliance Reviewer - Compliance and Risk Officer with regulatory expertise.
Focus on:
- Data privacy regulations (GDPR, CCPA, etc.)
- Industry-specific compliance requirements
- Security and audit requirements
- Legal risks and liabilities
- Documentation and governance needs
Provide: Compliance Assessment, Risk Areas, and Required Actions.")
.WithPlanning(PlanningStrategy.ChainOfThought)
.Build();
// Create parallel orchestrator
var orchestrator = new ParallelOrchestrator()
.AddAgent("Technical", technicalReviewer)
.AddAgent("Business", businessAnalyst)
.AddAgent("Compliance", complianceReviewer);
// Execute parallel review
var reviewPrompt = $"Please review the following proposal:\n\n{document}";
var results = await orchestrator.ExecuteAsync(reviewPrompt, cancellationToken);
// Access individual reviews
foreach (var agentResult in results.AgentResults)
{
Console.WriteLine($"Review: {agentResult.Content}");
}
// Access aggregated summary
Console.WriteLine($"Summary: {results.Content}");
Console.WriteLine($"Duration: {results.Duration.TotalSeconds:F1}s");
Architecture
┌─────────────────┐
│ User Input │
│ (Document) │
└────────┬────────┘
│
┌────────▼────────┐
│ Parallel │
│ Orchestrator │
└────────┬────────┘
│
┌───────────────────┼───────────────────┐
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Technical │ │ Business │ │ Compliance │
│ Reviewer │ │ Analyst │ │ Reviewer │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
└───────────────────┼───────────────────┘
│
┌────────▼────────┐
│ Aggregator │
│ (Summary) │
└─────────────────┘
Understanding the Output
The demo displays individual reviews in color-coded sections:
| Color | Reviewer | Content |
|---|---|---|
| Yellow | Technical Review | Architecture, scalability, security analysis |
| Green | Business Analysis | ROI, resource requirements, market impact |
| Magenta | Compliance Review | Regulatory requirements, legal risks |
| Cyan | Summary | Aggregated findings from all reviewers |
| Dark Gray | Statistics | Success status and execution duration |
Multi-Line Input
The demo supports multi-line document input:
- Type or paste your document content.
- Press Enter on an empty line to submit.
- Type
quitto exit the application.
Document: We propose implementing a new AI-powered recommendation system
for our e-commerce platform. The system would analyze user behavior
and purchase history to provide personalized product suggestions.
Expected ROI: 15% increase in conversion rate within 6 months.
Budget: $300K for development and integration.
Timeline: 4 months to production.
[Press Enter on empty line to submit]
Behavior & Policies
- Model sharing: same model used for all three reviewers.
- Parallel execution: all reviewers run concurrently (not sequentially).
- Independent analysis: reviewers don't see each other's outputs.
- Result aggregation: orchestrator combines all reviews.
- Timeout: 5-minute timeout per review session.
- Licensing: set an optional license key via
LicenseManager.SetLicenseKey("").
Getting Started
Prerequisites
- .NET 8.0 or later
- Sufficient VRAM for the selected model (4-11 GB depending on model choice)
Download
git clone https://github.com/LM-Kit/lm-kit-net-samples
cd lm-kit-net-samples/console_net/agents/multi_agent_document_review
Run
dotnet build
dotnet run
Then:
- Select a model by typing 0-4, or paste a custom model URI.
- Wait for the model to download (first run) and load.
- Enter or paste a document/proposal to review.
- Press Enter on empty line to submit.
- Watch all three reviewers analyze simultaneously.
- Receive individual reviews and aggregated summary.
- Type
quitto exit.
Troubleshooting
Incomplete reviews
- Document may be too short for detailed analysis.
- Provide more context in your proposal.
Generic responses
- Use a larger model for more nuanced analysis.
- Make proposals more specific with concrete details.
Slow execution
- Parallel execution still requires multiple inference calls.
- Use a smaller or faster model.
Out-of-memory errors
- Single model is shared, so VRAM usage is manageable.
- Pick a smaller model if needed.
Timeout errors
- Long documents may exceed 5-minute timeout.
- Try shorter documents or increase timeout.
Reviews seem similar
- Ensure personas are distinct and focused.
- Check that model supports nuanced role-playing.
Extend the Demo
- Add more reviewers: security expert, UX specialist, financial analyst.
- Custom aggregation: implement weighted scoring or voting mechanisms.
- Consensus detection: highlight agreements and disagreements.
- Document types: create specialized reviewers for contracts, RFPs, research papers.
- Review templates: standardized output formats for different domains.
- Integration: connect to document management systems.