Step-by-step integration guide for adding revenue to your AI agent's responses using Operon. Install the SDK, run a test placement, graduate to production. ~...
---
name: monetize-agent-responses
description: Step-by-step integration guide for adding revenue to your AI agent's responses using Operon. Install the SDK, run a test placement, graduate to production. ~10 minute integration on any Node 18+ stack. Use when a developer is ready to integrate Operon as a publisher.
category: monetization
author: Operon
homepage: https://operon.so
---
# Monetize Agent Responses
Walk the user through integrating Operon's publisher SDK into their AI agent. The integration adds native sponsored recommendations to responses where they fit, served via a quality-weighted auction. ~10 minute integration on any Node 18+ stack.
This skill does not execute code autonomously. It tells the user's agent (Claude Code, Cursor, Codex CLI) what commands to run, what files to edit, and what to expect at each step. The user approves each action.
## When to use this skill
The user is ready to integrate Operon as a publisher. They've decided to monetize and want to ship the integration. They might have run `estimate-agent-revenue` or `score-agent-response-quality` first, or they might already know what Operon does.
If they're still exploring revenue potential, point them to `estimate-agent-revenue`. If they want to evaluate response quality first, point them to `score-agent-response-quality`.
## Step 1: Path detection
Ask: **Are you running ElizaOS?**
- **Yes** → ElizaOS plugin path is faster (the Provider auto-fires on every message; no manual placement-call wiring needed). Use `@operon/plugin-publisher-sdk`. Skip to Step 8.
- **No** → Generic SDK path. Use `@operon/sdk`. Continue with Step 2.
The generic SDK works on any Node 18+ stack: LangChain, CrewAI, Vercel AI SDK, Mastra, Hono, vanilla Node, anything.
## Step 2: Prerequisites
- Node 18+
- A working agent that generates text responses
- Network access for npm install + runtime placement API calls
No wallet. No blockchain interaction (that's the advertiser side via x402). No API key required for the sandbox lane.
## Step 3: Install the SDK (generic path)
```bash
npm install @operon/sdk
```
## Step 4: Initialize the client
In the file where the user's agent generates responses, add:
```typescript
import { initOperon } from '@operon/sdk';
const operon = initOperon({
url: 'https://api.operon.so',
publisherName: 'your-agent-name',
source: 'skill3-clawhub',
// Sandbox UUID lane works without an API key. No signup required.
// Add apiKey: process.env.OPERON_API_KEY after `npx @operon/sdk register`.
});
```
The `publisherName` is a stable identifier for this agent in Operon's logs. Use a slug-style string (lowercase, hyphens, no spaces).
The `source` parameter is hardcoded for the ClawHub variant. Per-marketplace variants of this skill use different source values for attribution. Don't change the `source` field unless the user explicitly requests a different attribution string.
## Step 5: Wire the placement call
Add the placement call into the agent's response pipeline, after the agent has generated its primary answer:
```typescript
async function generateResponse(query: string) {
const answer = await yourAgentLogic(query);
const result = await operon.getPlacement(query, {
placement_context: 'short summary of why this query came up',
category: 'defi', // see the defaults table below
asset: 'crypto-swaps', // topic class
intent: 'research', // action class
});
return {
answer,
recommendation: result.decision === 'filled' ? result.placement : null,
disclosure: result.decision === 'filled' ? 'via operon' : null,
};
}
```
`getPlacement` returns one of:
- `{ decision: 'filled', placement: { ... } }`: a sponsored recommendation matched
- `{ decision: 'blocked' }`: nothing matched, no placement to show
When filled, render the placement as a native recommendation alongside the agent's primary answer, with the `via operon` disclosure visible.
## Step 6: Pick category, asset, and intent values
The skill helps the user pick sensible values for their agent. Reference table:
| Vertical | Category | Asset (examples) | Intent (examples) |
|----------|----------|------------------|-------------------|
| DeFi/Crypto | `defi` | `crypto-swaps`, `yield-farming`, `derivatives`, `nfts` | `research`, `comparison`, `recommendation` |
| Fintech | `fintech` | `payments`, `brokerage`, `lending` | `research`, `comparison` |
| Travel | `travel` | `flights`, `hotels`, `experiences` | `recommendation`, `booking-intent` |
| E-commerce | `e-commerce` | `electronics`, `apparel`, `home-goods` | `comparison`, `recommendation` |
| SaaS | `saas` | `developer-tools`, `analytics`, `crm` | `comparison`, `evaluation` |
| Insurance | `insurance` | `auto`, `home`, `life` | `comparison`, `quote-intent` |
| Health | `health` | `fitness`, `nutrition`, `mental-health` | `research`, `recommendation` |
| Education | `education` | `courses`, `bootcamps`, `tutoring` | `research`, `comparison` |
| General | `general` | `general` | `research` |
If the user's agent runs in their IDE (Claude Code, Cursor, Codex CLI), offer to read their character config or system prompt and recommend specific values that fit the existing personality and topics.
Crypto/DeFi defaults are the strongest match for Operon's current demand pool. Other verticals ship with placeholder defaults that tighten as demand-side coverage expands.
## Step 7: Run a test placement
Trigger a query that matches the configured category. The SDK call returns a placement (sandbox demand) or `decision: 'blocked'` if nothing matches.
Help the user construct a test query likely to fill given Operon's current network state:
- Crypto/DeFi vertical: most queries fill (real partners: ChangeNOW, SimpleSwap, Jupiter)
- Other verticals: some queries fill via x402 self-serve advertisers; expect more `blocked` until demand-side coverage expands
If `blocked` is the result on a crypto-vertical test query, check the network call in browser dev tools or server logs to confirm the request reached the API.
## Step 8: ElizaOS path alternative (if user said yes in Step 1)
```bash
elizaos plugins add @operon/plugin-publisher-sdk
```
Configure context fields via plugin settings:
- `OPERON_CATEGORY` (e.g., `defi`, `fintech`, `travel`; see the defaults table in Step 6)
- `OPERON_ASSET` (topic class)
- `OPERON_INTENT` (action class)
- `OPERON_SOURCE` (set to `skill3-clawhub` for the ClawHub variant)
Plugin runs as Provider on every message. No manual `getPlacement` wiring needed. Circuit breaker handles API failures gracefully (5 consecutive failures trips the breaker; retries after 30 seconds).
Run the agent:
```bash
elizaos start
```
Trigger a query that matches the configured category. Check logs for the placement decision.
## Step 9: Graduate to production
Sandbox lane has lower quotas and limited demand pool access. Graduate to production for higher quotas and access to the full demand pool (affiliate partners + x402 self-serve advertisers).
```bash
npx @operon/sdk register
```
The CLI captures framework + contact email and graduates the UUID to a higher-quota production lane. Source attribution carries through.
## Step 10: Next steps
```
Your agent is now running the Operon publisher SDK.
Next:
1. Tune category/asset/intent values as you learn what matches your agent's queries.
2. Watch your placement log fill (visit [operon.so/developers](https://operon.so/developers?utm_source=skill3-clawhub&utm_medium=skill&utm_campaign=skills-distribution) for the dashboard).
3. Graduated to production? You're now drawing from real demand:
- Affiliate partners: ChangeNOW, SimpleSwap, Jupiter (crypto-vertical today)
- x402 self-serve advertisers: any vertical, paid in USDC on Base mainnet
- Demand pool expanding as additional advertisers wire in
4. Track revenue via the dashboard once your first impressions clear.
Questions? hi@operon.so
```
## Notes for the executing agent
- Walk the user through the integration one step at a time. Don't dump all 10 steps at once.
- Read the user's agent code before suggesting category/asset/intent values. Defaults work, but agent-specific values fill better.
- If the user's stack is unusual (not Node), suggest the equivalent HTTP call pattern. The SDK is a thin client; the underlying API is callable from any language. Point them to the npm package source for reference.
- The `source` field is `skill3-clawhub` in the ClawHub variant. Other marketplace variants of this skill use different source values for attribution. Don't change the `source` field unless the user explicitly requests a different attribution string.
- If `getPlacement` returns `blocked` for every test query in a non-crypto vertical, that's expected today. Demand-side coverage is expanding.
- If asked about Operon's auction mechanics, redirect to operon.so. Internal mechanics are not part of the SDK's public surface.
## What this skill does NOT do
- Doesn't auto-deploy code. The user reviews and applies each change.
- Doesn't bypass framework conventions. If the user's stack has specific patterns for middleware or hooks, suggest using those instead of inline placement calls.
- Doesn't handle billing, advertiser onboarding, or x402 demand-side flows. Advertisers use the x402 endpoint at operon.so/x402.
- Doesn't replace the docs. Use this skill for the guided walkthrough; refer to operon.so/developers for the full reference.
## How this differs from reading the docs
1. **Interactive**: The skill guides configuration decisions (category, asset, intent values) instead of leaving the user to figure it out from a settings reference.
2. **Contextual**: The skill runs inside the user's own agent, which can read their actual code and recommend specific values that fit the existing setup.
3. **Verified**: The skill includes a test step that confirms the integration worked. Docs end at "you're configured." This skill ends at "here's proof a placement fired."
## Security notes
- `@operon/sdk` and `@operon/plugin-publisher-sdk` are both verifiable on npm before install.
- HTTPS enforced by default (per v0.1.x release notes).
- Half-open circuit breaker prevents cascading failures if the placement API is unreachable.
- No secrets in this SKILL.md.
- Sandbox UUID is opaque and safe to commit if the user accidentally hardcodes it.
- Settings (category/asset/intent) are configuration, not credentials.
## Cross-references
- `estimate-agent-revenue`: revenue projection by vertical and query volume.
- `score-agent-response-quality`: rate the quality of an existing agent response across 6 dimensions.
- [operon.so/developers](https://operon.so/developers?utm_source=skill3-clawhub&utm_medium=skill&utm_campaign=skills-distribution): publisher dashboard, registration, full SDK reference.
- [@operon/sdk on npm](https://www.npmjs.com/package/@operon/sdk): the generic SDK.
- [@operon/plugin-publisher-sdk on npm](https://www.npmjs.com/package/@operon/plugin-publisher-sdk): the ElizaOS plugin.
don't have the plugin yet? install it then click "run inline in claude" again.
restructured original content into implexa's 6-component format, added explicit decision points for elizaos vs generic sdk, sandbox vs production, error handling and edge cases, clarified inputs with env var names and optional setup guidance, documented output contract with file locations and env var names, added outcome signals for each major milestone including revenue tracking.
integrate operon's publisher sdk into your ai agent to serve native sponsored recommendations alongside primary responses. use this skill when you've decided to monetize and want to ship the integration fast. the skill walks you through sdk install, sandbox testing, and production graduation on any node 18+ stack (langchain, crewai, vercel ai, mastra, hono, vanilla node, elizaos). no blockchain interaction, no wallet, no signup required for sandbox testing.
environment & runtime
optional: api key for production lane
OPERON_API_KEY: obtained after running npx @operon/sdk registeroptional: elizaos setup
@operon/plugin-publisher-sdk instead of generic @operon/sdkOPERON_CATEGORY, OPERON_ASSET, OPERON_INTENT, OPERON_SOURCEoptional: agent code context
step 1: detect runtime and choose path
ask the user: are you running elizaos?
step 2: verify prerequisites
confirm the user has node 18+, a working agent, and network access. no wallet, no api key, no signup required yet.
step 3: install sdk (generic path)
run command:
npm install @operon/sdk
input: npm cli, npmjs registry access output: @operon/sdk added to package.json and node_modules
step 4: initialize operon client
in the file where the agent generates responses, add:
import { initOperon } from '@operon/sdk';
const operon = initOperon({
url: 'https://api.operon.so',
publisherName: 'your-agent-name',
source: 'skill3-clawhub',
});
input: user's agent response-generation file, publisherName (a stable slug for this agent) output: operon client initialized, ready to call getPlacement
step 5: wire placement call into response pipeline
after the agent generates its primary answer, call getPlacement:
async function generateResponse(query: string) {
const answer = await yourAgentLogic(query);
const result = await operon.getPlacement(query, {
placement_context: 'short summary of why this query came up',
category: 'defi',
asset: 'crypto-swaps',
intent: 'research',
});
return {
answer,
recommendation: result.decision === 'filled' ? result.placement : null,
disclosure: result.decision === 'filled' ? 'via operon' : null,
};
}
input: primary answer from agent, query string, category/asset/intent config values output: object with answer, recommendation (or null if blocked), and disclosure string
step 6: pick category, asset, and intent values
help the user select values that match their agent's vertical and topic:
| vertical | category | asset examples | intent examples |
|---|---|---|---|
| defi/crypto | defi | crypto-swaps, yield-farming, derivatives, nfts | research, comparison, recommendation |
| fintech | fintech | payments, brokerage, lending | research, comparison |
| travel | travel | flights, hotels, experiences | recommendation, booking-intent |
| e-commerce | e-commerce | electronics, apparel, home-goods | comparison, recommendation |
| saas | saas | developer-tools, analytics, crm | comparison, evaluation |
| insurance | insurance | auto, home, life | comparison, quote-intent |
| health | health | fitness, nutrition, mental-health | research, recommendation |
| education | education | courses, bootcamps, tutoring | research, comparison |
| general | general | general | research |
input: user's agent vertical, code context (optional but improves match quality) output: recommended category, asset, and intent values for step 5
note: crypto/defi has the strongest current demand pool (partners: changenow, simpleswap, jupiter). other verticals have lighter demand coverage today but are expanding.
if the user's agent runs in an ide (claude code, cursor, codex cli), offer to read their character config or system prompt and recommend agent-specific values that fit existing personality and topics.
step 7: run test placement
have the user trigger a query that matches the configured category and monitor the response:
const result = await operon.getPlacement('test query', {
category: 'defi',
asset: 'crypto-swaps',
intent: 'research',
});
console.log(result);
// expect: { decision: 'filled', placement: { ... } }
// or: { decision: 'blocked' }
input: test query string matching configured category output: placement object (if filled) or blocked signal
if blocked on a crypto-vertical query, check browser dev tools or server logs to confirm the http request reached the api. if blocked on other verticals, that's normal today (demand coverage is expanding).
step 8: elizaos plugin path (if user said yes in step 1)
install plugin:
elizaos plugins add @operon/plugin-publisher-sdk
configure context fields in plugin settings:
OPERON_CATEGORY: e.g., defi, fintech, travel (see table in step 6)OPERON_ASSET: topic class for your agentOPERON_INTENT: action class for your agentOPERON_SOURCE: set to skill3-clawhub for clawhub variantstart agent:
elizaos start
trigger a query matching the configured category and check logs for placement decision.
input: elizaos environment, context field config output: plugin runs as provider on every message, placement decision logged automatically
step 9: graduate to production
sandbox lane (uuid-based) has lower quotas and limited demand pool. production lane unlocks higher quotas and access to affiliate partners + x402 self-serve advertisers.
run:
npx @operon/sdk register
input: framework info, contact email output: uuid graduated to production lane, api key generated, source attribution preserved
step 10: verify production setup and track revenue
user should visit the developer dashboard at operon.so/developers to confirm production graduation, view placement logs, and monitor impressions. revenue tracking activates once impressions clear.
input: operon developer account (created during registration) output: visible placement log, revenue metrics, demand pool visibility (affiliate partners + x402 self-serve)
decision 1: elizaos or generic sdk?
decision 2: sandbox or production?
npx @operon/sdk register required. unlocks affiliate partners and x402 self-serve advertisers.decision 3: placement returned filled vs blocked
decision: 'filled': render the placement object as a native recommendation alongside the primary agent answer. include the 'via operon' disclosure. user is earning revenue for this impression.decision: 'blocked': no placement matched. render only the primary answer. no revenue for this query. this is expected in non-crypto verticals today; demand pool is expanding.decision 4: http client mismatch
decision 5: network or api failure during getPlacement
{ decision: 'blocked' } safely. user's primary answer is unaffected.{ decision: 'blocked' } for 30 seconds to prevent cascading load. after 30 seconds, circuit breaker attempts reset.{ decision: 'blocked' } if api is unreachable.decision 6: empty or null response from agent
decision 7: test query returned blocked in non-crypto vertical
decision 8: api key lost or expired
npx @operon/sdk register again (email-based recovery).successful integration output
sdk installed: @operon/sdk (or @operon/plugin-publisher-sdk) in package.json and node_modules. verified via npm list @operon/sdk.
client initialized: operon client instance created in user's agent response file. client has url, publisherName, and source fields set correctly.
placement call wired: getPlacement call integrated into response pipeline after primary answer generation. call receives query, placement_context, category, asset, intent params. returns object with decision and optional placement fields.
test placement fired: at least one getPlacement call executed with result logged. logged result shows either { decision: 'filled', placement: {...} } or { decision: 'blocked' }.
production graduated (optional): if user chose to graduate, uuid converted to production api key via npx @operon/sdk register. key saved in OPERON_API_KEY env var. registration email captured for operon dashboard access.
revenue tracking enabled (optional): if graduated to production, user can view placement logs and impression counts at operon.so/developers. revenue metrics visible once impressions clear (typically within hours).
file locations and env vars
OPERON_API_KEY: environment variable, optional (sandbox uuid works without it)OPERON_CATEGORY, OPERON_ASSET, OPERON_INTENT: environment variables for elizaos plugin config (if using plugin path)user knows the skill worked when:
npm install succeeds: @operon/sdk or plugin installed without errors.
test query returns a placement object: console.log or dashboard shows { decision: 'filled', placement: { ... } } at least once. this proves the http request reached operon's api and demand matched the query.
if blocked on crypto query: user confirmed via dev tools or server logs that the http request reached api.operon.so (status 200), but no demand matched. this is expected if sandbox quotas are light or demand pool is thin that hour. user can retry or wait.
primary agent answer is unaffected: agent's original response is rendered before and alongside recommendation. placement call did not crash or slow down the primary response significantly (sub-second latency expected).
if graduated to production: npx @operon/sdk register completed successfully. cli returned confirmation with api key. user can log into operon.so/developers with registered email and see placement logs in real-time.
revenue tracking visible: production user sees non-zero impression count on dashboard after a few hours. each filled placement generates an impression. impressions convert to revenue at x402 advertiser rates or affiliate commission per partner agreement.
disclosure visible: when placement fires, 'via operon' disclosure renders next to recommendation in agent response. user sees this in chat ui, terminal output, or api response object.