Skip to content

Commit e2087de

Browse files
authored
Creating initial readme contributing guide (#3)
- Creates the contributing guide, template and updates the readme with information guiding users to commit examples ## By Submitting this PR I confirm: - I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/NeMo-Agent-Toolkit/blob/develop/docs/source/resources/contributing.md). - We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license. - Any contribution which contains commits that are not Signed-Off will not be accepted. - When the PR is ready for review, new or existing tests cover these changes. - When the PR is ready for review, the documentation is up to date with these changes. ## Summary by CodeRabbit - Documentation - Added a comprehensive CONTRIBUTING guide with requirements for examples, testing, licensing, and code style. - Revamped README with clearer community-focused setup steps, Python version guidance, and LFS data instructions. - Added an example README template to streamline creating new examples. - Chores - Configured Git LFS for images and example data while exempting Markdown files. - Updated tooling defaults and ignore paths for the examples template. - Enhanced CI to include doc/license checks, simplified GitHub checks, and changed default target branch to main. Authors: - Michael Demoret (https://github.com/mdemoret-nv) - Will Killian (https://github.com/willkill07) - David Gardner (https://github.com/dagardner-nv) Approvers: - David Gardner (https://github.com/dagardner-nv) - Anuradha Karuppiah (https://github.com/AnuradhaKaruppiah) URL: #3
1 parent 98b07c0 commit e2087de

9 files changed

Lines changed: 348 additions & 13 deletions

File tree

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
docs/source/_static/*.png filter=lfs diff=lfs merge=lfs -text
2+
3+
# Add all data files to LFS
4+
examples/**/data/** filter=lfs diff=lfs merge=lfs -text
5+
6+
# Exclude Markdown files from LFS in the data directory
7+
examples/**/data/*.md -filter=lfs -diff=lfs -merge=lfs text

CONTRIBUTING.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<!--
2+
SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
SPDX-License-Identifier: Apache-2.0
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
18+
19+
# Contributing Guidelines
20+
21+
The NeMo Agent Toolkit Examples repository is a collection of examples that demonstrate how to use the NeMo Agent Toolkit. We welcome contributions from the community to add new examples, improve existing examples, and fix bugs.
22+
23+
To ensure your contribution is accepted, please follow the guidelines below.
24+
25+
## What to Contribute
26+
27+
### New Examples
28+
29+
If you have an idea for a new example, or would like to contribute an example you have created, please ensure that your example follows these general guidelines:
30+
31+
1. Examples should demonstrate a specific use case or feature of the NeMo Agent Toolkit.
32+
2. Examples should be unique and not already covered by an existing example.
33+
1. If your example is a variation of an existing example, consider updating the existing example instead of creating a new one.
34+
3. Examples should be reliable and reproducible.
35+
4. Examples should adhere to the [Example Requirements](#example-requirements) below.
36+
37+
If you are unsure about whether your example is a good fit for the repository, please open up an issue to discuss your idea before submitting a pull request.
38+
39+
### Example Updates
40+
41+
Examples can be updated to include new features, improve documentation, or fix bugs. If you are updating an example, please ensure that your changes follow these general guidelines:
42+
43+
1. Examples should be updated to reflect the latest version of the NeMo Agent Toolkit.
44+
2. All new features should be documented and tested.
45+
3. Examples should continue to adhere to the [Example Requirements](#example-requirements) below.
46+
47+
### Bug Fixes
48+
49+
If you have found a bug in an example, please open up an issue to report the bug or submit a pull request to fix the bug. Bug fixes do not need to update the example to reflect the latest version of the NeMo Agent Toolkit.
50+
51+
## Example Requirements
52+
53+
### Dependencies
54+
The example should specify all its dependencies in the `pyproject.toml` file. The versions of all dependencies, including NeMo Agent toolkit, should specify at least 2 digit (for example `nvidia-nat~=1.2`, not `nvidia-nat==1` or `nvidia-nat>=1`). Each dependency should have a license that is compatible with the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0) used by this repository.
55+
56+
### Organization
57+
Examples should follow a specified structure to maintain consistency across the repository, the `nat workflow create` command should be used to generate the example directory structure. The recommended structure is:
58+
```bash
59+
examples/
60+
$EXAMPLE_NAME/
61+
configs/ # Symlink to `src/nat_$EXAMPLE_NAME/configs/`
62+
data/ # [Optional] Symlink to `src/nat_$EXAMPLE_NAME/data/`
63+
scripts/ # [Optional] Directory for scripts needed to setup the example
64+
src/
65+
nat_$EXAMPLE_NAME/ # All example modules must start with the prefix `nat_`
66+
configs/
67+
config.yml # At least one config file for the example
68+
data/ # [Optional] Directory for data files needed to run the example
69+
... # [Optional] Data files needed to run the example
70+
__init__.py
71+
register.py
72+
README.md or README.ipynb # Documentation for the example
73+
pyproject.toml # Must register the example with `nat`
74+
```
75+
76+
### Documentation
77+
Each example must include clear documentation on how to run it. This can be provided in either:
78+
- A README.md file at the top level of the example directory, the `examples/.template/README.md` file can be copied into the example directory and used as a starting point.
79+
- A README.ipynb Jupyter notebook that walks through the example
80+
81+
In both cases, the documentation should include:
82+
83+
- A description of the example
84+
- Key features of the example
85+
- Setup instructions
86+
- How to run the example
87+
- Expected results
88+
- [Optional] Troubleshooting tips
89+
90+
## Testing
91+
To ensure examples remain functional, each example must include unit tests written using `pytest`. Tests should verify the core functionality of the example and help catch issues when dependencies are updated.
92+
93+
## Code Style
94+
All code should be compatible with the linting rules defined in the root `pyproject.toml` file. To ensure your code is compatible, run the following command:
95+
96+
```bash
97+
# Ensure all development dependencies are installed
98+
uv sync --dev
99+
100+
./ci/scripts/checks.sh
101+
```
102+
103+
## License
104+
All contributions must be made under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0).
105+
106+
## Code of Conduct
107+
All contributors must follow the [Code of Conduct](CODE-OF-CONDUCT.md).

README.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,58 @@ See the License for the specific language governing permissions and
1515
limitations under the License.
1616
-->
1717

18+
![NVIDIA NeMo Agent Toolkit Examples](./docs/source/_static/banner.png "NVIDIA NeMo Agent Toolkit Examples")
19+
1820
# NVIDIA NeMo Agent Toolkit Examples
1921

20-
This repository contains examples for the [NVIDIA NeMo Agent toolkit](https://github.com/NVIDIA/NeMo-Agent-Toolkit).
22+
This repository contains community examples for the [NVIDIA NeMo Agent Toolkit](https://github.com/NVIDIA/NeMo-Agent-Toolkit). Whether you're new to using the toolkit, an experienced user looking for inspiration, or hoping to share your own examples with the community, this repository will help you get started.
23+
24+
25+
> [!NOTE]
26+
> Both the NeMo Agent Toolkit [repository](https://github.com/NVIDIA/NeMo-Agent-Toolkit) and this repository contain examples. However, there are some differences in the examples between the two repositories:
27+
>
28+
> | Repository | Example Focus | Update Cadence |
29+
> |------------|--------------|----------------|
30+
> | NeMo Agent Toolkit | Examples focused on toolkit features and capabilities | Updated each release to work with latest version |
31+
> | NeMo Agent Toolkit Examples | Examples driven by community use cases and scenarios | Bound to specific toolkit versions, updated as needed |
32+
33+
34+
## Getting Started
35+
36+
Each example is a self-contained directory that contains a README with instructions for running the example.
37+
38+
All examples require a local clone of this repository, uv, and a Python 3.11+ environment. Please follow the instructions below to get started.
39+
40+
1. Clone the repository
41+
42+
```bash
43+
git clone https://github.com/NVIDIA/NeMo-Agent-Toolkit-Examples.git
44+
cd NeMo-Agent-Toolkit-Examples
45+
```
46+
47+
1. Fetch the data sets by downloading the LFS files.
48+
```bash
49+
git lfs install
50+
git lfs fetch
51+
git lfs pull
52+
```
53+
54+
1. Install uv using the instructions [here](https://docs.astral.sh/uv/getting-started/installation/).
55+
56+
1. Create a new environment using the following command:
57+
58+
```bash
59+
uv venv --python 3.13 --seed .venv
60+
source .venv/bin/activate
61+
62+
uv sync --dev
63+
```
64+
65+
> [!NOTE]
66+
> Python 3.11 & 3.12 are also supported simply replace `3.13` with `3.11` or `3.12` in the `uv` command above.
67+
68+
To run an example, navigate to the example directory and follow the instructions in the README.
69+
70+
## Contributing
71+
72+
We welcome contributions to the repository! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information about how to contribute to the repository, requirements, and how to submit an example.

ci/scripts/checks.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,27 @@ PRE_COMMIT_RETVAL=$?
2626
${SCRIPT_DIR}/python_checks.sh
2727
PY_CHECKS_RETVAL=$?
2828

29-
if [[ ${PRE_COMMIT_RETVAL} -ne 0 || ${PY_CHECKS_RETVAL} -ne 0 ]]; then
29+
echo "Checking copyright headers"
30+
python ${SCRIPT_DIR}/copyright.py --verify-apache-v2
31+
COPYRIGHT_RETVAL=$?
32+
if [[ ${COPYRIGHT_RETVAL} -eq 0 ]]; then
33+
echo -e "\n\n>>>> PASSED: copyright check\n\n"
34+
else
35+
echo -e "\n\n>>>> FAILED: copyright check\n\n"
36+
fi
37+
38+
39+
echo "Running Documentation checks"
40+
${SCRIPT_DIR}/documentation_checks.sh
41+
DOCUMENTATION_RETVAL=$?
42+
if [[ ${DOCUMENTATION_RETVAL} -eq 0 ]]; then
43+
echo -e "\n\n>>>> PASSED: documentation check\n\n"
44+
else
45+
echo -e "\n\n>>>> FAILED: documentation check\n\n"
46+
fi
47+
48+
49+
if [[ ${PRE_COMMIT_RETVAL} -ne 0 || ${PY_CHECKS_RETVAL} -ne 0 || ${COPYRIGHT_RETVAL} -ne 0 || ${DOCUMENTATION_RETVAL} -ne 0 ]]; then
3050
echo ">>>> FAILED: checks"
3151
exit 1
3252
fi

ci/scripts/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export PY_DIRS="${PY_ROOT} ${PROJECT_ROOT}/packages ${PROJECT_ROOT}/tests ${PROJ
2424

2525
# Determine the commits to compare against. If running in CI, these will be set. Otherwise, diff with main
2626
export AIQ_LOG_LEVEL=WARN
27-
export CI_MERGE_REQUEST_TARGET_BRANCH_NAME=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-"develop"}
27+
export CI_MERGE_REQUEST_TARGET_BRANCH_NAME=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-"main"}
2828

2929
if [[ "${GITLAB_CI}" == "true" ]]; then
3030
export BASE_SHA=${BASE_SHA:-${CI_MERGE_REQUEST_TARGET_BRANCH_SHA:-${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$(${SCRIPT_DIR}/gitutils.py get_merge_target --current-branch=${CURRENT_BRANCH})}}}

ci/scripts/github/checks.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,3 @@ create_env group:dev
2424

2525
rapids-logger "Running checks"
2626
${SCRIPT_DIR}/checks.sh
27-
28-
rapids-logger "Checking copyright headers"
29-
python ${SCRIPT_DIR}/copyright.py --verify-apache-v2
30-
31-
32-
rapids-logger "Runing Documentation checks"
33-
${SCRIPT_DIR}/documentation_checks.sh

docs/source/_static/banner.png

Lines changed: 3 additions & 0 deletions
Loading

examples/.template/README.md

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
<!--
2+
SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
SPDX-License-Identifier: Apache-2.0
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
18+
# EXAMPLE_TITLE
19+
20+
<!-- Replace with a brief description of what your example demonstrates -->
21+
This example demonstrates [DESCRIPTION_OF_WHAT_YOUR_EXAMPLE_DOES] using the NVIDIA NeMo Agent toolkit, fully configured through a YAML file. It showcases [SPECIFIC_FEATURES_YOUR_EXAMPLE_HIGHLIGHTS].
22+
23+
## Table of Contents
24+
25+
- [EXAMPLE\_TITLE](#example_title)
26+
- [Table of Contents](#table-of-contents)
27+
- [Key Features](#key-features)
28+
- [Installation and Setup](#installation-and-setup)
29+
- [Install this Workflow:](#install-this-workflow)
30+
- [Set Up API Keys](#set-up-api-keys)
31+
- [Run the Workflow](#run-the-workflow)
32+
- [Deployment-Oriented Setup](#deployment-oriented-setup)
33+
- [Build the Docker Image](#build-the-docker-image)
34+
- [Run the Docker Container](#run-the-docker-container)
35+
- [Test the API](#test-the-api)
36+
- [Expected API Output](#expected-api-output)
37+
- [Customization Guide](#customization-guide)
38+
- [Adding New Functions](#adding-new-functions)
39+
- [Modifying the Agent](#modifying-the-agent)
40+
- [Using Different Models](#using-different-models)
41+
42+
---
43+
44+
## Key Features
45+
46+
<!-- Replace with your specific features -->
47+
- **Custom Functions:** Demonstrates [DESCRIBE_YOUR_CUSTOM_FUNCTIONS]
48+
- **Agent Integration:** Uses a [AGENT_TYPE] that [DESCRIBE_WHAT_THE_AGENT_DOES]
49+
- **Multi-step Problem Solving:** Shows how an agent can [DESCRIBE_COMPLEX_WORKFLOWS]
50+
- **Custom Function Registration:** Demonstrates the NeMo Agent toolkit plugin system for [DESCRIBE_PLUGIN_FUNCTIONALITY]
51+
- **YAML-based Configuration:** Fully configurable workflow that showcases [DESCRIBE_CONFIGURATION_BENEFITS]
52+
53+
---
54+
55+
## Installation and Setup
56+
57+
### Install this Workflow:
58+
59+
From the root directory of the NeMo Agent toolkit library, run the following commands:
60+
61+
```bash
62+
uv pip install -e examples/EXAMPLE_CATEGORY/EXAMPLE_NAME
63+
```
64+
65+
### Set Up API Keys
66+
Depending on which workflows you are running, you may need to obtain API keys from the respective services. Most NeMo Agent toolkit workflows require an NVIDIA API key defined with the `NVIDIA_API_KEY` environment variable. An API key can be obtained by visiting [`build.nvidia.com`](https://build.nvidia.com/) and creating an account.
67+
68+
Some workflows may also require an OpenAI API key. Visit [OpenAI](https://openai.com/) and create an account. Navigate to your account settings to obtain your OpenAI API key.
69+
70+
```bash
71+
export NVIDIA_API_KEY=<YOUR_API_KEY>
72+
export OPENAI_API_KEY=<YOUR_API_KEY> # OPTIONAL
73+
```
74+
75+
### Run the Workflow
76+
77+
Return to your original terminal, and run the following command from the root of the NeMo Agent toolkit repo to execute this workflow with the specified input:
78+
79+
```bash
80+
nat run --config_file examples/EXAMPLE_CATEGORY/EXAMPLE_NAME/configs/config.yml --input "YOUR_EXAMPLE_INPUT_PROMPT"
81+
```
82+
83+
**Expected Workflow Output**
84+
<!-- Replace with your expected output -->
85+
```
86+
YOUR_EXPECTED_OUTPUT_HERE
87+
```
88+
89+
## Deployment-Oriented Setup
90+
91+
For a production deployment, use Docker:
92+
93+
### Build the Docker Image
94+
95+
Prior to building the Docker image ensure that you have followed the steps in the [Installation and Setup](#installation-and-setup) section, and you are currently in the NeMo Agent toolkit virtual environment.
96+
97+
From the root directory of the NeMo Agent toolkit repository, build the Docker image:
98+
99+
```bash
100+
docker build --build-arg NAT_VERSION=$(python -m setuptools_scm) -t EXAMPLE_NAME -f examples/EXAMPLE_CATEGORY/EXAMPLE_NAME/Dockerfile .
101+
```
102+
103+
### Run the Docker Container
104+
Deploy the container:
105+
106+
```bash
107+
docker run -p 8000:8000 -p 6006:6006 -e NVIDIA_API_KEY -e OPENAI_API_KEY EXAMPLE_NAME
108+
```
109+
110+
Note, a phoenix telemetry service will be exposed at port 6006.
111+
112+
### Test the API
113+
Use the following curl command to test the deployed API:
114+
115+
```bash
116+
curl -X 'POST' \
117+
'http://localhost:8000/generate' \
118+
-H 'accept: application/json' \
119+
-H 'Content-Type: application/json' \
120+
-d '{"input_message": "YOUR_EXAMPLE_INPUT_PROMPT"}'
121+
```
122+
123+
### Expected API Output
124+
The API response should be similar to the following:
125+
126+
```bash
127+
{
128+
"input": "YOUR_EXAMPLE_INPUT_PROMPT",
129+
"value": "YOUR_EXPECTED_OUTPUT_HERE"
130+
}
131+
```
132+
133+
## Customization Guide
134+
135+
<!-- Add any specific customization instructions for your example -->
136+
137+
### Adding New Functions
138+
1. Define a new config class in `register.py` that inherits from `FunctionBaseConfig`
139+
2. Create a function decorated with `@register_function`
140+
3. Add the function to your `config.yml` file
141+
4. Update the workflow's `tool_names` list
142+
143+
### Modifying the Agent
144+
- Change the `_type` in the workflow section to use different agent types
145+
- Adjust `max_iterations`, `temperature`, or other parameters as needed
146+
- Add custom system prompts or modify the agent behavior
147+
148+
### Using Different Models
149+
- Update the `model_name` in the LLM configuration
150+
- Adjust parameters such as `temperature` and `max_tokens`
151+
- Switch between different LLM providers (OpenAI, NIM, and so on)

0 commit comments

Comments
 (0)