Skill: agentnewsdev/agent-news-api (version 1.2.2)

--- name: Agent News API version: 1.2.0 author: agentnewsapi repository: https://github.com/agentnewsapi/agentnewsapi status: Mainnet Beta description: A set of free and premium AI enriched global news streams for agents, provided by agentnewsapi.com. Powered by $ANA on Solana. tags: [news, web3, signals, autonomous-finance, zero-hitl] entry: agent-news-cli.js permissions: network: - api.agentnewsapi.com - agentnewsapi.com requires: runtime: node >= 22.0.0 env: - AGENT_NEWS_API_KEY (optional — auto-generated via Zero-HITL onboarding) - SOLANA_PRIVATE_KEY (optional — required for Zero-HITL auth and autonomous funding on premium endpoints) install: - npm install --- # Agent News API (Mainnet Beta) This skill grants autonomous agents access to the **Agent News API**, the premier signal ingestion point for AI entities seeking live global event context. We distill the noise of over 100,000 daily events into a filtered, enriched, and machine-readable stream of semantic payloads containing high signal metadata such as entities and locations. Agents can monitor market-moving events, extract tactical sentiment, and completely self-manage their API funding via Solana using our Zero-HITL (Human-In-The-Loop) architecture. ## 🛠️ Tools (For Autonomous Agent Use) The following tools are exposed to the LLM agent upon installation: ### `fetch_news_premium` Fetches the absolute latest, sub-second global signals from the Firehose. - **Cost:** $0.0001 USD worth of $SOL per story (dynamically pegged). - **Arguments:** - `limit` (integer): Number of signals to fetch (Max: 500). - `q` (string): Search or category query. - **Returns:** Array of structured Story Objects (see schema below). ### `fetch_news_free` Fetches archived news signals with a mandatory **20-minute time offset**. Ideal for lower criticality information gathering tasks. - **Cost:** Free. - **Limits:** 1 request per minute. Max 100 stories per request. - **Arguments:** - `limit` (integer): Number of signals to fetch (Max: 100). - `q` (string): Search or category query. ### `check_credit_balance` Queries the current API credit balance denominated in $SOL. Agents should call this before initiating high-frequency loops. ### `autonomous_onboard` Triggers the Zero-HITL registration flow. The agent uses its local Solana private key to sign a cryptographic challenge (`"Allow Agent News API Access"`), autonomously negotiating and saving a persistent `X-API-KEY`. ### `get_deposit_address` Returns the official Protocol Hot Wallet address ([REDACTED_SECRET]). Agents can use this to transfer native $SOL from their wallets to top up API credit. --- ## ⚡ WebSocket Stream (Premium Only) For sub-second latency updates, agents can connect to the global `firehose` stream. This is the recommended ingestion method for high-frequency autonomous decision making or rapid-response entities. - **Endpoint:** `https://api.agentnewsapi.com` - **Protocol:** Socket.io - **Event:** `news_update` ### Node.js Implementation Example ```javascript const io = require('socket.io-client'); const socket = io('https://api.agentnewsapi.com', { auth: { [REDACTED_SECRET] } }); socket.on('news_update', (data) => { console.log('New Signal Ingested:', data.title); // data._meta contains cost (e.g., 0.00000118 SOL) and remainingCredits }); socket.on('error', (err) => { if (err.code === 'INSUFFICIENT_CREDITS') { console.error('Refill $SOL balance to resume stream.'); } }); ``` - **Cost:** $0.0001 USD worth of $SOL per story received (same as premium REST). - **Latency:** Sub-second (Global Firehose). --- ## 💻 CLI Commands (For Human Operators) - `agentnews fetch --limit <number>`: Fetch real-time premium signals. - `agentnews fetch-free --limit <number>`: Fetch 20-minute delayed signals. - `agentnews balance`: Check current $SOL API credit balance. - `agentnews onboard`: Execute the Zero-HITL autonomous key generation. - `agentnews deposit-address`: Retrieve the Protocol Hot Wallet address. --- ## 🔐 Security & Zero-HITL Principles This skill handles sensitive authentication to enable true autonomy. 1. **Local-First Cryptography:** The `SOLANA_PRIVATE_KEY` is utilized strictly locally by the SDK to generate `nacl` detached signatures. The private key is **never** transmitted to the Agent News API servers. 2. **Dynamic Pegging:** The $SOL exchange rate is updated every second using a public Coinbase endpoint to maintain the fixed $0.0001 USD/story cost. 3. **Automated Deflation:** 25% of all $SOL API revenue is automatically allocated to buybacks and permanent burns of the protocol's governance token, **$ANA** ([REDACTED_SECRET]). --- ## 📦 Data Schema: Semantic Payloads All news signals are delivered as JSON objects specifically curated for LLM comprehension: | Field | Type | Description | | :--- | :--- | :--- | | `id` | string | Unique identifier for the story (e.g., `story_92b1...`). | | `title` | string | AI-curated headline focused on factual intensity. | | `summary` | string | High-signal technical distillation. | | `significance` | number | Impact score from 1 to 100 calculated by the reasoning engine. | | `sentiment` | object | Contains `label` (Positive/Negative/Neutral) and `score`. | | `entities` | array | List of extracted organizations, locations, and assets. | | `category` | string | Primary theme (Macro, Geopolitical, Crypto, etc). | | `_meta` | object | **Premium Only:** Contains transaction `cost` and `remainingCredits` in $SOL. | --- ## ⚙️ Environment Variables - `AGENT_NEWS_API_KEY`: *(Optional)* Your persistent API key (can be generated via `agentnews onboard`). - `SOLANA_PRIVATE_KEY`: *(Optional)* Base58 encoded Ed25519 key for Zero-HITL onboarding and automated funding. - `AGENT_NEWS_API_URL`: *(Optional)* Default is `https://api.agentnewsapi.com`.

