From 9cb7f493e7b4a444ed66fbcb681d9e66c454eb3d Mon Sep 17 00:00:00 2001 From: Vegard Stikbakke Date: Tue, 11 Aug 2026 09:03:42 +0200 Subject: [PATCH] docs(coding-agent): document AI_AGENT process marker closes #7747 --- packages/coding-agent/CHANGELOG.md | 1 + packages/coding-agent/docs/environment-variables.md | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 12e4349d4..759c1c1a6 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -9,6 +9,7 @@ ### Changed - Replaced the inherited Mistral SDK transport with a native Chat Completions HTTP stream, eliminating its generated client and schema runtime overhead. +- Documented the generic `AI_AGENT=pi` process marker and how it differs from `PI_CODING_AGENT=true` ([#7747](https://github.com/earendil-works/pi/issues/7747)). ## [0.84.1] - 2026-08-07 diff --git a/packages/coding-agent/docs/environment-variables.md b/packages/coding-agent/docs/environment-variables.md index 072744ca8..413bd259b 100644 --- a/packages/coding-agent/docs/environment-variables.md +++ b/packages/coding-agent/docs/environment-variables.md @@ -3,14 +3,19 @@ Pi uses environment variables in three ways: - Variables such as `PI_OFFLINE` configure the Pi process. -- Pi sets `PI_CODING_AGENT` so child processes can detect that they run inside Pi. +- Pi sets process markers so child processes can identify Pi as the launching agent. - Commands run by the LLM-callable bash tool receive `PI_*` variables describing the current session. Provider API-key variables are documented separately in [Providers](providers.md#environment-variables-or-auth-file). ## Process Marker -The CLI and RPC entry points set `PI_CODING_AGENT=true`. Child processes inherit it and can use it to detect that they run inside Pi. It is not session-specific and is not set automatically when Pi is embedded through the SDK. +The CLI and RPC entry points set two process markers: + +- `AI_AGENT=pi` is a generic marker that lets tooling identify Pi as the agent that launched the process. +- `PI_CODING_AGENT=true` is Pi-specific and lets child processes detect that they run inside Pi. + +Child processes inherit both markers. They are not session-specific and are not set automatically when Pi is embedded through the SDK. ## Bash Tool Session Environment