LionAGI Philosophy: Orchestration, Not Operations¶
The Paradigm Shift¶
LionAGI is evolving from a collection of operations to a central coordination engine for arbitrary orchestration patterns.
Current State (v0.x - Deprecating)¶
# Branch bloated with every possible operation
branch.chat()
branch.communicate()
branch.reason()
branch.plan()
branch.analyze()
# ... dozens more built-in operations
Future State (v1.0+)¶
# Branch as minimal interface - only core operations
branch.chat() # Basic LLM interaction
branch.communicate() # Structured communication
branch.operate() # Execute arbitrary operations
branch.react() # ReAct pattern for tool use
# Everything else is user-defined operations
my_custom_op = create_operation(...)
branch.operate(my_custom_op)
Core Philosophy¶
Branch as a Space¶
In category theory terms, a Branch
is a space where operations happen, not a collection of operations itself.
# Branch = Space for computation
# Operation = Instantiation of orchestration pattern
# LionAGI = Coordinator that assembles operations
Operations Are Arbitrary¶
Operations can be: - Agentic - LLM-based reasoning - Computational - Pure functions - External - API calls, database queries - Composite - Operations built from other operations - Cross-Branch - Operations spanning multiple branches
Creating Custom Operations¶
Simple Operation¶
from lionagi import Operation
def my_analysis_operation(data):
"""Any arbitrary computation"""
return {"analyzed": data}
# Use it in a branch
result = await branch.operate(my_analysis_operation, data=my_data)
Composite Operation Across Branches¶
async def cross_branch_synthesis(branches: list[Branch]):
"""Operation spanning multiple branches"""
# Gather from all branches
results = await asyncio.gather(*[
b.communicate("Your perspective?")
for b in branches
])
# Synthesize in a new branch
synthesizer = Branch()
return await synthesizer.communicate(
f"Synthesize: {results}"
)
Orchestration Pattern as Operation¶
class FanOutFanIn(Operation):
"""Reusable orchestration pattern"""
async def execute(self, question, expert_branches):
# Fan-out
analyses = await asyncio.gather(*[
branch.communicate(question)
for branch in expert_branches
])
# Fan-in
return await self.synthesizer.communicate(
f"Combine analyses: {analyses}"
)
# Use like any operation
pattern = FanOutFanIn(synthesizer=Branch())
result = await branch.operate(pattern, question="...", expert_branches=[...])
Why This Matters¶
1. Unbounded Flexibility¶
You're not limited to what LionAGI provides. Create ANY operation you need.
2. Clean Composition¶
Operations compose naturally - build complex from simple.
3. Framework Agnostic¶
Your operations can wrap LangChain, CrewAI, or any other framework.
4. True Orchestration¶
LionAGI becomes the conductor, not the orchestra.
Migration Guide¶
Old Way (Deprecated)¶
# Using built-in operations
result = await branch.analyze(data)
summary = await branch.summarize(result)
plan = await branch.plan(summary)
New Way (v1.0+)¶
# Define your operations
analyze = create_operation(my_analysis_logic)
summarize = create_operation(my_summary_logic)
plan = create_operation(my_planning_logic)
# Orchestrate them
result = await branch.operate(analyze, data)
summary = await branch.operate(summarize, result)
plan = await branch.operate(plan, summary)
# Or compose them
pipeline = compose(analyze, summarize, plan)
result = await branch.operate(pipeline, data)
Primary Orchestration Patterns¶
LionAGI will maintain these core patterns as building blocks:
- Sequential Pipeline - Operations in order
- Parallel Execution - Operations simultaneously
- Fan-Out/Fan-In - Distribute then synthesize
- Conditional Branching - Dynamic paths
- Recursive Decomposition - Break down complex tasks
These are provided not as fixed operations, but as composable patterns you can adapt.
The Future: Complex Composite Operations¶
# Complex operation spanning multiple branches and external systems
class EnterpriseWorkflow(Operation):
async def execute(self, request):
# Spawn specialized branches
branches = {
"research": Branch(system="Researcher"),
"analysis": Branch(system="Analyst"),
"review": Branch(system="Reviewer")
}
# External operations
db_data = await self.database.query(request.context)
api_data = await self.external_api.fetch(request.params)
# Orchestrate across branches with external data
research = await branches["research"].communicate(
instruction=request.question,
context={"db": db_data, "api": api_data}
)
analysis = await branches["analysis"].communicate(
instruction="Analyze findings",
context=research
)
review = await branches["review"].communicate(
instruction="Review and validate",
context={"research": research, "analysis": analysis}
)
return {"workflow_result": review}
# Use it like any other operation
workflow = EnterpriseWorkflow(database=db, external_api=api)
result = await branch.operate(workflow, request=my_request)
Summary¶
LionAGI is becoming a coordination engine, not an operation library.
- Minimal core: Just
chat
,communicate
,operate
,ReAct
- User-defined everything: Create your own operations
- Arbitrary orchestration: Not limited to agentic patterns
- Composable patterns: Build complex from simple
- Cross-branch coordination: Operations can span multiple spaces
This is the future of LionAGI: You bring the operations, we provide the orchestration.