A framework for building LLM-powered applications with intelligent agents, task decomposition, and RAG
Project description
Manas - Multi-Agent System Framework for LLM Applications
A robust, modular, and extensible framework for building LLM-powered applications with intelligent agents, tool integration, task decomposition, and dynamic workflows.
Features
- 🤖 Intelligent Agents - Create autonomous agents with think-act-observe cycle and built-in state management
- 🛠️ Tool System - Flexible registry for tools with automatic parameter discovery and documentation
- 🧩 Task Decomposition - Break down complex tasks into manageable subtasks
- 📚 Retrieval Augmented Generation (RAG) - Enhance LLM responses with relevant context and document chunking
- 🔄 Dynamic Flows - Create and modify workflows with visualization and dependency management
- 🔌 Provider Architecture - Modular support for OpenAI, Anthropic, HuggingFace, Ollama, and custom providers
- 💾 Vector Store Integration - FAISS, Chroma, Pinecone support with consistent interfaces
- 🧠 Memory and Middleware - Built-in memory middleware and extensible middleware architecture
- ⚡ Async First - Fully asynchronous architecture with proper error handling
- ✅ Formally Verified - Core flow execution logic validated through formal verification
Installation
Basic Installation
# Install using pip
pip install manas-ai
# Install using poetry
poetry add manas-ai
Installing with Specific Features
# Install with OpenAI support
pip install "manas-ai[openai]"
# Install with Anthropic support
pip install "manas-ai[anthropic]"
# Install with HuggingFace support
pip install "manas-ai[huggingface]"
# Install with Vector Store support
pip install "manas-ai[vector-stores]"
# Install all features with CPU support
pip install "manas-ai[all-cpu]"
# Install all features with GPU support
pip install "manas-ai[all-gpu]"
Quick Start
Here's a simple example of a question-answering agent:
import os
from core import LLM, Agent
# Initialize a model with your API key
model = LLM.from_provider(
"openai",
model_name="gpt-4",
api_key=os.environ.get("OPENAI_API_KEY")
)
# Create an agent
agent = Agent(llm=model, system_prompt="You are a helpful assistant.")
# Generate a response
response = agent.generate("What is the capital of France?")
print(response)
Creating a Multi-Agent Flow
Here's how to create a flow with multiple specialized agents:
from core import Flow
from core.nodes import QANode
# Initialize a model
model = LLM.from_provider("openai", model_name="gpt-4")
# Create specialized nodes
researcher = QANode(
name="researcher",
llm=model,
system_prompt="You are an expert researcher who provides factual information."
)
writer = QANode(
name="writer",
llm=model,
system_prompt="You are a skilled writer who creates engaging content."
)
# Create a flow
flow = Flow()
flow.add_node(researcher)
flow.add_node(writer)
flow.add_edge(researcher, writer)
# Process a query
result = flow.process("Explain quantum computing.")
print(result)
Documentation
For complete documentation, visit https://arkokoley.github.io/manas/.
Core Components
Agent System
Agents in Manas follow a think-act-observe cycle with improved state management:
from core import Agent, LLM
# Create an agent with tools
agent = Agent(
llm=model,
system_prompt="You are an agent with access to tools.",
tools=[calculator_tool, search_tool]
)
# Process a query
response = agent.generate("Calculate 125 * 37 and find information about Mars.")
RAG Integration
Manas provides robust support for Retrieval-Augmented Generation:
from core import RAG
from core.vectorstores import FaissVectorStore
# Create a vector store
vector_store = FaissVectorStore(dimension=1536)
# Initialize RAG
rag_system = RAG(
llm=model,
vector_store=vector_store
)
# Add documents
rag_system.add_file("knowledge_base.pdf")
# Query the RAG system
response = rag_system.query("What are the key findings in the document?")
Flow Orchestration
Create complex workflows with multiple specialized nodes:
from core import Flow
from core.nodes import QANode, ToolNode, DocumentNode
# Create nodes
nodes = [
QANode(name="planner", llm=model),
DocumentNode(name="document_processor", llm=model),
ToolNode(name="calculator", tool=calculator_tool)
]
# Create flow
flow = Flow()
for node in nodes:
flow.add_node(node)
# Connect nodes
flow.add_edge(nodes[0], nodes[1])
flow.add_edge(nodes[0], nodes[2])
flow.add_edge(nodes[1], nodes[0])
flow.add_edge(nodes[2], nodes[0])
# Process flow
result = flow.process("Analyze this document and calculate the totals.")
Contributing
Contributions are welcome! Please read our Contributing Guide for details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 manas_ai-0.1.2.tar.gz.
File metadata
- Download URL: manas_ai-0.1.2.tar.gz
- Upload date:
- Size: 40.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.6.75.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45c3865d35b4af488e469276600017303b9d6204b3eca8cfc956982c197d9ed2
|
|
| MD5 |
7c6ee61fb0ce2f904b847a9f3215b062
|
|
| BLAKE2b-256 |
ac6e051636aa6f087bfdbd46c8d12448e07dc0bfce1ea6129854a6b1035f9029
|
File details
Details for the file manas_ai-0.1.2-py3-none-any.whl.
File metadata
- Download URL: manas_ai-0.1.2-py3-none-any.whl
- Upload date:
- Size: 54.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.6.75.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9788f46bc39ce1cceead30219478eea67d303cbe69afcf04e7cfc2dccdde3973
|
|
| MD5 |
e6ee18dcb63b7e4246b5aade33d5ae76
|
|
| BLAKE2b-256 |
93a5d9b3db588360e34ab3e695761590ea8beab101a6ef4eb7641c4367e6928e
|