|
2 | 2 |
|
3 | 3 | The [Naptha SDK](https://github.com/NapthaAI/naptha-sdk) is a Python library that allows you to interact with the Naptha ecosystem, such as the Naptha Hub and Naptha Nodes (for deploying agents and other modules, and acessing inference and storage). It can be used in Naptha Modules, and other components with other agent frameworks like CrewAI. |
4 | 4 |
|
5 | | -You can install the SDK using PyPI or from source. |
| 5 | +## 🧩 Installing the SDK |
6 | 6 |
|
7 | | -## Install using PyPI |
| 7 | +You can install the SDK using PyPI or from source. We recommend using `uv` as a package manager. Follow the installation instructions [here](https://docs.astral.sh/uv/getting-started/installation/) to install `uv`. |
8 | 8 |
|
9 | | -```bash |
10 | | -pip install naptha-sdk |
11 | | -``` |
| 9 | +### Install within an existing project |
12 | 10 |
|
13 | | -## Create a User Account for using the Naptha Hub and Naptha Nodes |
14 | | - |
15 | | -You can create an account on the Naptha Hub (and generate your ```PRIVATE_KEY```) using the Naptha CLI: |
| 11 | +If you want to install the naptha-sdk as part of an existing project (e.g. [to deploy existing agents from third-party frameworks on the Web of Agents](https://docs.naptha.ai/Integrations/Decorators)), it is good practice to do so within a dedicated virtual environment. If you don't already have a virtual environment, create a new one using `uv`: |
16 | 12 |
|
17 | 13 | ```bash |
18 | | -naptha signup |
| 14 | +uv init --python ">=3.10,<3.13" |
19 | 15 | ``` |
20 | | -:::info |
21 | | -This command will prompt you to create an account by entering a username and password. It also automatically generates a private key and stores it in your .env file. |
22 | | -::: |
23 | | - |
24 | | -## Configure Environmental Variables |
25 | 16 |
|
26 | | -### Configure ```NODE_URL``` |
27 | | -Choose whether you want to interact with a *local* or *hosted* Naptha node. |
28 | | - |
29 | | -#### Local Node |
30 | | -For a local node, set ```NODE_URL=http://localhost:7001``` in the .env file. |
31 | | - |
32 | | -#### Hosted Node |
33 | | -To use a hosted node, set e.g. ```NODE_URL=https://node.naptha.ai``` or ```NODE_URL=https://node2.naptha.ai``` in the .env file. |
34 | | - |
35 | | - |
36 | | -## Install from Source |
37 | | - |
38 | | -To install from source, follow these steps: |
39 | | - |
40 | | -1. Install Poetry with pipx |
41 | | -2. Install Naptha SDK |
42 | | -3. Setup dev environment |
43 | | - |
44 | | -### 1. Install Poetry with pipx |
45 | | - |
46 | | -Naptha uses a Python dependency management tool called Poetry. Learn more about Poetry in their official [docs](https://python-poetry.org/docs). Run this command: |
| 17 | +Then install the SDK: |
47 | 18 |
|
48 | 19 | ```bash |
49 | | -pipx install poetry |
| 20 | +uv add naptha-sdk |
| 21 | +source .venv/bin/activate |
50 | 22 | ``` |
51 | 23 |
|
52 | | -> Poetry should always be installed in a dedicated virtual environment to isolate it from the rest of your system. |
53 | | -
|
54 | | -### 2. Clone Naptha SDK |
55 | | - |
56 | | -Clone the Repository and navigate to the SDK directory: |
| 24 | +Alternatively, if you have an existing project that doesn't use `uv` you can also install using: |
57 | 25 |
|
58 | 26 | ```bash |
59 | | -git clone https://github.com/NapthaAI/naptha-sdk.git && cd naptha-sdk |
| 27 | +pip install naptha-sdk |
60 | 28 | ``` |
61 | 29 |
|
62 | | -Install the dependencies using Poetry: |
| 30 | +### Install from source |
63 | 31 |
|
64 | | -```bash |
65 | | -poetry install |
66 | | -``` |
67 | | - |
68 | | -Activate the virtual environment: |
| 32 | +If you are a developer contributing to the Naptha SDK, you will want to install from source using: |
69 | 33 |
|
70 | 34 | ```bash |
| 35 | +git clone https://github.com/NapthaAI/naptha-sdk.git |
| 36 | +cd naptha-sdk |
| 37 | +uv venv |
71 | 38 | source .venv/bin/activate |
| 39 | +uv pip install . |
72 | 40 | ``` |
73 | 41 |
|
74 | | -Next, create a copy of the .env file: |
| 42 | +## 🔥 Create a User Account for using the Naptha Hub and Naptha Nodes |
75 | 43 |
|
76 | | -```bash |
77 | | -cp .env.example .env |
78 | | -``` |
| 44 | +Your Naptha account is your identity on the Naptha platform. It allows you to: |
79 | 45 |
|
80 | | -#### Configure Variables |
| 46 | +- Deploy and run agents, tools, environments and other modules on Naptha Nodes (via a public/private keypair) |
| 47 | +- Access and interact with the Naptha Hub's features and services (via a username and password) |
81 | 48 |
|
82 | | -Choose whether you want to interact with a local Naptha node or a hosted Naptha node. For a local node, set ```NODE_URL=http://localhost:7001``` in the .env file. To use a hosted node, set ```NODE_URL=https://node.naptha.ai``` or ```NODE_URL=https://node1.naptha.ai```. |
| 49 | +The simplest way to create a new account is through the interactive CLI. Run the following command: |
83 | 50 |
|
| 51 | +```bash |
| 52 | +naptha signup |
| 53 | +``` |
| 54 | + |
| 55 | +:::info |
| 56 | +This command will prompt you to create an account by entering a username and password. It also automatically generates a private key and stores it in your .env file. |
| 57 | +::: |
84 | 58 |
|
85 | | -To check the installation, run: |
| 59 | +Or if you have already have set up an identity, edit your `.env` file with your desired credentials: |
86 | 60 |
|
87 | 61 | ```bash |
88 | | -naptha |
| 62 | +# .env file |
| 63 | +HUB_USERNAME=your_username |
| 64 | +HUB_PASSWORD=your_password |
| 65 | +PRIVATE_KEY=your_private_key # Optional - will be generated if not provided |
89 | 66 | ``` |
90 | 67 |
|
| 68 | +## ⚙️ Configure Environmental Variables |
| 69 | + |
| 70 | +Choose whether you want to interact with a *local* or *hosted* Naptha node. For a local node, set ```NODE_URL=http://localhost:7001``` in the .env file. To use a hosted node, set e.g. ```NODE_URL=https://node.naptha.ai``` or ```NODE_URL=https://node2.naptha.ai``` in the .env file. |
| 71 | + |
91 | 72 | ## Need Help? |
92 | 73 |
|
93 | 74 | - Join our [Community](https://naptha.ai/naptha-community) and post in the #support channel |
|
0 commit comments