lotus-data/lotus

Optimized Agentic and LLM Bulk Processing Over Your Data

LOTUS – Optimized Agentic and LLM Bulk Processing

What it is – LOTUS is a Python library (available on PyPI as lotus‑ai) that lets you run semantic operators—LLM‑driven map, filter, reduce, join, etc.—over large text‑heavy datasets. The library ships an optimizer that batches calls, cascades models, and lazily plans pipelines so you get higher accuracy while spending less on API calls.

Key ideas

  • Semantic operators – high‑level, declarative primitives that describe what you want (e.g., “extract the title from each paper”) and let the LLM do the transformation.
  • Agentic operators – a special class that runs a tool‑using agent (with a sandboxed Python REPL) on each shard, useful for complex or ambiguous tasks that need code execution or multi‑step reasoning.
  • Optimizer – automatically decides how to batch, cascade, and schedule the LLM calls, reducing cost and improving result quality.

Typical use‑cases

  • Code‑base analysis or security sweeps (run an agent on every file, then reduce to a bug report).
  • Large‑scale research synthesis (search a corpus, extract key points, and generate a summary).
  • Failure‑mode mining from agent logs.
  • Structured extraction from unstructured documents.
  • Row‑by‑row LLM‑as‑judge evaluation of model outputs.
  • Retrieval‑augmented generation (RAG) over private data.

How you use it (from the README)

import lotus
from lotus.models import LM
from lotus.tools import PythonREPLTool

lotus.settings.configure(lm=LM(model="gpt-5", reasoning_effort="low"))

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)

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"],
    tools=[PythonREPLTool()],
)
print(result.output)

The snippet shows the three steps: create a Corpus, describe a task, and invoke agent with a list of semantic operators and optional tools.

Installation

  • pip install lotus-ai (or uv add lotus-ai).
  • For the latest code: pip install git+https://github.com/lotus-data/lotus.git@main.

Documentation & community

  • Full docs at https://lotus‑ai.readthedocs.io.
  • Colab demo, Discord server, and a set of example scripts under examples/.
  • The project is backed by researchers from Stanford and UC Berkeley and cites three peer‑reviewed papers (arXiv 2407.11418, VLDB 2025, IEEE Data Engineering 2026).

Who might benefit Data scientists, ML engineers, or research teams that need to apply LLM reasoning over thousands‑to‑millions of text records without writing custom loops for each API call. LOTUS abstracts the orchestration, lets you focus on the semantic description of the job, and handles cost‑aware execution under the hood.

Related

  • Project
  • Project
  • Project
  • Project