Skip to main content

What are Naptha Modules?

Naptha Modules are the building blocks of Naptha multi-agent applications. They provide a standardized container & interface for different agent frameworks, allowing them to coexist and interact within a larger multi-agent system. Naptha Modules are designed to be framework-agnostic, allowing developers to implement them using different agent frameworks. As shown in the diagram below, modules can run on separate devices, while still interacting with each other via API.

There are currently seven types of modules:

# node/schemas.py
class ModuleType(str, Enum):
agent = "agent"
tool = "tool"
environment = "environment"
kb = "kb"
memory = "memory"
orchestrator = "orchestrator"
persona = "persona"

Modules are executed within Poetry virtual environments or Docker containers on Naptha Nodes.

# node/schemas.py
class ModuleExecutionType(str, Enum):
package = "package"
docker = "docker"

Modules are stored on GitHub, HuggingFace, IPFS, or DockerHub with the module URL and other metadata registered on the Naptha Hub.

# node/schemas.py
class Module(BaseModel):
id: str
name: str
description: str
author: str
module_url: str
module_type: Optional[ModuleType] = ModuleType.agent
module_version: Optional[str] = "v0.1"
module_entrypoint: Optional[str] = "run.py"
execution_type: Optional[ModuleExecutionType] = ModuleExecutionType.package

Structure of a Module

If you're familiar with Kubeflow Pipelines, modules are a bit like Components. Modules are based on Poetry Python packages, with some additions like schemas, configs, and an entrypoint. The Naptha Module template provides the basic structure for creating new modules. A typical module has the following structure:

my_module/
├── my_module/
│ ├── __init__.py
│ ├── configs/ # contains the module's configuration files
│ │ ├── agent_deployments.json
│ │ ├── deployment.json
│ │ ├── kb_deployments.json
│ │ ├── llm_configs.json
│ │ └── tool_deployments.json
│ ├── run.py # the main code for the module
│ └── schemas.py # the module's schemas
├── tests/
│ └── __init__.py
├── pyproject.toml # the module's dependencies
├── poetry.lock
├── README.md
├── LICENSE
├── .env # sensitive variables (like API keys) used by the module
├── .gitignore
└── Dockerfile
info

You can make changes to the configs in the configs folder. The deployment.json file is the main config file for the module. You may also have other config files for subdeployments such as agent_deployments.json, tool_deployments.json, kb_deployments.json, memory_deployments.json, and environment_deployments.json.

Explore Examples

You can also browse our GitHub repositories for real-world examples e.g. The simple chat agent module for running simple chat with LLMs.

To see a full list of modules currently registered on the Naptha Hub, install the Naptha SDK and use these CLI commands:

naptha agents         # explore available agent modules
naptha tools # explore available tool modules
naptha orchestrators # explore available orchestrator modules
naptha kbs # explore available knowledge base modules
naptha memories # explore available memory modules
naptha environments # explore available environment modules
naptha personas # explore available personas to use with your agents

Running a Module

You can run modules locally, or deploy to a Naptha Node using naptha run commands from the Naptha SDK.

Need Help?

  • Join our Community and post in the #support channel
  • Submit issues on GitHub

Interested in Contributing?

Next Steps