Skip to content

Installation

Requirements

Prerequisites

  • Python 3.11 or higher
  • An API key from OpenAI, Anthropic, or Google

Install from PyPI

pip install nagents
uv add nagents
poetry add nagents

Install with Extras

pip install nagents[dev]

This includes:

  • pytest, pytest-asyncio, pytest-cov for testing
  • ruff for linting and formatting
  • mypy for type checking
  • pre-commit for git hooks
pip install nagents[docs]

This includes MkDocs and Material for MkDocs theme.

pip install nagents[dev,docs]

Install from Source

git clone https://github.com/abi-jey/nagents.git
cd nagents
pip install -e ".[dev]"

Editable Install

The -e flag installs the package in "editable" mode, so changes to the source code are immediately reflected without reinstalling.

Verify Installation

from nagents import Agent, Provider, ProviderType, SessionManager

print("nagents installed successfully!")
Check Version
import nagents
print(nagents.__version__)

Environment Setup

API Keys Required

You'll need an API key from at least one provider to use nagents.

Create a .env file in your project root:

.env
# Choose one or more providers
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=...

Then load it in your code:

import os
from dotenv import load_dotenv

load_dotenv()  # (1)!

api_key = os.getenv("OPENAI_API_KEY")
  1. Requires pip install python-dotenv