Skip to content

feat(cli): identify the coding agent driving the CLI - #367

Merged
gregberge merged 1 commit into
mainfrom
greg/arg-496-let-the-agent-identify-itself-in-mcp-cli
Aug 13, 2026
Merged

gregberge merged 1 commit into
mainfrom
greg/arg-496-let-the-agent-identify-itself-in-mcp-cli

Conversation

@gregberge

@gregberge gregberge commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Description

Part 1 of ARG-496 — the producer side. The backend half is argos-ci/argos#2471.

Argos cannot tell a command a person typed from one an agent ran on their behalf: the token signing the request is the same either way. This makes the CLI say so.

packages/cli — src/lib/user-agent.ts detects the agent with @vercel/detect-agent once at startup and sends it as a product token:

User-Agent: argos-cli/6.8.0 node/22.11.0 agent/claude-code_2-1-227_agent

The agent name is user input in the end — @vercel/detect-agent returns AI_AGENT verbatim — so it is reduced to an HTTP token (RFC 9110 §5.6.2) and truncated. A name that could inject a header cannot survive that.

packages/api-client — createClient({ userAgent }) takes a string or a resolver, possibly async. Detection resolves at startup while clients are built synchronously in ~30 CLI call sites; a resolver keeps all of them unchanged instead of turning createApiClient async.

Verified

build, check-types, lint, check-format and test pass for both packages. Beyond the unit tests, I ran the built CLI against a local server that echoes the header:

UA: argos-cli/6.8.0 node/26.4.0 agent/claude-code_2-1-227_agent   # under Claude Code
UA: argos-cli/6.8.0 node/26.4.0 agent/custom-agent-2.0            # AI_AGENT="Custom Agent/2.0"

That run is also what caught the version suffix Claude Code really appends — the backend PR strips it before matching the agent registry.

Type of changes

enhancement

Checklist

  • I have read the CONTRIBUTING doc
  • The commits message follows the Conventional Commits' policy
  • Lint and unit tests pass locally
  • I have added tests if needed

Optional checks:

  • My changes requires a change to the documentation

🤖 Generated with Claude Code

Argos cannot tell a command a person typed from one an agent ran on their
behalf — the token signing the request is the same either way. Detect the
agent with @vercel/detect-agent and send it as an `agent/<name>` token in
the User-Agent, so the API can attribute the action to it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Aug 13, 2026

Copy link
Copy Markdown

ARG-496

@vercel

vercel Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
argos-js-sdk-reference Ready Ready Preview Aug 13, 2026 8:03pm

Request Review

@gregberge
gregberge requested a review from jsfez August 13, 2026 20:07
@gregberge
gregberge merged commit 01d10cd into main Aug 13, 2026
70 checks passed
@gregberge
gregberge deleted the greg/arg-496-let-the-agent-identify-itself-in-mcp-cli branch August 13, 2026 20:55

This branch was successfully deployed

1 active deployment
Preview — 6b292ade Deployed Aug 13, 2026 by vercel[bot]
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.

1 participant