path: agent-news-cli.js
content: #!/usr/bin/env node

const path = require('path');
const { AgentNewsClient } = require('./lib/agent-news-client');

// Load environment variables if dotenv is available
try {
    const dotenv = require('dotenv');
    dotenv.config();
} catch (e) {
    // dotenv not found, skipping
}

const [REDACTED_SECRET];
const privateKey = process.env.SOLANA_PRIVATE_KEY;
const apiUrl = process.env.AGENT_NEWS_API_URL || 'https://api.agentnewsapi.com';

async function main() {
    const args = process.argv.slice(2);
    const command = args[0];

    // Map the human-readable CLI commands to the OpenClaw Agent Tools
    const helpText = `
Agent News API - OpenClaw Skill CLI

Usage:
  node agent-news-cli.js <command> [options]

Agent Tools / Commands:
  fetch_news_premium   Fetch the latest curated news signals (Real-time, Paid)
                       Alias: fetch
  fetch_news_free      Fetch delayed news signals (20m delay, Free, Rate-limited)
                       Alias: fetch-free
  check_credit_balance Check your current API credit balance
                       Alias: balance
  autonomous_onboard   Self-issue a persistent API key via Solana (Zero-HITL)
                       Alias: onboard
  get_deposit_address  Get the Protocol Hot Wallet address for autonomous funding
                       Alias: deposit-address
  stream               Connect to the live WebSocket firehose (Premium)
                       Alias: listen
  help                 Show this help message

Options (for fetch commands):
  --limit <number>     Number of signals to fetch (Max: Premium 500, Free 100)
  --q <string>         Search or category query (e.g., "crypto", "macro")

Environment Variables:
  AGENT_NEWS_API_KEY   Your API Key
  SOLANA_PRIVATE_KEY   Your Solana Private Key (Base58) for Zero-HITL Auth
  AGENT_NEWS_API_URL   Override API URL (default: https://api.agentnewsapi.com)
    `;

    if (!command || command === 'help') {
        console.log(helpText);
        process.exit(0);
    }

    const client = new AgentNewsClient({
        apiKey,
        privateKey,
        apiUrl
    });

    // Helper to parse arguments
    const getArgValue = (flag, defaultValue = null) => {
        const index = args.indexOf(flag);
        return index !== -1 ? args[index + 1] : defaultValue;
    };

    try {
        if (command === 'fetch_news_premium' || command === 'fetch') {
            const limit = parseInt(getArgValue('--limit', 10));
            const query = getArgValue('--q');

            const params = { limit };
            if (query) params.q = query;

            const signals = await client.getLatestSignals(params);

            // Output pure JSON for OpenClaw to parse
            console.log(JSON.stringify({
                success: true,
                tier: 'premium',
                count: signals.length,
                query: query || null,
                data: signals
            }, null, 2));

        } else if (command === 'fetch_news_free' || command === 'fetch-free') {
            const limit = parseInt(getArgValue('--limit', 10));
            const query = getArgValue('--q');

            const params = { limit };
            if (query) params.q = query;

            const signals = await client.getFreeSignals(params);

            console.log(JSON.stringify({
                success: true,
                tier: 'free',
                delay: '20m',
                count: signals.length,
                query: query || null,
                data: signals
            }, null, 2));

        } else if (command === 'check_credit_balance' || command === 'balance') {
            const balance = await client.getCreditBalance();

            console.log(JSON.stringify({
                success: true,
                balance_sol: balance,
                currency: 'SOL'
            }, null, 2));

        } else if (command === 'autonomous_onboard' || command === 'onboard') {
            // Initiate the Zero-HITL signature flow
            await client.connect();
            console.log(JSON.stringify({
                success: true,
                message: "Zero-HITL Onboarding Successful",
                [REDACTED_SECRET],
                instructions: "Save this apiKey in your environment variables as AGENT_NEWS_API_KEY"
            }, null, 2));
            client.disconnect();

        } else if (command === 'get_deposit_address' || command === 'deposit-address') {
            const hotWallet = [REDACTED_SECRET];
            console.log(JSON.stringify({
                success: true,
                protocolHotWallet: hotWallet,
                instructions: "Transfer Native SOL to this address to fund your API credits."
            }, null, 2));

        } else if (command === 'stream' || command === 'listen') {
            // Require socket.io-client dynamically so it doesn't load for simple REST commands
            const io = require('socket.io-client');

            if (!apiKey && !client.apiKey) {
                console.error(JSON.stringify({
                    success: false,
                    error: "API Key required for the Premium WebSocket stream. Run 'onboard' first or set AGENT_NEWS_API_KEY."
                }, null, 2));
                process.exit(1);
            }

            // Using console.error for human-readable logs so stdout remains pure JSON for the agent
            console.error("Initiating connection to the Agent News Firehose... (Press Ctrl+C to exit)");

            const socket = io(apiUrl, {
                auth: { [REDACTED_SECRET] || client.apiKey }
            });

            socket.on('connect', () => {
                console.log(JSON.stringify({
                    success: true,
                    event: "connection_established",
                    message: "Sub-second real-time stream active."
                }, null, 2));
            });

            socket.on('news_update', (data) => {
                // Output pure JSON for each event so an agent can parse the stdout stream line-by-line
                console.log(JSON.stringify({
                    success: true,
                    event: 'news_update',
                    data: data
                }, null, 2));
            });

            socket.on('error', (err) => {
                console.error(JSON.stringify({
                    success: false,
                    event: 'socket_error',
                    error: err.code || err.message || err
                }, null, 2));

                if (err.code === 'INSUFFICIENT_CREDITS') {
                    console.error(JSON.stringify({
                        success: false,
                        suggestion: "Refill $SOL balance to resume stream. Use the 'deposit-address' command."
                    }, null, 2));
                    process.exit(1);
                }
            });

            socket.on('disconnect', () => {
                console.error(JSON.stringify({
                    success: true,
                    event: 'disconnect',
                    message: "Disconnected from Firehose."
                }, null, 2));
                process.exit(0);
            });

            // Prevent the Node process from exiting while the socket is open
            return;

        } else {
            console.error(JSON.stringify({
                success: false,
                error: `Unknown command: ${command}`
            }, null, 2));
            process.exit(1);
        }
    } catch (error) {
        // Ensure errors are also returned as valid JSON so the agent doesn't crash
        console.error(JSON.stringify({
            success: false,
            error: error.message || 'An unknown error occurred in the Agent News CLI.'
        }, null, 2));
        process.exit(1);
    }
}

main();

path: package.json
content: {
  "name": "@agentnews/openclaw-skill",
  "version": "1.2.0",
  "description": "OpenClaw Skill for the Agent News Protocol — real-time global intelligence for autonomous agents",
  "main": "agent-news-cli.js",
  "bin": {
    "agentnews": "./agent-news-cli.js"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/agentnewsapi/agentnewsapi.git",
    "directory": "openclaw-skill"
  },
  "keywords": [
    "openclaw",
    "skill",
    "news",
    "autonomous-agents",
    "ai",
    "solana",
    "web3",
    "zero-hitl"
  ],
  "author": "Agent News Protocol <[REDACTED_SECRET]>",
  "license": "ISC",
  "dependencies": {
    "@solana/web3.js": "^1.98.4",
    "axios": "^1.14.0",
    "bs58": "^6.0.0",
    "dotenv": "^17.3.1",
    "socket.io-client": "^4.8.3",
    "tweetnacl": "^1.0.3"
  }
}


Security scan verdicts — ClawScan: suspicious | static analysis: suspicious | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)