Skip to content

Edits #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docs/GettingStarted/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ git clone https://github.com/NapthaAI/naptha-sdk.git && cd naptha-sdk

#### Install Dependencies
```bash
poetry install # This may take a few minutes
poetry install # This may take a few seconds
```

#### Activate Environment
Expand Down Expand Up @@ -75,9 +75,11 @@ For a local node, set ```NODE_URL=http://localhost:7001``` in the .env file.
To use a hosted node, set ```NODE_URL=http://node.naptha.ai:7001``` or ```NODE_URL=http://node1.naptha.ai:7001``` in the .env file.

### All Systems Go!
You can check your installation by running:
You can check your installation by running a sample CLI command:

### Troubleshooting
```bash
naptha agents # should return a list of agent modules
```

<details>
<summary>Common issues and solutions</summary>
Expand Down
51 changes: 50 additions & 1 deletion docs/NapthaModules/1-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,58 @@ For each agent, you will see a url where you can check out the code.
#### Create a New Agent

```bash
naptha agents agent_name -p "description='Agent description' parameters='{tool_name: str, tool_input_data: str}' module_url='ipfs://QmNer9SRKmJPv4Ae3vdVYo6eFjPcyJ8uZ2rRSYd3koT6jg'"
naptha publish -r https://github.com/NapthaAI/hello_world_agent # using a Github repo
naptha publish -r # using IPFS. Automatically builds the module, publishes it to IPFS and register
```

If your agent module makes use of other modules (e.g. a tool module or memory module), you may also want to publish those sub-modules using:

```bash
naptha publish -r -s
```

Make sure to add a list of dicts with a ```name``` field to one or more of the ```tool_deployments```, ```environment_deployments```, ```kb_deployments```, or ```memory_deployments``` fields in your deployment.json file:

```
[
{
...
"tool_deployments": [{"name": "tool_deployment_1"}],
"environment_deployments": [{"name": "environment_deployment_1"}],
"kb_deployments": [{"name": "kb_deployment_1"}],
"memory_deployments": [{"name": "memory_deployment_1"}],
...
}
]
```

And also add corresponding ```tool_deployments.json```, ```environment_deployments.json```, ```kb_deployments.json```, or ```memory_deployments.json``` files to the ```configs``` folder for each subdeployment. In each file, there should be a module field with a ```name```, ```description```, ```parameters```, ```module_type```, ```module_version```, ```module_entrypoint```, and ```execution_type``` fields:

```
[
{
...
"module": {
"name": "subdeployment_module",
"description": "Subdeployment Module",
"parameters": "{tool_name: str, tool_input_data: str}",
"module_type": "tool",
"module_version": "v0.1",
"module_entrypoint": "run.py",
"execution_type": "package"
},
...
}
]
```

You can confirm that the modules were registered on the Hub by running:

```bash
naptha agents
```


#### Delete an Agent

```bash
Expand Down
12 changes: 9 additions & 3 deletions docs/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,16 @@ export const featureCards = [
link: 'NapthaStorage/overview'
},
{
title: 'Documentation',
description: 'Explore our comprehensive guides and references',
title: 'Examples',
description: 'Explore our examples',
icon: '📚',
link: '/GettingStarted/Installation'
link: '/Examples/'
},
{
title: 'Tutorials',
description: 'Learn how to use Naptha',
icon: '📚',
link: '/Tutorials/'
}
];

Expand Down
46 changes: 13 additions & 33 deletions docs/Tutorials/module-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,54 +161,34 @@ poetry run python my-first-agent/run.py

If you're interested in testing your agent module on a local node, please follow the instructions [here](https://github.com/NapthaAI/node?tab=readme-ov-file)

## Packaging Your Agent
Once your agent is ready, it's time to package it with Poetry by running:

```bash
poetry build
```

This creates distribution files in your `dist` directory.

## Publishing to Naptha Hub
Publishing involves two key steps:
You can register your agent module on the Naptha Hub in two ways:
- Using a Github repo
- Using IPFS

:::tip
Add versioning before pushing to either Github or IPFS or Both.
Add version tags to your repository:
```bash
# Add version tag
git tag v0.1.0
git push --tags
```
:::

### 1. Upload to IPFS
```bash
naptha write_storage -i dist/my-first-agent-0.1.0.tar.gz --ipfs
```
You'll receive an IPFS `Folder ID` upon success like:

```
Writing storage
{'message': 'Files written to storage', 'folder_id': '********************************'}
```
:::info

Save the returned IPFS `Folder ID` - you'll need it for registration.
if you are using a Github repo, remember to:
- git add and commit your files
- create a new repository on Github and push your code.

:::

:::note
You can register the module from a GitHub url by adding your specific repo url with the ```-r``` flag:

If you would like to use `Github` instead, replace the `module_url` value in the *register agent* command with your repository url. Remember to:
- git add and commit your files
- create a new repository on Github and push your code.
```bash
naptha publish -r https://github.com/NapthaAI/module_template
```

:::
Alternatively, you can store the module on IPFS and register on the Naptha Hub by running:

### 2. Register Your Agent
```bash
naptha agents my-first-agent -p "description='My first Naptha agent' parameters='{tool_name: str, tool_input_data: str}' module_url='ipfs://YOUR_FOLDER_ID'"
naptha publish -r
```

## Verifying Your Publication
Expand Down
Loading