Project Structure
This guide explains the organization of the Manas codebase to help you understand where to find different components and how they work together.
Overview
The project follows a modular architecture with clear separation of concerns:
1
2
3
4
5
6
7
8
manas/
├── core/ # Core framework implementation
│ ├── nodes/ # Node implementations
│ ├── providers/ # LLM provider integrations
│ └── vectorstores/ # Vector store implementations
├── docs/ # Documentation
├── examples/ # Example applications
└── tests/ # Test suite
Core Components
core/ Directory
The core/
directory contains the main framework implementation:
Base Files
agent.py
: Agent system implementationbase.py
: Base classes and interfaceschat.py
: Chat-related functionalityflow.py
: Flow orchestration systemllm.py
: LLM interface and managementmodels.py
: Data models and typesrag.py
: RAG implementationtokenizers.py
: Token counting utilities
core/nodes/
Node implementations for different purposes:
__init__.py
: Node exportsapi_node.py
: API integration nodesdocument_node.py
: Document processing nodesfactory.py
: Node creation factoryprotocol.py
: Node protocols and interfacesqa_node.py
: Question-answering nodestool_node.py
: Tool integration nodes
core/providers/
LLM provider integrations:
__init__.py
: Provider exportsanthropic.py
: Anthropic Claude integrationbase.py
: Base provider classesfactory.py
: Provider creation factoryhuggingface.py
: HuggingFace integrationmiddleware.py
: Provider middlewaremock.py
: Mock provider for testingollama.py
: Ollama integrationopenai.py
: OpenAI integrationprotocol.py
: Provider protocols
core/vectorstores/
Vector store implementations:
__init__.py
: Vector store exportsbase.py
: Base vector store classeschroma.py
: ChromaDB integrationfactory.py
: Vector store factoryfaiss.py
: FAISS integrationpinecone.py
: Pinecone integrationprotocol.py
: Vector store protocols
Documentation Structure
docs/ Directory
Documentation is organized by topic:
1
2
3
4
5
6
7
8
9
10
docs/
├── _api/ # API reference documentation
├── _data/ # Site data files
├── _examples/ # Example code documentation
├── _includes/ # Reusable components
├── _layouts/ # Page layouts
├── _sass/ # Custom styles
├── api/ # API guides
├── assets/ # Static assets
└── examples/ # Example guides
Key Documentation Files
index.md
: Home pagegetting-started.md
: Installation and basic usageconcepts.md
: Core concepts and architecturebenchmarking.md
: Performance benchmarkscontributing.md
: Contribution guidelinesfaq.md
: Common questions and answersllm-integration.md
: LLM integration guidestructure.md
: This project structure guide
Example Applications
examples/ Directory
Contains practical examples and tutorials:
ollama_tool_test.py
: Ollama integration examplesimple_ollama.py
: Basic Ollama usagetest_tool_agent.py
: Tool agent testingtool_using_agent.py
: Tool integration exampletwo_node_flow.py
: Multi-node flow exampleutils.py
: Utility functions
Test Suite
tests/ Directory
Comprehensive test coverage:
benchmark_flow.py
: Flow performance testsflow_proof_runner.py
: Flow validation testshelpers.py
: Test helpers and utilitiessimple_flow_test.py
: Basic flow testsstress_test_flow.py
: Load testingtest_llm.py
: LLM provider teststest_nodes.py
: Node implementation testsutils.py
: Test utilitiesvalidate_flow_scaling.py
: Scaling validation
Dependency Management
Root Directory Files
pyproject.toml
: Project metadata and dependenciespoetry.lock
: Locked dependency versions__init__.py
: Package initializationLICENSE
: MIT licenseREADME.md
: Project overviewspec.md
: Technical specifications
Module Dependencies
The framework follows a layered architecture:
graph TD
A[Applications] --> B[Flows]
B --> C[Nodes]
C --> D[LLM Providers]
C --> E[Vector Stores]
B --> F[Agents]
F --> D
Layer Responsibilities
- Applications Layer
- User applications
- Example implementations
- Integration points
- Flow Layer
- Flow orchestration
- Node management
- Message routing
- Node Layer
- Node implementations
- Task processing
- Tool integration
- Provider Layer
- LLM integration
- Vector store management
- External service connections
Best Practices
When working with the codebase:
- Adding New Features
- Place core logic in appropriate
core/
subdirectory - Add tests in corresponding test files
- Include example usage in
examples/
- Update documentation
- Place core logic in appropriate
- Making Changes
- Maintain module boundaries
- Follow existing patterns
- Update dependencies carefully
- Keep documentation in sync
- Testing
- Add unit tests for new code
- Update integration tests
- Use mock providers for testing
- Validate changes with benchmarks
- Documentation
- Update API reference for changes
- Add examples for new features
- Keep structure documentation current
- Include docstrings
Environment Setup
For development:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Clone repository
git clone https://github.com/arkokoley/manas.git
cd manas
# Install dependencies
poetry install
# Install development extras
poetry install --extras "test docs"
# Run tests
poetry run pytest
# Build documentation
poetry run mkdocs build
Next Steps
- Read the Contributing Guide for development workflow
- Explore the API Reference for detailed documentation
- Check Examples for practical usage
- Review Core Concepts for architecture details