pylemura
A provider-agnostic, premium agentic AI runtime for Python.
🚀 v1.1.0 is available. Read the Release Notes.
pylemura is a robust, provider-agnostic Python package designed to encapsulate a full agentic AI runtime. It simplifies the complex orchestration of LLMs, tools, and context management into a single, cohesive interface. It is the official Python portage of lemura.
✨ Key Features
- 🧠 Dynamic Skill Market: Switch skills on/off at runtime via tags, names, or tool dependencies.
- 🗺️ Continuation Planning: Multi-step tool chains with parallel execution and conditional logic.
- 🎯 Intelligent Goal Maintenance: LLM-powered sub-goal decomposition and status tracking.
- 🔌 MCP Support: Native Model Context Protocol integration for connecting to external tool servers.
- 🛡️ Tool Firewall: Fully integrated ask/accept/deny policy layer for security.
- ⚡ Parallel Tool Calls: Execute independent tools concurrently for reduced latency.
- 🧹 Summary Injection: Ensures the model never "forgets" what was compressed away.
- 📊 Enhanced Observability: Detailed tracing, token tracking, and execution budget enforcement.
- 🌊 Native Streaming: Full async generator support for token-by-token completion.
- 📦 Zero Dependencies: Core runtime runs on the Python standard library only.
🚀 Install
pip install pylemura
⚙️ Environment Variables
The built-in OpenAICompatibleAdapter can be configured using environment variables. To load them from a .env file, you can use python-dotenv:
pip install python-dotenv
Then at the very top of your entry point:
from dotenv import load_dotenv
load_dotenv()
Create a .env file in your project root:
# Provider Configuration (OpenAI, Groq, Together, Ollama, etc.)
LEMURA_API_KEY=your_api_key_here
LEMURA_BASE_URL=https://api.openai.com/v1
LEMURA_MODEL=gpt-4o-mini
# Fallbacks (Lemura also checks standard OpenAI variables)
OPENAI_API_KEY=your_api_key_here
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_MODEL=gpt-4o-mini
⚡ Quick Start
import asyncio
from pylemura import SessionManager, OpenAICompatibleAdapter
async def main():
adapter = OpenAICompatibleAdapter(
base_url="https://api.openai.com/v1",
api_key="your_api_key_here",
default_model="gpt-4o-mini"
)
session = SessionManager(
adapter=adapter,
model="gpt-4o-mini",
max_tokens=100000,
)
response = await session.run("What is lemura?")
print(response)
if __name__ == "__main__":
asyncio.run(main())
🧠 Core Concepts
Explore the architecture and advanced capabilities of lemura at lemura.makix.fr:
- 🏁 Getting Started — Fundamental setup and concepts.
- 🧹 Context Management — Advanced compression strategies.
- 🔌 Adapters — Connecting to OpenAI, Groq, Anthropic, and more.
- 🛠️ Tools and Skills — Extending agent capabilities.
- 🎛️ Media Bridge — ASR, TTS, vision, and image generation.
- ⚡ Advanced Execution — Goal planning and continuation.
📦 API Overview
| Component | Description |
|---|---|
SessionManager |
The main entry point orchestrating the ReAct loop and tools. |
ContextManager |
Manages the conversation history using compression strategies. |
OpenAICompatibleAdapter |
Reference adapter for OpenAI, Groq, Together, etc. |
ToolRegistry |
Registers and executes tools for the agent. |
SkillInjector |
Loads and formats YAML/Markdown skills into system prompts. |
DefaultLogger |
Colorized logger with Problem/Hints metadata support. |
🪵 Logging and Tracing
pylemura features a premium, structured logging system designed for developer experience. It provides colorized output and actionable hints for errors.
from pylemura import SessionManager, DefaultLogger, LogLevel
logger = DefaultLogger()
logger.set_level(LogLevel.DEBUG) # Set to show trace-level information
session = SessionManager(
adapter=adapter,
model="gpt-4o-mini",
max_tokens=100000,
logger=logger # Inject the logger
)
🔌 Provider Adapters
pylemura interacts with LLMs exclusively through the IProviderAdapter interface, ensuring zero lock-in.
| Adapter | Status | Description |
|---|---|---|
OpenAICompatibleAdapter |
✅ Built-in | Wrapper for OpenAI and API-compatible endpoints. |
🤝 Contributing
We welcome contributions! Please refer to the TypeScript version's guidelines for general principles.
📄 License
Distributed under the MIT License. See LICENSE for more information.
Metadata
Release files for pylemura 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pylemura-1.2.0.tar.gz | 44.5 kB | Without provenance | Details for pylemura-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pylemura-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for pylemura-1.2.0-py3-none-any.whl |
Total release size: 100.1 kB
Release files / pylemura-1.2.0.tar.gz
| Download URL | pylemura-1.2.0.tar.gz |
|---|---|
| Size | 44.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21cc65ec6f72cbf31f8152a2f076e983655fc8c6e979aa208cd3909b08f8db69
|
|
BLAKE2b-256 checksum How to use checksums |
c9ec1e3b8c3059f9b59bb41eb597195569761fb7579b2c4af3dabe0d326da3b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / pylemura-1.2.0-py3-none-any.whl
| Download URL | pylemura-1.2.0-py3-none-any.whl |
|---|---|
| Size | 55.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
af2624eabdf06fd7b49532aae38c5e2029f7ed1e432f36fd2f59bee64355c833
|
|
BLAKE2b-256 checksum How to use checksums |
846d14d9c1c04c210e79ca0ca9606ebdcdd98847e78c901002baae05bb5a1ee2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for pylemura 1.2.0
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.