📄 Paper: L-MARS: Legal Multi-Agent Workflow with Orchestrated Reasoning and Agentic Search
L-MARS (Legal Multi-Agent Framework for Orchestrated Reasoning and Agentic Search) combines multiple search strategies, agent-based reasoning, and evaluation systems for legal QA.

- Simple Mode: Fast single-turn pipeline with multiple search results
- Multi-Turn Mode: Iterative refinement with judge agent evaluation and deep content extraction
- Online Search (Default): Web search via Serper API - Always enabled
- Simple mode: Quick search returning 5 results with snippets
- Multi-turn mode: Deep search returning 3 results with full content extraction
- Local RAG (Optional): BM25-based local document retrieval from
inputs/folder - Enable with--offline-rag - Case Law (Optional): Legal case retrieval via CourtListener API - Enable with
--courtlistener
# Clone the repository
git clone https://github.com/yourusername/l-mars.git
cd l-mars
# Install the package with dependencies
pip install -e .
# Set up environment variables
cp .env.example .env
# Edit .env and add your API keys:
# - OPENAI_API_KEY (required)
# - SERPER_API_KEY (required, for web search)
# - COURTLISTENER_API_TOKEN (optional, for case law)Place your legal documents in markdown format in the inputs/ folder:
# Create inputs directory
mkdir -p inputs
# Add your markdown documents
cp your_legal_docs/*.md inputs/The system will automatically index and search these documents.
# Quick legal research with online search only (default)
python main.py "Your legal question"
# Enable offline RAG for local documents
python main.py --offline-rag "Your legal question"
# Enable all sources (offline RAG + CourtListener + web search)
python main.py --all-sources "Your legal question"
# With verbose output
python main.py -v "Your legal question"# Thorough research with refinement
python main.py --multi "Complex contract dispute..."
# With custom iterations
python main.py --multi --max-iterations 5 "Your question"If you use L-MARS in your research, please cite:
@misc{wang2025lmarslegalmultiagentworkflow,
title={L-MARS: Legal Multi-Agent Workflow with Orchestrated Reasoning and Agentic Search},
author={Ziqi Wang and Boqin Yuan},
year={2025},
eprint={2509.00761},
archivePrefix={arXiv},
primaryClass={cs.AI},
url={https://arxiv.org/abs/2509.00761},
}