How it Works / How to Build It
- Query Rewrite: This node takes the research_question and jurisdiction inputs to expand the query with relevant legal terms and synonyms.
- Retriever: Using the expanded query from the QueryRewrite node, this node searches a legal document index for relevant statutes and case law, returning a set of search results.
- Reading List Generator: This node generates a CSV reading list from the search results provided by the Retriever node.
- Memo Gen Agent: This node creates a legal research memo using the research_question, jurisdiction, date_range, and the search results. It structures the memo into sections such as authorities, holdings, reasoning, applicability, and risks.
- Citation Validator: This node validates the citations extracted from the memo generated by the Memo Gen Agent. It checks for proper formatting and grounding in the retrieved search results.
- Final Output Reading List: This node outputs the reading list in CSV format.
- Final Output Memo: This node outputs the legal research memo in markdown format.
- Final Output Citations: This node outputs the validated citations in JSON format.
What You Can Use This For
- Legal research and analysis for law firms.
- Generating comprehensive legal memos for case preparation.
- Creating reading lists of relevant legal documents for specific research topics.
- Validating legal citations for compliance with standards.
Prerequisites
- Vellum account.
- Access to a legal document index (e.g., "example-legal-documents").
- Basic understanding of legal research concepts.
How to Set It Up
- Create a new workflow in your Vellum account.
- Add the Query Rewrite node and configure it with your research_question and jurisdiction inputs.
- Connect the Query Rewrite node to the Retriever node.
- Set the Retriever node to search the specified legal document index.
- Connect the Retriever node to both the Reading List Generator and Memo Gen Agent nodes.
- Configure the Memo Gen Agent node to use the outputs from the Retriever and include the date_range input.
- Connect the Memo Gen Agent to the Citation Validator node.
- Connect the Citation Validator node to the Final Output Citations node.
- Connect the Reading List Generator to the Final Output Reading List node.
- Connect the Memo Gen Agent to the Final Output Memo node.
- Test the workflow with sample inputs to ensure it generates the desired outputs.
FAQs
1. Can I adapt this workflow for different jurisdictions or areas of law?
Absolutely. You can update the jurisdiction input or modify the Query Rewrite node’s prompt to include domain-specific terminology (e.g., “contract law” or “intellectual property”). If you have separate document indexes for each jurisdiction, simply point the Retriever node to the corresponding index for accurate results.
2. How does the workflow ensure the citations are accurate and verifiable?
The Citation Validator node compares every extracted citation from the memo against the original documents retrieved by the Retriever node. This ensures that the references aren’t hallucinated and are properly grounded in the source material. You can also extend it to cross-check against external citation APIs if your organization uses one.
3. Can I modify the memo format or add sections (like counterarguments or precedent summaries)?
Yes. The Memo Gen Agent node is fully customizable — you can adjust the system prompt to change the tone, depth, or structure of the memo. For example, you might add a “Counter arguments” section by prompting the model to identify opposing case law and summarize the reasoning behind it.
4. What’s the best way to expand the search coverage for complex legal questions?
Try enhancing the Query Rewrite node’s logic to generate multiple reformulated queries or expand to include related statutes and case law. You can also run multiple Retriever nodes in parallel against different indexes (like federal vs. state) and merge the results before feeding them into the Memo Gen Agent.
5. Can I use this workflow outside of law firms for compliance, policy, or academic research?
Yes, the same structure works for any domain where grounded document analysis matters. By swapping the legal index with a policy, academic, or regulatory corpus, you can turn this into a compliance memo generator or research brief builder with minimal configuration changes.
6. What are the best ways to extend these workflows once I’ve deployed them?
Many builders start by integrating evaluation nodes or API endpoints. You can also chain outputs into new workflows, like feeding a generated memo into a summarizer or compliance checker for example. Each template is designed to scale from single-use agents to production-ready systems.
Discover more AI agent templates to automate different aspects of your business
Hear it from our customers


.webp)
Build any AI agent with Vellum
.webp)
