Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add rudderlabs/rudder-agent-skills --skill rudder-ai-events-instrumentgit clone --depth 1 https://github.com/rudderlabs/rudder-agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/rudderlabs/rudder-agent-skills/rudder-ai-events-instrument)<a href="https://agentmods.dev/skills/rudderlabs/rudder-agent-skills/rudder-ai-events-instrument"><img src="https://agentmods.dev/badge/skills/rudderlabs/rudder-agent-skills/rudder-ai-events-instrument/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/rudderlabs/rudder-agent-skills/rudder-ai-events-instrument"><img src="https://agentmods.dev/badge/skills/rudderlabs/rudder-agent-skills/rudder-ai-events-instrument.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00068 | $0.02484 |
| Opus 5.5 | $0.00027 | $0.00994 |
| Sonnet 5.5 | $0.00014 | $0.00497 |
| Haiku 4.5 | $0.00007 | $0.00248 |
Grade A, and why
rudder-ai-events-instrument scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.
RudderStack AI Events Instrumentation
Turns the approved plan into the smallest reviewable diff, for AI events spec v0.3. Recipes with exact code: references/node.md, references/python.md, references/go.md, references/client-events.md. Each recipe names the SDK examples that show the same change end to end.
Preconditions
ai-events.yamlexists at the repo root withmetadata.status: approved. Missing ordraft: stop and runrudder-ai-events-setup; never instrument from an unapproved plan.- Every surface you are about to change has
status: instrument. Skip the rest (skipped,blocked,unsupported). - Apart from
ai-events.yaml, the working tree is clean, or the user agreed to mix changes. Work on a branch if the user uses them. - The SDK release that ships spec v0.3 exists for each language in the plan (
<VERSION>in the recipe files). If it does not, stop: never install 0.4.0 (spec v0.2) for a v0.3 plan, or a branch or pseudo-version.
Order of changes
Do one surface at a time; after each, run the app's type check or tests if it has them.
-
Install the SDK in each
sdks[].pathwith an exact pin, using the repo's package manager:npm install --save-exact @rudderstack/ai@<VERSION> uv add "rudderstack-ai[<extras from the plan>]==<VERSION>" # e.g. rudderstack-ai[anthropic]==<VERSION> go get github.com/rudderlabs/ai-sdk-go@<VERSION> # plus one module per provider: .../rudderopenai@<VERSION>, ...<VERSION>is the plan'ssdks[].version, the release that ships spec v0.3 for that language. Other managers: section 1 of the recipe files. Never add a version range, and never bump the app's own LLM libraries. Add@rudderstack/[email protected]/rudder-sdk-python==2.1.9only when the plan saysclient: new. -
Configure once in a module that runs before the first request or job: next to the RudderStack client, at module level, works when the app imports it at startup.
configure({ analytics })with the existing client (Go:rudderstackai.Configure(rudderstackai.WithAnalytics(client), ...)), plus thespec.configkeys that areconfigure()options (Node.js camelCase, GoWith*options).intents/outcomesgo only into the classifier.captureContentstaysfalseunless the plan says otherwise. -
Wrap the model client or add the framework integration at its construction site, per the surface's
integration. Call sites keep working unchanged. -
Chat surfaces: identity middleware (
aiContextMiddleware,withAiContext,AIContextMiddleware, Django/Flask middleware; Go:rudderstackai.WithValues(ctx, ContextValues{Request: r, ...})) orrequest/cookieson the interaction; then oneaiInteraction/ai_interaction/RunInteractionper user turn at the entry point. Wrap only the model-call part of the handler when the rest (history, legacy event, response) needs its result. PassuserId,conversationId,feature,surface, andinteractionIdwhen the plan'sinteraction_id_sourceisclient(validated UUID) orapp. Streams: return them from the callback orbind()them (Go: read them inside theRunInteractionfunction). Always return the ID the interaction used to the client. -
Feedback endpoints (the plan's
surfaces[].feedback):trackAction/track_actionwithinteractionId,conversationId,surfaceand the action type; the browser sends its own copy too (step 8);opt_out: [server_feedback]meansserverFeedback: false/server_feedback=Falseinconfigure(), not deleting the call; when the plan listsrequest_changes, extend the client request and the endpoint to carry those IDs. Keep the endpoint's existing behaviour; do not copy placeholder user IDs ('anonymous') from legacy code. -
Background surfaces: one
aiTask/ai_task/RunTaskper run at the job's entry point withtask_name,trigger_source(plustrigger_event_idformcp_event), a stable scopedconversationId,accountId/onBehalfOffrom the plan, and no user ID; one child task per plannedchild_tasksentry. Python thread pools:propagate(fn). -
MCP servers (
type: mcp): onewrapMcpServer/wrap_mcp_server/rudderstackai.WrapMCPServer(go-sdk) /ruddermcpgo.WrapServer(mcp-go) call where the server is built, before it connects (for a server factory, inside the factory), with the plan'sidentifymapping,request_contextintents, declared tool events and capability requests. Tools stay untouched. Distinct servers need distinct names: state is per server name, per process. -
Flush: add the SDK's
flush()to the existing shutdown hook for servers (keep the existing client flush); before return/exit for scripts, cron jobs and serverless handlers (a top-level task flushes itself). Node.js and Pythonflush()is bounded (10 s per client) and returnsfalseon timeout, never throws. Go:rudderstackai.Flush(0), thenclient.Close()on analytics-go. -
Client surface: a
trackAihelper on the existingrudderanalyticsinstance, theinteraction_idsent with each chat request, then the events listed inclient_eventsin their UI handlers. By default that includes the client copies of the prompt and answer and of feedback (source: client), sent alongside the server's, never sampled, and carrying only what the browser saw; click-through isai_user_actionwithaction_type: clicked_through. -
Optional config from the plan only:
eventRules, classifier (the app's own client and model; intents withoutother), scores (trackScore/track_scoreor theevaluatorhook), prices (with tier, long-context and server-tool options when listed),toolBreakdown, andtrace_idper the plan'stracing: Node.js and Python fill it from the first OpenTelemetry span in the interaction when the SDK's span processor is registered (registerTracing/register_tracing); Go needsWithTraceIDFrom(rudderotel.TraceID); another tool passestraceId/trace_id/TraceID, which always wins. -
Legacy events: leave each old
track()call as it is, wrapped in the plan's flag, defaulting on. -
Refresh references: update
path/symbolentries inai-events.yamlthat moved; this keepsstatus: approved.
What ships with it
4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 80 lines · 68 tokens per session scan A 30f59a93330f
rudder-ai-events-instrument is a skill published in the GitHub repository rudderlabs/rudder-agent-skills (19 stars, last pushed today), licensed MIT. It adds 68 tokens to every session and 2,484 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-20.
Other skills, from other repositories
scientific-figure-prompt-compiler
Transform concise scientific or technical descriptions into structured visual specifications and high-quality image-generation prompts. Use for scientific figures, technical diagrams, system architectures, mechanisms, workflows, spatial models, timelines, layered systems, and information-dense visuals. Model-agnostic…
seo-optimizer
Search Engine Optimization specialist for content strategy, technical SEO, keyword research, and ranking improvements. Use when optimizing website content, improving search rankings, conducting keyword analysis, or implementing SEO best practices. Expert in on-page SEO, meta tags, schema markup, and Core Web Vitals.
ai-collab-evaluator
A review of Claude Code session logs against four hiring criteria for working with AI: how you handle, use, and question AI, and how you weigh trade-offs.
learning-companion
A guided learning tool that turns official documents or other sources into lasting study notes through five stages, including explanation, recall, reflection, and next steps.
oss-tour
A guided method for learning an unfamiliar open-source repository in layers, from the whole project to folders and core modules. An open-source repository is a publicly available code project whose source can be inspected.
image-optimizer
An image-processing tool that converts images to WebP, an image format that can reduce file size while preserving visual quality. It handles individual images, groups of images, and whole directories.