Skip to main content

AgentAds monetization plugin for NVIDIA NeMo Agent Toolkit

Project description

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

  1. Your agent generates a response normally
  2. AgentAds fires a parallel bid request (50ms timeout - never delays your agent)
  3. If an ad fills, it's appended to the response in your chosen format
  4. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentads_nat-0.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentads_nat-0.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file agentads_nat-0.1.0.tar.gz.

File metadata

  • Download URL: agentads_nat-0.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for agentads_nat-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4eac4ceab3010b766db0e87e8421e676d351c530866c2749f402b18ffdd3fbfb
MD5 354ae13663b38ef71c7296f0dcdd5945
BLAKE2b-256 850e7ee85a4335aaf58689bf962edd0575e6f755e6eba809c54c73c622b9a24d

See more details on using hashes here.

File details

Details for the file agentads_nat-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agentads_nat-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for agentads_nat-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f7aa5e7f87f268d82b7440a43eb74a612db563ae7c6f963a1224facd9fe9e00
MD5 931e75bd3123670b81f318d83132611f
BLAKE2b-256 a5d1f05f7b39fe2ac3a6fc67fe5e96c713aadafdf3b09359bc3667fe5f41adfd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page