agentdetection

package module
v0.0.0-...-d55902b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2026 License: MIT Imports: 2 Imported by: 0

README

agentdetection

Go Reference

agentdetection is a small Go package for detecting whether a process is running under an AI coding agent and, when possible, identifying which agent.

It is based on supporting the proposal in agents.md issue #136, "Proposal: Standard AGENT=$agent environment variable for agent runtime detection".

Goal

The goal is to let CLI tools default to non-interactive behavior while still providing the extra context and actionable output that agent-driven workflows benefit from when appropriate.

Usage

package main

import (
	"fmt"

	"github.com/jehiah/agentdetection"
)

func main() {
	if agentdetection.IsAgent() {
		// ... use defaults appropriate for Agentic tools
	}
}

Detection

Project Variable Value
Standard AGENT agent name, true, or 1
Standard AI_AGENT agent name, true, or 1
Claude Code CLAUDECODE true or 1
Cursor CURSOR_AGENT true or 1
Gemini CLI GEMINI_CLI true or 1
Codex CLI CODEX_SANDBOX any non-empty value
Augment AUGMENT_AGENT true or 1
Cline CLINE_ACTIVE true or 1
OpenCode OPENCODE_CLIENT true or 1
TRAE AI TRAE_AI_SHELL_ID any non-empty value
Devin /opt/.devin file exists

Agent() returns the detected agent name, or "" when no agent signal is present. IsAgent() returns whether any supported signal was detected.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Agent

func Agent() string

func IsAgent

func IsAgent() bool

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL