A flexible, multi-LLM, agent-oriented Python library with self-reflection capabilities
Project description
shaheenai
ShaheenAI is a flexible, multi-LLM, agent-oriented Python library that supports multiple language model providers like OpenAI, Anthropic, Ollama, and Cohere via a plugin/extras architecture. The library offers self-reflection, tool invocation, task chaining, and optional UI integrations using Streamlit and Chainlit.
Features
- Modular Agent Class: Supports multiple LLMs with self-reflection, tool invocation, and task chaining.
- MCP Server Interface: Optionally integrates tools and external APIs.
- Configurable via YAML or Code: Supports playbooks and programmatic configuration.
- Wide LLM Provider Support: OpenAI, Anthropic, Ollama, Cohere, etc.
- Streamlit and Chainlit Support: Build interactive and conversational UIs for agents.
Getting Started
Prerequisites
- Python 3.10 or higher
Installation
To install ShaheenAI, use pip:
pip install shaheenai
Usage
Here's a basic example of how to use ShaheenAI to create an agent that utilizes a weather tool:
from shaheenai.agent import Agent
from shaheenai.mcp import MCP
# Define and run the MCP server
mcp = MCP()
@mcp.tool()
async def get_weather(location: str) -> str:
return "Sunny with 25°C"
if __name__ == "__main__":
mcp.run()
# Create an agent
agent = Agent(instructions="You can use tools when needed", llm="openai", tools=["get_weather"])
response = agent.start("What's the weather in Lahore today?")
print(response)
CLI
ShaheenAI provides a command-line interface for running agents defined in YAML playbooks or via auto-mode.
Example:
shaheenai run agents.yaml
Directory Structure
shaheenai/
├── shaheenai/
│ ├── __init__.py
│ ├── agent.py
│ ├── mcp.py
│ ├── llm_providers/
│ │ ├── openai.py
│ │ ├── cohere.py
│ │ └── ...
│ ├── tools/
│ └── config.py
├── setup.py or pyproject.toml
├── README.md
├── LICENSE # e.g. MIT
└── examples/
├── app.py
└── agents.yaml
Contributing
Contributions are welcome! Please read the contribution guidelines first.
License
This project is licensed under the MIT License.
Acknowledgments
Inspired by PraisonAI for its modularity and multi-LLM support.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shaheenai-0.1.0.tar.gz.
File metadata
- Download URL: shaheenai-0.1.0.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7900c7992a9d5669cef1507222307684d73226d288edab6886ee90faf15c56d
|
|
| MD5 |
4bd95a338cc248d614d66af17a1c919f
|
|
| BLAKE2b-256 |
b40f6912e139c1b1e59a12044a8fe5c6a7fcb7bbdca4539cc0b71c0a30e4340e
|
File details
Details for the file shaheenai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: shaheenai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4472520de0ab2a41a63064a8d865262fa6a1b5c5784b90785c1dceb0a00fa373
|
|
| MD5 |
49c2450cc4e9ba51907ee05c64312745
|
|
| BLAKE2b-256 |
0b0e8109f5e672993dd6903a7da96b45ae2a5526811ae92760274ac04617494c
|