Agents

Each agent represents an AI coding agent environment, and is associated with:

  • a unique agent ID

  • a human-readable name

  • an icon (emoji / unicode character)

  • a detection function

  • various metadata in its info() method

Agent usage

Each agent is materialized by a Agent object, from which you can access various metadata:

>>> from extra_platforms import CLAUDE_CODE
>>> CLAUDE_CODE
Agent(id='claude_code', name='Claude Code')
>>> CLAUDE_CODE.id
'claude_code'
>>> CLAUDE_CODE.current
False
>>> CLAUDE_CODE.info()
{'id': 'claude_code', 'name': 'Claude Code', 'icon': '✴️', 'url': 'https://claude.ai/code', 'current': False}

To check if the current environment is running in a specific agent, use the corresponding detection function:

>>> from extra_platforms import is_claude_code
>>> is_claude_code()
False

The current agent can be obtained via the current_agent() function:

>>> from extra_platforms import current_agent
>>> current_agent()
Agent(id='unknown_agent', name='Unknown agent')

Absence is the normal case

Each AI coding agent advertises itself through a dedicated environment variable: CLAUDECODE for Claude Code, CLINE_ACTIVE for Cline, CURSOR_AGENT for Cursor. current_agent() expects a single agent to announce itself and raises RuntimeError if several match at once.

Outside an agent session, every detection function returns False and current_agent() returns UNKNOWN_AGENT. This makes is_unknown_agent() the idiomatic “not driven by an agent” check.

The LLM and AI_AGENT variables are used as expectation signals: when either is set but no agent is recognized, the miss is logged as a WARNING (a detection heuristic is probably missing and worth reporting); otherwise it is only logged as INFO. AI_AGENT carries the agent’s own name as its value, set by Crush and Pi among others, so an unrecognized value names the agent to add next.

Recognized agents

Icon

Symbol

Name

Detection function

✴️

CLAUDE_CODE

Claude Code

is_claude_code()

👾

CLINE

Cline

is_cline()

📕

CODEX

OpenAI Codex

is_codex()

✈️

COPILOT_CLI

GitHub Copilot CLI

is_copilot_cli()

💘

CRUSH

Crush

is_crush()

CURSOR

Cursor

is_cursor()

GEMINI_CLI

Gemini CLI

is_gemini_cli()

π

PI

Pi

is_pi()

Hint

The UNKNOWN_AGENT trait represents an unrecognized agent. It is not included in the ALL_AGENTS group, and will be returned by current_agent() if the current agent is not recognized.

Groups of agents

There is only one group defined for agents: ALL_AGENTS, which includes all recognized agents.

Icon

Symbol

Description

Detection

Canonical

🧠

ALL_AGENTS

All AI coding agents

is_any_agent()

        ---
config:
  sankey:
    height: 800
    showValues: false
    width: 800

---
sankey-beta

ALL_AGENTS,CLAUDE_CODE,1
ALL_AGENTS,CLINE,1
ALL_AGENTS,CODEX,1
ALL_AGENTS,COPILOT_CLI,1
ALL_AGENTS,CRUSH,1
ALL_AGENTS,CURSOR,1
ALL_AGENTS,GEMINI_CLI,1
ALL_AGENTS,PI,1
    
        ---
config:
  mindmap:
    padding: 5

---
mindmap
    ((🧠 ALL_AGENTS))
        (✴️ CLAUDE_CODE)
        (👾 CLINE)
        (📕 CODEX)
        (✈️ COPILOT_CLI)
        (💘 CRUSH)
        (➤ CURSOR)
        (♊ GEMINI_CLI)
        (π PI)
    

Predefined agents

Agent definitions and metadata.

extra_platforms.CLAUDE_CODE = Agent(id='claude_code', name='Claude Code')
extra_platforms.CLINE = Agent(id='cline', name='Cline')
extra_platforms.CODEX = Agent(id='codex', name='OpenAI Codex')
extra_platforms.COPILOT_CLI = Agent(id='copilot_cli', name='GitHub Copilot CLI')
extra_platforms.CRUSH = Agent(id='crush', name='Crush')
extra_platforms.CURSOR = Agent(id='cursor', name='Cursor')
extra_platforms.GEMINI_CLI = Agent(id='gemini_cli', name='Gemini CLI')
extra_platforms.PI = Agent(id='pi', name='Pi')
extra_platforms.UNKNOWN_AGENT = Agent(id='unknown_agent', name='Unknown agent')