[sdk] tag API requests with the detected AI agent - #320
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
alexfarnhambrown
left a comment
There was a problem hiding this comment.
Checked where this header could land: no sandbox table in PRODUCT has a user_agent column — not the usage facts, not any sandbox event-streaming topic. So both this and #319 depend on an ingestion change that doesn't have a ticket or owner yet. If the landing place is the sandbox usage-fact pipeline, that's the same pipeline we need a failure status from, so it's probably one ask rather than two.
The upside is real though: the composed header separates CLI-driven from programmatic from agent-driven with no join required, which is a split we can't currently make.
|
You must have Developer access to commit code to Vercel Labs on Vercel. If you contact an administrator and receive Developer access, commit again to see your changes. Learn more: https://vercel.com/docs/accounts/team-members-and-roles/access-roles#team-level-roles |
marc-vercel
left a comment
There was a problem hiding this comment.
LGTM. Left a comment.
|
Your Vercel team Curated Tests - Permanent E2E is not permitted to deploy from this git repository. Contact an administrator to add github organization vercel as a Protected Git Scope in Curated Tests - Permanent E2E on Vercel. Once added, commit again to see your changes. Learn more: https://vercel.com/docs/security/protected-git-scopes |
Stacked on #319, which added the
agent/<name>user-agent phrase to the CLI. This extends the same stamp to the SDK, so programmatic callers get attributed too once the server side records the header (same ingestion ask, no new dependency on it).This:
agent/<name>to the SDK's existing user-agent whendetect-agentidentifies an AI agent driving the process; no agent means the header is byte-identical to todaydetect-agent@1.2.0as an SDK runtime dependency (zero transitive dependencies, node >=20 which the SDK already requires)Deliberately not added: telemetry events. The SDK ships in customer production code; this is request metadata only, nothing is collected or sent anywhere new.
Verified:
env -u CLAUDECODE -u CLAUDE_CODE -u AI_AGENT(a deployed server's environment):vercel/sandbox/3.2.0 (Node.js/v26.7.0; darwin/arm64), unchangedagent/occurrence in the final headerpnpm turbo typecheck --filter=@vercel/sandbox --filter=sandbox --force: 4/4; CLI suite 101 passed; SDK suite 291 passed, 80 skipped (pre-existing live-credential skips)Detection only labels the process driving the SDK, so servers creating sandboxes to run agents inside them correctly carry no label; that population is the planned self-declared tag, not this PR.