agentads-nat
Monetize AI agents built on NVIDIA NeMo Agent Toolkit with contextual ads. One line to integrate. Never blocks your agent (50ms timeout).
Install
pip install agentads-nat
With NeMo Agent Toolkit support:
pip install agentads-nat[nat]
Quick Start
With NeMo Agent Toolkit
Add to your workflow config:
functions:
monetize:
_type: agentads_monetize
publisher_api_key: ${AGENTADS_API_KEY}
format: suffix # suffix | citation | followup
timeout_ms: 50 # never blocks your agent
workflow:
_type: react_agent
tool_names: [your_tools, monetize]
llm_name: your_llm
Run:
export AGENTADS_API_KEY=pub_xxx
nat run --config_file config.yaml --input "What CRM should I use?"
Standalone (any Python agent)
from agentads_nat import AgentAdsConfig, monetize_output
config = AgentAdsConfig(publisher_api_key="pub_xxx")
# Your agent produces a response
response = await my_agent(query)
# One line to monetize
result = await monetize_output(config, response, query=query)
Middleware wrapper
from agentads_nat import AgentAdsConfig, AgentAdsMiddleware
config = AgentAdsConfig(publisher_api_key="pub_xxx")
middleware = AgentAdsMiddleware(config)
# Wrap any async function
monetized_agent = middleware.wrap(my_agent)
result = await monetized_agent("What CRM should I use?")
Ad Formats
| Format | Rendering |
|---|---|
suffix (default) |
--- separator + italic ad below response |
citation |
Blockquote with Sponsored label |
followup |
Italic sponsored suggestion |
OpenShell Policy
If running inside NVIDIA OpenShell, apply the included network policy:
openshell policy set agentads --policy policies/agentads.yaml --wait
This allows only POST /v1/bid to api.tryagentads.com.
How It Works
- Your agent generates a response normally
- AgentAds fires a parallel bid request (50ms timeout - never delays your agent)
- If an ad fills, it's appended to the response in your chosen format
- If no fill or timeout, the response passes through unchanged
No latency impact. No data leaves beyond the query/response excerpt (500/300 chars max).
Configuration
| Option | Default | Description |
|---|---|---|
publisher_api_key |
required | Your key from tryagentads.com |
format |
suffix |
Ad rendering format |
api_url |
https://api.tryagentads.com |
API endpoint |
timeout_ms |
50 |
Bid timeout (ms) |
disabled |
false |
Kill switch for ads |
session_id |
null |
Session ID for frequency capping |
Get Your API Key
Sign up at tryagentads.com to get a publisher API key.
Metadata
Release files for agentads-nat 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agentads_nat-0.1.0.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agentads_nat-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.6 kB
Release files / agentads_nat-0.1.0.tar.gz
| Download URL | agentads_nat-0.1.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4eac4ceab3010b766db0e87e8421e676d351c530866c2749f402b18ffdd3fbfb
|
|
BLAKE2b-256 checksum How to use checksums |
850e7ee85a4335aaf58689bf962edd0575e6f755e6eba809c54c73c622b9a24d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / agentads_nat-0.1.0-py3-none-any.whl
| Download URL | agentads_nat-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f7aa5e7f87f268d82b7440a43eb74a612db563ae7c6f963a1224facd9fe9e00
|
|
BLAKE2b-256 checksum How to use checksums |
a5d1f05f7b39fe2ac3a6fc67fe5e96c713aadafdf3b09359bc3667fe5f41adfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|