Skip to content

feat(detect-agent): check AGENT env var for generic agent detection#15350

Open
sleitor wants to merge 2 commits into
vercel:mainfrom
sleitor:feat/detect-agent-env-var
Open

feat(detect-agent): check AGENT env var for generic agent detection#15350
sleitor wants to merge 2 commits into
vercel:mainfrom
sleitor:feat/detect-agent-env-var

Conversation

@sleitor

@sleitor sleitor commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Add AGENT env var detection to @vercel/detect-agent, checked after AI_AGENT and before tool-specific vars.

An emerging convention uses AGENT=<agent-name> to signal agent presence:

Changes

  • src/index.ts: Add AGENT check (position 2, after AI_AGENT, before tool-specific vars)
  • test/unit/determine-agent.test.ts: Add detection, edge case, and priority tests

Closes #15336

Note

Low Risk Change

This PR adds a new environment variable check (AGENT) for agent detection, which is a straightforward feature addition with proper validation (trim and empty check) and comprehensive test coverage.

  • Adds AGENT env var detection after AI_AGENT, before tool-specific vars
  • Includes whitespace trimming and empty string validation
  • Comprehensive test coverage for detection, priority, and edge cases

Risk assessment for commit f017c0c.

Add support for the emerging AGENT=<name> convention alongside AI_AGENT.
This is used by Goose, Amp, Bun, and others.

Closes vercel#15336
@sleitor
sleitor requested review from a team as code owners March 2, 2026 22:07
@changeset-bot

changeset-bot Bot commented Mar 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f017c0c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Comment thread packages/detect-agent/test/unit/determine-agent.test.ts
@sleitor

sleitor commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

👋 Gentle ping — just checking if this is still on the radar for review. Happy to address any feedback or rebase if needed!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@vercel/detect-agent: consider also checking AGENT env var

1 participant