ohdearquant/lionagi
An intelligence orchestra
lionagi – Governed Multi‑Agent Orchestration Framework
What it is – lionagi is a Python library (and accompanying li CLI) that lets you build, run, and manage LLM‑driven agent workflows. It treats each agent (or model) as a first‑class component that can be wired together in simple patterns (single call, parallel fan‑out, or full DAG) while keeping all state typed, inspectable, and persisted on disk.
Why it matters – Unlike many “frameworks” that hide the prompt‑assembly and execution loop, lionagi gives you full ownership of the loop:
- Typed state – conversations are collections of Pydantic models, so you can request structured output directly.
- Durable runs – every execution is saved under
~/.lionagi/runs/; you can resume, monitor, or schedule them later. - Governance – built‑in permission policies, guard hooks, and sandboxed git work‑trees prevent accidental destructive actions.
- Hybrid providers – the CLI can launch model‑specific CLIs (Claude Code, Codex, Pi) as subprocesses or call API providers (OpenAI, Anthropic, Ollama, etc.) using normal environment keys.
- Web UI (Lion Studio) – a client‑side dashboard (
lion-studio.khive.ai) connects to a local daemon for visual run inspection, scheduling, and playbook management.
Core concepts
| Term | Meaning |
|---|---|
| Branch | A single conversation thread with its own message history, tools, and model config. The main Python entry point (Branch). |
| Session | Coordinates multiple Branches; runs DAG workflows across them. |
| flow | CLI command (li o flow) where an orchestrator builds a dependency graph of specialist agents. |
| team | Persistent inbox for messaging between agents (li team). |
| operate | High‑level call (branch.operate) that runs tools, enforces ReAct reasoning, and returns a typed result. |
| persist | Automatic saving of every run; resume with li agent -r <branch-id>. |
Typical usage
# Install
pip install lionagi
# One‑shot CLI call
li agent claude/sonnet "Explain the observer pattern in 3 sentences"
# Parallel fan‑out with synthesis
li o fanout claude/sonnet "Identify code smells in this codebase" -n 3 --with-synthesis
# DAG orchestrated flow
li o flow claude/sonnet "Audit the auth module for security issues" --cwd .
# Python API – typed structured output
from pydantic import BaseModel
from lionagi import Branch
import asyncio
class Assessment(BaseModel):
risk: str
reasons: list[str]
async def main():
b = Branch(chat_model="codex/gpt-5.5", system="You are a careful reviewer.")
result = await b.operate(
instruction="Assess the risk of enabling auto‑merge on this repository.",
response_format=Assessment,
)
print(result.risk, result.reasons)
asyncio.run(main())
Running the UI
li studio # starts local daemon + opens hosted UI
li studio --docker # self‑contained Docker image
li studio --no-frontend # API only, no UI
The UI is purely client‑side; your data never leaves the machine.
Extensibility – optional extras (installed via lionagi[extra]) add PDF/HTML reading, PostgreSQL persistence, Ollama local models, rich terminal output, graph visualisation, etc.
Resources
- Documentation: https://ohdearquant.github.io/lionagi/
- Comparison with LangChain / LangGraph: https://ohdearquant.github.io/lionagi/comparison/
- Discord community: https://discord.gg/JDj9ENhUE8
- PyPI package: https://pypi.org/project/lionagi/
Bottom line – lionagi is a production‑ready, open‑source toolkit for anyone who wants to orchestrate LLM agents with clear state, reproducible runs, and built‑in governance, all from either Python code or a powerful CLI.
Related
- Project
- Project
- Project
- Project
- Project