Skip to content

[wrangler] v3 backport: Add AI agent detection to analytics events - #11821

Closed
MattieTK wants to merge 3 commits into
v3-maintenancefrom
v3-backport-11820
Closed

[wrangler] v3 backport: Add AI agent detection to analytics events#11821
MattieTK wants to merge 3 commits into
v3-maintenancefrom
v3-backport-11820

Conversation

@MattieTK

@MattieTK MattieTK commented Jan 7, 2026

Copy link
Copy Markdown
Member

Note: This PR was written by OpenCode Opus 4.5 and reviewed by @MattieTK.

Summary

Backport of #11820 to v3-maintenance branch.

This PR adds AI agent detection to Wrangler v3 analytics events using the am-i-vibing library. When Wrangler commands are executed by AI coding agents (such as Claude Code, Cursor, GitHub Copilot, etc.), the agent ID is now included as an agent property in all analytics events.

Why backport to v3?

Understanding how much AI agent usage is happening on Wrangler v3 (which will become increasingly outdated) is valuable data. This helps Cloudflare understand the scope of potential issues arising from agents installing/using older Wrangler versions.

Changes

  • Detects AI coding environments at dispatcher initialization
  • Adds agent property to CommonEventProperties type
  • Includes agent ID in both command events and adhoc events
  • Agent is null when not running in an agentic environment
  • Silent failure (agent = null) if detection throws an error

Supported Agents

The library detects agents including: Claude Code, Cursor, GitHub Copilot, Windsurf, Zed, Aider, Codex CLI, Jules, Replit, Warp, and others.


  • Tests
    • Tests included/updated
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: Telemetry documentation updated in telemetry.md

A picture of a cute animal (not mandatory, but encouraged)

cute robot cat

@MattieTK
MattieTK requested a review from a team as a code owner January 7, 2026 14:29
@changeset-bot

changeset-bot Bot commented Jan 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 113be65

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@MattieTK
MattieTK marked this pull request as draft January 7, 2026 17:08
@petebacondarwin

Copy link
Copy Markdown
Contributor

Hi @MattieTK — thanks for the backport!

We're no longer accepting backports to the v3-maintenance branch, so closing this PR. The change in the corresponding main PR (#11820) covers the use case going forward, and v3 users on supported releases can upgrade to v4.

Thanks for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants