Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

lionpride

PyPI version Python License CI codecov Code style: ruff

Production-ready primitives for multi-agent workflow orchestration.

⚠️ Alpha/Experimental - API unstable. For research and development use. Originated from lionagi v0.

Features

  • Model Agnostic - Built-in providers for OpenAI-compatible APIs, Anthropic, Gemini
  • Declarative Workflows - Report/Form system for multi-step agent pipelines
  • Async Native - Operation graph building, dependency-aware execution
  • Modular Architecture - Protocol-based composition, zero framework lock-in
  • 99%+ Test Coverage - Production-hardened with comprehensive test suites

Installation

pip install lionpride

Quick Start

import asyncio
from lionpride import Session, iModel
from lionpride.operations.operate import generate, GenerateParams

# Create model and session
model = iModel(provider="openai", model="gpt-4o-mini")
session = Session(default_generate_model=model)
branch = session.create_branch(name="main", resources={model.name})

async def main():
    # Simple text generation
    result = await generate(
        session, branch,
        params=GenerateParams(instruction="What is 2 + 2?", return_as="text"),
    )
    print(result)  # "4" or similar

asyncio.run(main())

Core Concepts

Session & Branch

Session orchestrates messages, services, and operations. Branch is a named conversation thread with capability-based access control.

from lionpride import Session, iModel

# Session with default model
model = iModel(provider="openai", model="gpt-4o-mini")
session = Session(default_generate_model=model)

# Branch with capability and resource restrictions
branch = session.create_branch(
    name="restricted",
    capabilities={"AnalysisModel"},  # Only these output types allowed
    resources={"gpt-4o-mini"},        # Only these services allowed
)

Operations

Operations are composable building blocks for agent workflows:

from pydantic import BaseModel
from lionpride.operations.operate import operate, OperateParams, GenerateParams

class Insights(BaseModel):
    summary: str
    score: float

# Branch must have capability for output field
branch = session.create_branch(capabilities={"insights"}, resources={model.name})

# Structured output with validation
params = OperateParams(
    generate=GenerateParams(
        instruction="Analyze this data",
        request_model=Insights,
    ),
    capabilities={"insights"},  # Explicit capability declaration
)

result = await operate(session, branch, params)
print(result.insights)  # Insights(summary="...", score=0.85)

Services

ServiceRegistry manages models and tools with O(1) name lookup:

from lionpride import Session, iModel, ServiceRegistry

# Register multiple models
registry = ServiceRegistry()
registry.register(iModel(provider="openai", model="gpt-4o", name="gpt4"))
registry.register(iModel(provider="anthropic", model="claude-3-5-sonnet", name="claude"))

session = Session(services=registry)
branch = session.create_branch(resources={"gpt4", "claude"})  # Access to both

Declarative Workflows

Report and Form enable multi-step agent pipelines with automatic dependency resolution. Model docstrings serve as agent instructions:

from pydantic import BaseModel
from lionpride.work import Report, flow_report

class Analysis(BaseModel):
    '''Analyze the topic and provide insights.
    Focus on actionable recommendations.'''
    summary: str
    recommendations: list[str]

class MyReport(Report):
    analysis: Analysis | None = None  # Schema attribute (docstring = instruction)

    assignment: str = "topic -> analysis"
    form_assignments: list[str] = ["topic -> analysis"]

report = MyReport()
report.initialize(topic="AI coding assistants")
result = await flow_report(session, report, branch=branch)

Architecture

lionpride/
├── core/           # Primitives: Element, Pile, Flow, Graph, Event
├── session/        # Session, Branch, Message management
├── services/       # iModel, Tool, ServiceRegistry, MCP integration
├── operations/     # operate, react, communicate, generate, parse
├── work/           # Declarative workflows: Report, Form, flow_report
├── rules/          # Validation rules and auto-correction
├── types/          # Spec, Operable, type system
└── ln/             # Utility functions

Documentation

Roadmap

  • Formal mathematical framework for agent composition
  • Rust core for performance-critical paths
  • Enhanced MCP (Model Context Protocol) support

License

Apache-2.0

Metadata

Release files for lionpride 1.0.0a12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lionpride 1.0.0a12
File Size Uploaded Provenance
lionpride-1.0.0a12.tar.gz 1.4 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for lionpride 1.0.0a12
File Interpreter ABI Platform
lionpride-1.0.0a12-py3-none-any.whl Python 3 none any Details

Total release size: 1.8 MB

Release files / lionpride-1.0.0a12.tar.gz

Download URL lionpride-1.0.0a12.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
584c0757fffcefa968d94ebd0e7d7e2ea05d28e5aa9c5ffd4239d92d730a4726
BLAKE2b-256 checksum
How to use checksums
63559db2ee9e914033438609ec3dde372640b6804c7ab6bd711ac937deae6985
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / lionpride-1.0.0a12-py3-none-any.whl

Download URL lionpride-1.0.0a12-py3-none-any.whl
Size 315.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0fd19c0bd95e036ab5ea135c5fe662dd9fdbb00f5cb554d05239a7fd531ee9ef
BLAKE2b-256 checksum
How to use checksums
652d7eec2143e9f4722f05382bc05e124179df8f82a54da895dd342549693595
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for lionpride 1.0.0a12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page