GR

groq-webhooks-events

Scaffolds event-driven architectures for Groq streaming and batch processing. Manages real-time data handling.

Install

mkdir -p .claude/skills/groq-webhooks-events && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/5467" && unzip -o skill.zip -d .claude/skills/groq-webhooks-events && rm skill.zip

Installs to .claude/skills/groq-webhooks-events

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Build event-driven architectures with Groq streaming, batch processing,
71 charsno explicit “when” trigger
Advanced

Key capabilities

  • Implement SSE streaming endpoints
  • Build batch processing pipelines with callbacks
  • Create asynchronous event processors
  • Monitor model latency and health

How it works

The skill use Groq's low-latency inference to build event-driven patterns like SSE streaming and queue-based batch processing.

Inputs & outputs

You give it
Inbound event or prompt
You get back
Streamed tokens or processed event classification

When to use groq-webhooks-events

  • Implement real-time SSE streaming
  • Build batch processing pipelines
  • Set up asynchronous LLM classification
  • Monitor Groq inference events

About this skill

Groq Events & Async Patterns

Overview

Build event-driven architectures around Groq's inference API. Groq does not provide native webhooks, but its sub-second latency enables unique patterns: real-time SSE streaming, batch processing with callbacks, queue-based pipelines, and event processors that use Groq as an LLM classification/extraction engine.

This skill uses Read, Write, and Edit to scaffold and update these handlers in your codebase, and curl to exercise the resulting endpoints. Step 1 (the SSE endpoint) is inline below; the batch, webhook-processor, health-monitor, and Python async patterns live in references/implementation.md.

Prerequisites

  • groq-sdk (Node) or groq (Python) installed, GROQ_API_KEY set
  • Queue system for batch patterns (BullMQ, Redis, SQS)
  • Understanding of Server-Sent Events (SSE) for streaming

Authentication

Groq authenticates with a single API key. Export GROQ_API_KEY in the environment and the SDK reads it automatically — never hard-code the key or embed it in a request body. The key is a bearer credential; treat it like any secret (env var or secrets manager, never committed). No per-request auth headers are needed when the SDK is constructed with new Groq() / AsyncGroq().

Instructions

Write each handler as a file in your project (Read/Write/Edit), then drive it with curl to confirm behavior.

Step 1: SSE Streaming Endpoint

Stream tokens to the browser as they are generated. Set the text/event-stream headers, disable proxy buffering with X-Accel-Buffering: no, and write one data: frame per token, ending with a done event.

import Groq from "groq-sdk";
import express from "express";

const groq = new Groq();
const app = express();
app.use(express.json());

app.post("/api/chat/stream", async (req, res) => {
  const { messages, model = "llama-3.3-70b-versatile" } = req.body;

  res.writeHead(200, {
    "Content-Type": "text/event-stream",
    "Cache-Control": "no-cache",
    Connection: "keep-alive",
    "X-Accel-Buffering": "no",  // Disable nginx buffering
  });

  try {
    const stream = await groq.chat.completions.create({
      model,
      messages,
      stream: true,
      max_tokens: 2048,
    });

    for await (const chunk of stream) {
      const content = chunk.choices[0]?.delta?.content;
      if (content) {
        res.write(`data: ${JSON.stringify({ content, type: "token" })}\n\n`);
      }
    }

    res.write(`data: ${JSON.stringify({ type: "done" })}\n\n`);
  } catch (err: any) {
    res.write(`data: ${JSON.stringify({ type: "error", message: err.message })}\n\n`);
  }

  res.end();
});

Steps 2–5: Batch, Webhook Processor, Health Monitor, Python Async

The remaining patterns follow the same shape — Groq as a fast inference engine behind a queue or an event loop. Each is documented in full, with runnable code, in references/implementation.md:

  • Step 2 — Batch processing with BullMQ: enqueue prompts, process with a rate-limited worker (concurrency: 5, limiter: 25 RPM), fire a callback per item.
  • Step 3 — Webhook event processor: ack the sender with 202 immediately, then classify/extract the event asynchronously with llama-3.1-8b-instant.
  • Step 4 — Scheduled health monitor: ping each model with a one-token request on an interval, tracking latency and tokens/sec.
  • Step 5 — Python async batch: asyncio.Semaphore + gather for concurrent processing without a queue.

Output

Each pattern produces a distinct, observable artifact you can assert against:

  • SSE endpoint — a text/event-stream response: one data: {"content":…,"type":"token"} frame per token, terminated by data: {"type":"done"} (or a type:"error" frame on failure).
  • Batch worker — a groq.batch.item_completed callback POST per prompt, carrying batchId, index, total, content, model, and token usage.
  • Webhook processor — an immediate 202 {"received": true} ack, followed by a background classification object {type, priority, summary, action}.
  • Health monitor — a per-model record {status, latencyMs, tokensPerSec} (or {status:"error", error}) logged each interval.

See references/examples.md for the concrete payloads.

Event Pattern Summary

PatternGroq ModelLatencyUse Case
SSE streamingllama-3.3-70b-versatile~200ms TTFTReal-time chat
Batch queuellama-3.1-8b-instant~80ms TTFTDocument processing
Webhook processorllama-3.1-8b-instant~80ms TTFTEvent classification
Health monitorllama-3.1-8b-instant~80ms TTFTUptime tracking

Error Handling

IssueCauseSolution
SSE disconnectClient timeout or networkImplement reconnection with last-event-id
Batch item failsRate limit or model errorQueue retry with exponential backoff
Webhook timeoutProcessing takes too longAcknowledge immediately (202), process async
Health check 429Monitoring consuming quotaReduce check frequency, use smallest model

Examples

Worked, runnable examples — consuming the SSE endpoint with curl, submitting a batch and receiving callbacks, and classifying an inbound webhook — are in references/examples.md. A minimal first call:

curl -N -X POST http://localhost:3000/api/chat/stream \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"Explain SSE in one sentence."}]}'

Resources

For performance optimization, see the groq-performance-tuning skill.

When not to use it

  • Expecting native webhook support from Groq

Prerequisites

groq-sdk or groq packageQueue system for batch processingGROQ_API_KEY environment variable

Limitations

  • Groq does not provide native webhooks
  • SSE connections require handling client timeouts
  • Batch processing requires external queue management

How it compares

This approach uses Groq as an inference engine within custom event loops rather than relying on native webhook triggers.

Compared to similar skills

groq-webhooks-events side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
groq-webhooks-events (this skill)127dReviewAdvanced
telegram-bot-builder1066moReviewIntermediate
reddit-api34moReviewIntermediate
juicebox-install-auth227dReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

You might also like

telegram-bot-builder

davila7

Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.

106130

reddit-api

alinaqi

Reddit API with PRAW (Python) and Snoowrap (Node.js)

334

juicebox-install-auth

jeremylongshore

Install and configure Juicebox SDK/CLI authentication. Use when setting up a new Juicebox integration, configuring API keys, or initializing Juicebox in your project. Trigger with phrases like "install juicebox", "setup juicebox", "juicebox auth", "configure juicebox API key".

28

lindy-sdk-patterns

jeremylongshore

Lindy AI SDK best practices and common patterns. Use when learning SDK patterns, optimizing API usage, or implementing advanced agent features. Trigger with phrases like "lindy SDK patterns", "lindy best practices", "lindy API patterns", "lindy code patterns".

14

windsurf-mcp-integration

jeremylongshore

Manage integrate MCP servers with Windsurf for extended capabilities. Activate when users mention "mcp integration", "model context protocol", "external tools", "mcp server", or "cascade tools". Handles MCP server configuration and integration. Use when working with windsurf mcp integration functionality. Trigger with phrases like "windsurf mcp integration", "windsurf integration", "windsurf".

14

emailable-automation

onfire7777

Automate Emailable tasks via Rube MCP (Composio). Always search tools first for current schemas.

00

Search skills

Search the agent skills registry