Skip to content

Instantly share code, notes, and snippets.

@gabrielfeo
Last active September 9, 2025 16:26
Show Gist options
  • Save gabrielfeo/d0e7e64e497d09d9965558bd02c57245 to your computer and use it in GitHub Desktop.
Save gabrielfeo/d0e7e64e497d09d9965558bd02c57245 to your computer and use it in GitHub Desktop.
tag-ai-agent-gradle-builds

The simplest way to distinguish AI agent builds is to simply ask. Observability and rich performance insights for both agent and human builds is possible with Develocity Build Scans®.

Why?

Tracking them is the first step to managing their impact on performance, cost, and quality. They still represent infrastructure usage and developer wait time. Read the whitepaper: GenAI Won't Replace Your Continuous Delivery Pipeline — It Will Stress It.

How?

Ask agents via an instructions file to export or prefix their commands with a variable, then tag build scans accordingly. This approach works universally, even if some tools may offer other options (e.g. VS Code's agent terminal profile settings).

Copilot

Not all Copilot IDE plugins support AGENTS.md. The VS Code extension does, but the IntelliJ plugin requires .github/copilot-instructions.md instead. See official docs for the latest support: Adding repository custom instructions for GitHub Copilot.

Important

  • Prefix any command you decide or are asked to run with AI_AGENT=<name>, where <name> is what best describes you as an AI agent: gh-copilot, cursor, jules. If none fit, decide on another name in kebab-case. If running multiple shell statements or pipelines, wrap all statements in a single one: AI_AGENT=<name> bash -c '...'.
plugins {
id("com.gradle.develocity") version("4.1.1")
}
develocity {
buildScan {
/*
* Use a background block to only read AI_AGENT after the configuration phase. This ensures it's
* not a configuration cache input.
* https://docs.gradle.org/current/userguide/configuration_cache.html#build_configuration_inputs
*/
background {
val aiAgent = System.getenv("AI_AGENT")
if (!aiAgent.isNullOrBlank()) {
tag("AI Agent")
value("AI Agent", aiAgent)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment