lotus
Project description
LOTUS: Optimized Agentic and LLM Bulk Processing
Bulk process your datasets with agents and LLMs at scale, with higher accuracy and lower cost.
From Stanford University and UC Berkeley
What is LOTUS? • Install • Quickstart • Semantic Operators • Community • Docs • Cite
What is LOTUS?
LOTUS makes agentic and LLM bulk processing fast, easy, and robust. It introduces and optimizes
semantic operators (e.g., LLM-based map,
reduce, filter primitives) to let you process your large datasets with LLMs and natural language instructions. LOTUS optimizes these operations to help you get higher accuracy and lower cost.
What you can build:
- Agentic code processing — run a tool-using agent (with a sandboxed Python REPL) over every file, document, or record, then reduce to one answer (codebase analysis, security sweeps, migrations).
- Deep research & synthesis — fan out over a corpus, extract, and synthesize.
- Agent-trace failure analysis — mine large volumes of agent logs for failure modes.
- Document extraction & unstructured analysis — structured fields and insights from text.
- LLM-judge evals & RAG — declarative pipelines that the engine optimizes for you.
LOTUS stands for LLMs Over Text, Unstructured and Structured Data.
Installation
pip install lotus-ai
Or with uv: uv add lotus-ai. For the latest features, install
from source: pip install git+https://github.com/lotus-data/lotus.git@main.
See the docs for more.
Quickstart
Give LOTUS a corpus and a task. It shards the corpus, spawns an agent per shard in parallel (each with a sandboxed Python REPL for exact computation), and reduces the per-shard findings into one answer. The example below is fully self-contained — set your API key, paste, and run.
import lotus
from lotus.models import LM
from lotus.tools import PythonREPLTool
# Configure the LM — export your API key first (e.g. export OPENAI_API_KEY=sk-...)
lotus.settings.configure(lm=LM(model="gpt-5", reasoning_effort="low"))
# A corpus can be inline documents, a DataFrame, files, or one large text.
# Here: a few small functions, some of them subtly buggy.
snippets = [
"def average(nums): return sum(nums) / (len(nums) - 1)",
"def word_count(s): return len(s.split())",
"def percent(part, whole): return part / whole",
"def reverse(s): return s[::-1]",
]
corpus = lotus.Corpus.from_documents(snippets)
# Each agent actually *runs* its function in a sandboxed REPL to find bugs —
# then LOTUS reduces the per-function results into one report.
result = corpus.agent(
task="Test each function on example inputs and report which ones are buggy, "
"with a counterexample for each bug.",
ops=["map", "reduce"], # compose agentic ops: map, filter, reduce
tools=[PythonREPLTool()],
)
print(result.output) # the reduced bug report
See the Agentic Map-Reduce docs
and examples/agentic_map_reduce/ for more.
How it works
You express what you want over a dataset using high-level semantic operators (i.e., LLM-based map, reduce, filter); LOTUS' optimizer decides how to run it — batching calls, applying model cascades and proxies, and lazily planning the whole pipeline — for higher accuracy at lower cost.
The Results: Across diverse tasks, LOTUS' optimized pipelines match or exceed the accuracy of high-quality baselines while running substantially faster and cheaper:
What are Semantic Operators
LOTUS introduced and optimizes semantic operators. Each operator implements an LLM-based transformation over your dataset, which you specify with a natural language instruction, and the operations can be transparently optimized. Here are a few examples:
LOTUS supports two classes of semantic operators, so you can match the execution style to the task:
-
Agentic operators run tool-using agents over a corpus (
corpus.agent(ops=["map", "filter", "reduce"], ...)). They shine on complex or ambiguous tasks that benefit from multiple steps and tool calls — running code to compute exact values, parsing files, sweeping a codebase, or filtering with non-trivial judgment. See the runnableexamples/agentic_map_reduce/(an expense-report roll-up and a codebase sweep). -
LLM operators (
sem_map,sem_filter,sem_agg,sem_join,sem_extract, …) invoke far fewer model calls per record and are ideal for well-defined tasks — LLM-as-judge evaluations, document and attribute extraction, and unstructured data analysis at scale.
See the documentation and the intro Colab tutorial for more on semantic operators that LOTUS serves.
Docs
For more, you can checkout the official docs, which includes more on:
- Installation & Core Concepts
- Agentic Semantic Operators — the
Corpus, agentic map-reduce and filter, tools/REPL, and worked examples - LLM Semantic Operators —
sem_map,sem_filter,sem_agg,sem_join, and more - Optimizations — the query engine, cascades, and lazy execution
- Supported Models — LMs, retrievers, rerankers (any LiteLLM provider)
Community
Join us on Discord to ask questions and share what you're building.
Check out these awesome projects that are building with LOTUS:
- MAP: Measuring Agents in Production — a large-scale empirical study of deployed LLM agent systems across many domains (UC Berkeley, Intesa Sanpaolo, UIUC, Stanford, IBM Research; ICML 2026).
- VibeCheck — discovers and quantifies qualitative differences between LLMs (UC Berkeley; ICLR 2025).
- DeepScholar — generative research synthesis over the scientific literature, competitive with OAI DR (Stanford, UC Berkeley).
Using LOTUS in your project? Reach out to @semantic_operators on discord if you'd like it featured.
Contributing
We welcome all contributions! Read the Contributing Guide. For trouble-shooting or feature requests, open an issue and we'll get to it promptly.
References
Follow @lianapatel_ on X for updates. If you find LOTUS or semantic operators useful, please cite:
@article{patel2025semanticoptimization,
title = {Semantic Operators and Their Optimization: Enabling LLM-Based Data Processing with Accuracy Guarantees in LOTUS},
author = {Patel, Liana and Jha, Siddharth and Pan, Melissa and Gupta, Harshit and Asawa, Parth and Guestrin, Carlos and Zaharia, Matei},
year = {2025},
journal = {Proc. VLDB Endow.},
url = {https://doi.org/10.14778/3749646.3749685},
}
@article{patel2024semanticoperators,
title={Semantic Operators: A Declarative Model for Rich, AI-based Analytics Over Text Data},
author={Liana Patel and Siddharth Jha and Parth Asawa and Melissa Pan and Carlos Guestrin and Matei Zaharia},
year={2024},
eprint={2407.11418},
url={https://arxiv.org/abs/2407.11418},
}
@article{patel2026ainative,
title = {Towards AI-Native Data Systems with the Semantic Operator Model and LOTUS},
author = {Patel, Liana and Guestrin, Carlos and Zaharia, Matei},
year = {2026},
journal = {IEEE Data Engineering Bulletin},
url = {http://sites.computer.org/debull/A26mar/A26MAR-CD.pdf#page=61},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lotus_ai-1.2.4.tar.gz.
File metadata
- Download URL: lotus_ai-1.2.4.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03f116ad4af2fea2066117ced65938a96c4cc81ed616315cf18e862b29a6547d
|
|
| MD5 |
676764b31451f92549a9b41463024589
|
|
| BLAKE2b-256 |
186fc27a0d19917e22f0c59d29760ee0ec51c03fa8c114de981540dae54b95fb
|
File details
Details for the file lotus_ai-1.2.4-py3-none-any.whl.
File metadata
- Download URL: lotus_ai-1.2.4-py3-none-any.whl
- Upload date:
- Size: 182.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4803bcba7a30d50095b0c6fc5036942ebd1cfceb42a3f907454892c11171fa89
|
|
| MD5 |
47438813261b648044ea12fe7a8e7550
|
|
| BLAKE2b-256 |
7de0837860bc0b6bae63a7acc93e7f9c9afdccd6acf27e73d7a629062d5109a0
|