Skip to content

Commit d709d85

Browse files
committed
Add Copilot CLI to agent detection
We have data from direct testing in Copilot CLI confirming it sets COPILOT_CLI=1 in its environment. Add it to the canonical agent list. Co-authored-by: Isaac
1 parent 6f6ebb8 commit d709d85

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Release v0.101.0
44

55
### New Features and Improvements
6-
* Added automatic detection of AI coding agents (Claude Code, Cursor, Cline, Codex, Gemini CLI, OpenCode, Antigravity) in the user-agent string. The SDK now appends `agent/<name>` to HTTP request headers when running inside a known AI agent environment.
6+
* Added automatic detection of AI coding agents (Antigravity, Claude Code, Cline, Codex, Copilot CLI, Cursor, Gemini CLI, OpenCode) in the user-agent string. The SDK now appends `agent/<name>` to HTTP request headers when running inside a known AI agent environment.
77

88
### Bug Fixes
99

databricks-sdk-java/src/main/java/com/databricks/sdk/core/UserAgent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ private static List<AgentDef> listKnownAgents() {
256256
new AgentDef("CLAUDECODE", "claude-code"), // https://github.com/anthropics/claude-code
257257
new AgentDef("CLINE_ACTIVE", "cline"), // https://github.com/cline/cline (v3.24.0+)
258258
new AgentDef("CODEX_CI", "codex"), // https://github.com/openai/codex
259+
new AgentDef("COPILOT_CLI", "copilot-cli"), // https://github.com/features/copilot
259260
new AgentDef("CURSOR_AGENT", "cursor"), // Closed source
260261
new AgentDef("GEMINI_CLI", "gemini-cli"), // https://google-gemini.github.io/gemini-cli
261262
new AgentDef("OPENCODE", "opencode")); // https://github.com/opencode-ai/opencode

databricks-sdk-java/src/test/java/com/databricks/sdk/core/UserAgentTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,17 @@ public void testAgentProviderCodex() {
163163
Assertions.assertTrue(UserAgent.asString().contains("agent/codex"));
164164
}
165165

166+
@Test
167+
public void testAgentProviderCopilotCli() {
168+
setupAgentEnv(
169+
new HashMap<String, String>() {
170+
{
171+
put("COPILOT_CLI", "1");
172+
}
173+
});
174+
Assertions.assertTrue(UserAgent.asString().contains("agent/copilot-cli"));
175+
}
176+
166177
@Test
167178
public void testAgentProviderCursor() {
168179
setupAgentEnv(

0 commit comments

Comments
 (0)