Skip to main content

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.

PyPI version Python Version Documentation Status License: MIT

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 manas_ai.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 manas_ai.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 manas_ai.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.

Metadata

Release files for manas-ai 0.2.1

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

Source distribution (sdist)

Source distribution for manas-ai 0.2.1
File Size Uploaded
manas_ai-0.2.1.tar.gz 40.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for manas-ai 0.2.1
File Interpreter ABI Platform
manas_ai-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 95.3 kB

Release files / manas_ai-0.2.1.tar.gz

Download URL manas_ai-0.2.1.tar.gz
Size 40.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f4f32a4c622e449a130efc7345574a83906d798e39e31163988b164a92e1eb16
BLAKE2b-256 checksum
How to use checksums
4d4de75173ca3fb6786402d9bda778c004f7b0cfceba75182f40e8b8e7843549
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.12 Linux/6.6.75.1-microsoft-standard-WSL2

Release files / manas_ai-0.2.1-py3-none-any.whl

Download URL manas_ai-0.2.1-py3-none-any.whl
Size 54.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de6cee195193c1de705c5f9aeb7fb9a111888b21e56f37c2d8e96b3050f55f66
BLAKE2b-256 checksum
How to use checksums
bc3a8a5dc6f7ade005d8a8dc50dd4fe327b68f9b3e493f4b73257433d6358d27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.12 Linux/6.6.75.1-microsoft-standard-WSL2

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

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