DRIVERS-3529 Add env.agent to handshake metadata for agentic client identification - #1967
Open
aclark4life wants to merge 1 commit into
Open
DRIVERS-3529 Add env.agent to handshake metadata for agentic client identification#1967aclark4life wants to merge 1 commit into
aclark4life wants to merge 1 commit into
Conversation
aclark4life
force-pushed
the
DRIVERS-3529
branch
from
July 22, 2026 18:58
f32a3df to
8c1e1f0
Compare
aclark4life
marked this pull request as ready for review
July 22, 2026 19:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
client.env.agentfield to the MongoDB Handshake metadata so that agent-mediated usage of MongoDB (AI coding assistants / agentic clients such as Claude Code, Cursor, Gemini CLI) can be distinguished from direct human usage. See DRIVERS-3529.Changes
Add
env.agentto theclientdocument structure.New Agent subsection defining detection via an ordered environment-variable table (first populated match wins):
client.env.agentvalueAI_AGENTAGENTCLAUDECODEclaude-codeCURSOR_AGENTcursorGEMINI_CLIgemini-cliCODEX_SANDBOXcodexAUGMENT_AGENTaugmentOPENCODE_CLIENTopencodeGeneric vars (
AI_AGENT/AGENT) report their raw value; the six known agents report a fixed label. Generic wins over known. "Populated" = present with a non-empty value. Omitted entirely when none are populated; determination MUST NOT raise a user-visible error.Preserve
env.agentalongsideenv.namein the size-limit truncation cascade.Add prose Test 2: Test that agent metadata is properly captured (renumbers the auth test to Test 3).
Open questions for reviewers
claude-code,gemini-cli) for a normalized, tool-agnostic taxonomy per the design memo. Product Analytics owns the taxonomy — happy to switch to the raw env-var forms if preferred.Notes
Per the aligned approach with @jkovacs, v1 targets the top-traffic drivers (Node, Python). The other language tickets are split from DRIVERS-3529 and blocked on this spec change. PyMongo implementation is tracked under PYTHON-5929.
Please complete the following before merging: