Commit 91e5837
authored
plugin docs: Stabilize the public plugin authoring API (#1959)
# Stabilize the public plugin authoring API
Closes #1952.
## Summary
This PR defines `nat.plugin_api` as the stable public import surface for third-party plugin authors and updates the author-facing docs/examples to use that surface instead of deeper implementation modules.
It also adds a third-party plugin package guide for partner-owned repositories, including package naming, project layout, `nat.plugins` entry points, compatibility expectations, listing requirements, and testing guidance.
The intent is to make the common external plugin contract explicit without redesigning provider-specific capabilities such as web search results, embeddings, or retrieval payloads, and without prematurely promoting every runtime extension point into the stable facade.
## What Changed
- Adds `nat.plugin_api` as the public facade for plugin authoring APIs:
- common registration decorators
- builders and function/function-group authoring types
- configuration bases and refs for promoted plugin surfaces
- provider info helpers
- secret helpers
- small middleware, memory, and object-store implementation contracts needed by registered components
- Adds contract tests for the exact `nat.plugin_api.__all__` export map so public API drift is intentional.
- Tracks deferred public API candidates in the contract test, with source modules and rationale, so intentionally unpromoted surfaces are documented and do not silently rot.
- Adds a public Plugin API docs page that distinguishes stable authoring APIs, trusted-plugin surfaces, deferred candidates, and private implementation modules.
- Adds third-party plugin packaging docs based on the external repository process: repository ownership, package layout, dependency boundaries, version compatibility, licensing expectations, plugin listing metadata, and contribution checklist.
- Documents the entry-point policy explicitly: new external packages should use the `nat.plugins` entry-point group, while `nat.components` remains supported for backward compatibility.
- Clarifies that telemetry facade support covers exporter registration and configuration; exporter runtime implementation APIs remain subsystem-specific until promoted deliberately.
- Updates custom component docs, workflow templates, and examples to import from `nat.plugin_api`.
- Keeps docs for deferred extension points on their existing subsystem imports instead of presenting them as stable `nat.plugin_api` exports.
- Extends `ToolTestRunner` with function-group helpers so external packages can test registered function groups and assert `group__function` names without constructing a full workflow.
- Fixes stale function-group docs/examples that still referenced legacy group.function names; runtime dot-compatibility remains unchanged.
- Clarifies that the existing Tavily and Exa integrations are LangChain-backed tools, while external integrations should depend on the framework-agnostic NeMo Agent Toolkit plugin authoring API.
## Scope Boundaries
In scope:
- Public import stability for plugin authors.
- Documentation of which APIs third-party packages should use.
- Third-party plugin package guidance for external repository maintainers.
- Regression tests that protect the public facade.
- Documented deferred candidates for advanced extension points that should be reviewed separately before promotion.
- Function-group testing support needed by external packages using the `group__function` convention.
Out of scope:
- A shared web search result schema.
- New capability-specific interfaces for search, embeddings, retrieval, or other managed-provider features.
- Removing existing legacy imports from implementation modules.
- Breaking users that still import from older module paths or still publish `nat.components` entry points.
- Promoting advanced subsystem extension points that need more review, including front ends, logging methods, registry handlers, optimizer hooks, finetuning components, and TTC strategies.
Web search result fields remain provider-specific in this PR. Third-party packages should use the public plugin authoring API, but their result payloads should stay unconstrained unless a separate capability contract is designed later.
## Motivation
External packages such as `nemo-agent-toolkit-tavily` need a clearer contract for which NeMo Agent Toolkit APIs are public and stable. Today, plugin examples and downstream packages can end up importing from implementation modules such as `nat.builder.*`, `nat.cli.register_workflow`, and `nat.data_models.*`.
This PR creates a conservative facade that external packages can rely on across minor and patch releases, while leaving private implementation modules free to evolve as long as the public contract remains intact.
Installed plugins still execute as trusted Python code in the application environment. This PR stabilizes import paths and authoring contracts; it does not make untrusted plugins safe to install or run.
## Testing
- `uv run ruff check packages/nvidia_nat_core/src/nat/plugin_api.py packages/nvidia_nat_core/tests/nat/test_plugin_api.py packages/nvidia_nat_test/src/nat/test/tool_test_runner.py packages/nvidia_nat_core/tests/nat/tools/test_tool_test_runner.py packages/nvidia_nat_langchain/src/nat/plugins/langchain/tools/tavily_internet_search.py packages/nvidia_nat_langchain/src/nat/plugins/langchain/tools/exa_internet_search.py`
- `uv run --project packages/nvidia_nat_core --extra test pytest packages/nvidia_nat_core/tests/nat/test_plugin_api.py packages/nvidia_nat_core/tests/nat/tools/test_tool_test_runner.py -q`
- `11 passed`
- `uv run ruff check packages/nvidia_nat_core/src/nat/plugin_api.py packages/nvidia_nat_core/tests/nat/test_plugin_api.py docs/source/extend/third-party-plugins.md`
- `uv run --project packages/nvidia_nat_core --extra test pytest packages/nvidia_nat_core/tests/nat/test_plugin_api.py packages/nvidia_nat_core/tests/nat/tools/test_tool_test_runner.py -q`
- `14 passed`
- `git diff --check`
- `python3 ci/scripts/license_diff.py develop > license_diff_output.txt`
- output file is empty
- `python3 ci/scripts/path_checks.py --check-paths-in-files`
- plugin API and third-party plugin docs path issues are cleared; local full run still reports unrelated missing `external/lc-deepagents-quickstarts` example paths from the checkout
## Follow-Ups
- Migrate downstream external repos, starting with `nemo-agent-toolkit-tavily`, to import from `nat.plugin_api`.
- Defer breaking import removals until external packages have had a release cycle to move to the facade.
- Review deferred extension points individually before promoting them into `nat.plugin_api`.
- Consider future capability contracts only where there is a concrete interoperability need. Web search result payloads are intentionally left provider-specific here.
## 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/index.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**
* Updated many examples to use unified nat.plugin_api imports; added a Plugin API guide and third‑party plugin guidance; switched function-group/tool naming examples to double‑underscore separators.
* **New Features**
* Introduced nat.plugin_api as the stable public plugin authoring surface.
* Added function‑group testing support to the test tooling to verify and invoke grouped tools.
* **Tests**
* Added tests enforcing the plugin API export contract and preferred import conventions.
* Added tests covering function‑group exposure and invocation.
Authors:
- Bryan Bednarski (https://github.com/bbednarski9)
Approvers:
- https://github.com/mnajafian-nv
URL: #19591 parent 3424a44 commit 91e5837
47 files changed
Lines changed: 1739 additions & 244 deletions
File tree
- docs/source
- build-workflows
- advanced
- functions-and-function-groups
- components
- extend
- custom-components
- custom-functions
- testing
- get-started/tutorials
- improve-workflows
- run-workflows/existing-agents
- examples
- A2A
- math_assistant_a2a_protected/configs
- math_assistant_a2a
- dynamo_integration
- react_benchmark_agent
- src/react_benchmark_agent
- evaluators
- tests
- packages
- nvidia_nat_core
- src/nat
- builder
- cli/commands/workflow/templates
- middleware
- defense
- red_teaming
- tests/nat
- builder
- tools
- nvidia_nat_eval/src/nat/plugins/eval/runtime
- nvidia_nat_langchain/src/nat/plugins/langchain/tools
- nvidia_nat_test/src/nat/test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
172 | | - | |
| 171 | + | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
248 | | - | |
| 247 | + | |
| 248 | + | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
292 | | - | |
293 | | - | |
| 292 | + | |
| 293 | + | |
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
432 | 435 | | |
433 | 436 | | |
434 | 437 | | |
| |||
521 | 524 | | |
522 | 525 | | |
523 | 526 | | |
524 | | - | |
525 | | - | |
526 | | - | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
527 | 530 | | |
528 | 531 | | |
529 | 532 | | |
| |||
603 | 606 | | |
604 | 607 | | |
605 | 608 | | |
606 | | - | |
| 609 | + | |
| 610 | + | |
607 | 611 | | |
608 | 612 | | |
609 | 613 | | |
| |||
823 | 827 | | |
824 | 828 | | |
825 | 829 | | |
826 | | - | |
827 | | - | |
| 830 | + | |
| 831 | + | |
828 | 832 | | |
829 | 833 | | |
830 | 834 | | |
831 | | - | |
| 835 | + | |
832 | 836 | | |
833 | 837 | | |
834 | 838 | | |
| |||
Lines changed: 8 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
| 368 | + | |
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
498 | | - | |
| 498 | + | |
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
| |||
602 | 602 | | |
603 | 603 | | |
604 | 604 | | |
605 | | - | |
606 | | - | |
| 605 | + | |
| 606 | + | |
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
| |||
640 | 640 | | |
641 | 641 | | |
642 | 642 | | |
643 | | - | |
| 643 | + | |
644 | 644 | | |
645 | 645 | | |
646 | 646 | | |
| |||
758 | 758 | | |
759 | 759 | | |
760 | 760 | | |
761 | | - | |
| 761 | + | |
762 | 762 | | |
763 | 763 | | |
764 | 764 | | |
765 | | - | |
| 765 | + | |
766 | 766 | | |
767 | 767 | | |
768 | 768 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
111 | 114 | | |
112 | 115 | | |
113 | 116 | | |
| |||
Lines changed: 34 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | | - | |
30 | | - | |
| 28 | + | |
31 | 29 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 30 | + | |
| 31 | + | |
36 | 32 | | |
37 | | - | |
38 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
44 | 53 | | |
45 | 54 | | |
46 | 55 | | |
47 | 56 | | |
48 | | - | |
| 57 | + | |
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
| |||
61 | 70 | | |
62 | 71 | | |
63 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
64 | 76 | | |
65 | 77 | | |
| 78 | + | |
66 | 79 | | |
67 | 80 | | |
68 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
69 | 88 | | |
70 | 89 | | |
71 | 90 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
78 | 83 | | |
79 | 84 | | |
80 | 85 | | |
| |||
91 | 96 | | |
92 | 97 | | |
93 | 98 | | |
94 | | - | |
| 99 | + | |
95 | 100 | | |
96 | 101 | | |
97 | 102 | | |
| |||
0 commit comments