Documentation
¶
Overview ¶
Package agentdetect identifies known AI coding agents in the process environment. Callers decide whether inherited agent context should affect behavior.
Index ¶
Constants ¶
const DisableAgentDetectEnvVar = "AZD_DISABLE_AGENT_DETECT"
DisableAgentDetectEnvVar is the environment variable that, when set to any non-empty value, disables all agent detection. This is used by functional tests that spawn azd as a child process and need to test interactive prompt behavior without the parent process tree (which may include an AI agent like Copilot CLI) triggering no-prompt mode.
Variables ¶
This section is empty.
Functions ¶
func IsRunningInAgent ¶
func IsRunningInAgent() bool
IsRunningInAgent returns true if a known AI coding agent was detected in the process environment.
func ResetDetection ¶
func ResetDetection()
ResetDetection clears the cached detection result. This is primarily useful for testing.
Types ¶
type AgentInfo ¶
type AgentInfo struct {
// Type is the identified agent type.
Type AgentType
// Name is a human-readable name for the agent.
Name string
// Source indicates how the agent was detected.
Source DetectionSource
// Detected is true if an agent was detected.
Detected bool
// Details contains additional detection information (e.g., matched env var or process name).
Details string
}
AgentInfo contains information about a detected AI coding agent.
func GetCallingAgent ¶
func GetCallingAgent() AgentInfo
GetCallingAgent detects a known AI coding agent in the process environment. The result is cached after the first call.
type AgentType ¶
type AgentType string
AgentType represents a known AI coding agent.
const ( // AgentTypeUnknown indicates no agent was detected. AgentTypeUnknown AgentType = "" // AgentTypeAntigravity is Google's Antigravity CLI. AgentTypeAntigravity AgentType = "antigravity" // AgentTypeClaudeCode is Anthropic's Claude Code agent. AgentTypeClaudeCode AgentType = "claude-code" // AgentTypeClaudeCodeDesktop is Claude Code launched from Claude Desktop. AgentTypeClaudeCodeDesktop AgentType = "claude-code-desktop" // AgentTypeClaudeCodeVSCode is the Claude Code VS Code integration. AgentTypeClaudeCodeVSCode AgentType = "claude-code-vscode" // AgentTypeCodex is OpenAI's Codex agent. AgentTypeCodex AgentType = "codex" // AgentTypeCodexDesktop is the Codex Desktop app. AgentTypeCodexDesktop AgentType = "codex-desktop" // AgentTypeCursor is Cursor's coding agent. AgentTypeCursor AgentType = "cursor" // AgentTypeGitHubCopilotCLI is GitHub's Copilot CLI agent. AgentTypeGitHubCopilotCLI AgentType = "github-copilot-cli" // AgentTypeGitHubCopilotApp is GitHub's Copilot App agent. AgentTypeGitHubCopilotApp AgentType = "github-copilot-app" // AgentTypeGitHubCopilotVSCode is GitHub Copilot agent mode in VS Code. AgentTypeGitHubCopilotVSCode AgentType = "github-copilot-vscode" // AgentTypeGitHubCopilotCloudAgent is GitHub Copilot cloud agent. AgentTypeGitHubCopilotCloudAgent AgentType = "github-copilot-cloud-agent" // AgentTypeVSCodeCopilot is the GitHub Copilot for Azure extension in VS Code. AgentTypeVSCodeCopilot AgentType = "vscode-copilot" // AgentTypeGemini is Google's Gemini CLI. AgentTypeGemini AgentType = "gemini" // AgentTypeOpenCode is the OpenCode AI coding CLI. AgentTypeOpenCode AgentType = "opencode" // AgentTypePi is the Pi coding agent. AgentTypePi AgentType = "pi" )
func (AgentType) DisplayName ¶
DisplayName returns a human-readable name for the agent type.
type DetectionSource ¶
type DetectionSource string
DetectionSource indicates how an agent was detected.
const ( // DetectionSourceNone indicates no detection occurred. DetectionSourceNone DetectionSource = "" // DetectionSourceEnvVar indicates detection via environment variable. DetectionSourceEnvVar DetectionSource = "env-var" // DetectionSourceParentProcess indicates detection via parent process inspection. DetectionSourceParentProcess DetectionSource = "parent-process" // DetectionSourceUserAgent indicates detection via AZURE_DEV_USER_AGENT. DetectionSourceUserAgent DetectionSource = "user-agent" )