Skip to main content

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.

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.

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

manas_ai-0.2.0.tar.gz (40.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

manas_ai-0.2.0-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

Details for the file manas_ai-0.2.0.tar.gz.

File metadata

  • Download URL: manas_ai-0.2.0.tar.gz
  • Upload date:
  • Size: 40.4 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

Hashes for manas_ai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 57259d245e819a0da061070a478885094f1765301a4ee14a4b24e4379dd9113c
MD5 412431a34ff8385c3a4031d9e2bec836
BLAKE2b-256 cc0f0e7945938e872ac2d8ded2754e2797592823581090e4fad564601f065849

See more details on using hashes here.

File details

Details for the file manas_ai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: manas_ai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 54.8 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

Hashes for manas_ai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 471e53755dba47dd55b8aa66c204924e2f9216c39b858a9a03c6f3aa3aa3248a
MD5 ad6d2e1d70f011036935cdd26e81e8da
BLAKE2b-256 6b9b8b9602bb37a66485ced58f525452f9cc6b8638ff37c46411d0d21aaaf002

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page