
lionagi
lionagi is a governed multi-agent orchestration framework. Build agent
workflows in Python with typed, inspectable state, or run them straight from
the terminal with the li CLI: single agents, parallel fan-outs, and DAG
flows where an orchestrator plans specialist workers. Built continuously
since 2023.
Direction. lionagi's underlying architecture is migrating towards lion1,
the runtime kept in the lion1/ directory of this repository until
the migration completes, while lionagi stays the package you install and
import. The migration is backward compatible: public imports, supported call
shapes and return types stay as they are, and new capabilities arrive as
additions. Removing a public name or behavior, or changing what a default
install can do, needs its own versioned compatibility decision. lionagi v1.0
is planned for around the end of October 2026. The
roadmap sets out the seven steps and the compatibility
terms, and
ADR-0125
records the decision.
Docs |
How lionagi Compares |
Discord |
PyPI |
Changelog
Demo
Lion Studio walkthrough (13 min):
inspecting runs, checking agent claims against actual output, and launching
work with approval gates. Built on lionagi, runs locally.
Quick start
pip install lionagi
# one agent
li agent claude/sonnet "Explain the observer pattern in 3 sentences"
# three workers in parallel, then a synthesis pass
li o fanout claude/sonnet "Identify code smells in this codebase" -n 3 --with-synthesis
# an orchestrator plans a DAG of specialists; workers run as dependencies resolve
li o flow claude/sonnet "Audit the auth module for security issues" --cwd .
CLI model aliases (claude, codex, ...) spawn the provider's own CLI as a
subprocess, so an existing claude login subscription works with no API key.
API providers take the usual environment keys (OPENAI_API_KEY, ...).
Details in Providers.
The same engine from Python, with structured output as a first-class result:
import asyncio
from pydantic import BaseModel
from lionagi import Branch
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())
Why lionagi
- You own the loop. Branches, sessions, and flows are ordinary Python
objects and CLI commands. There is no framework runtime to surrender
control to, and no hidden prompt assembly between you and the model.
- Typed, inspectable state. Every conversation is a collection of typed
messages with an explicit ordering. State serializes, persists, and
resumes; it is never an opaque blob inside a chain.
- CLI agents are first-class endpoints. Claude Code, Codex, and other
coding CLIs sit in the same orchestration graph as API models, so
subscription-based agents and API calls compose in one flow.
- Durable runs. Every run persists under
~/.lionagi/runs/. Resume any
branch with li agent -r, reattach with -c, watch live work with
li monitor, and schedule recurring runs with li schedule.
- Governance built in. Permission policies per tool call, guard hooks
that block destructive commands and off-limits paths, and git-worktree
sandboxing for speculative edits that never touch your branch until you
merge them.
For the architecture-level comparison with LangChain / LangGraph (and a field
matrix covering LlamaIndex and AG2), see
How lionagi Compares.
Concepts