From 4f4762f06de104d7f108bb6cfa387259dc825c84 Mon Sep 17 00:00:00 2001 From: Renaud Hartert Date: Mon, 3 Aug 2026 13:45:32 +0200 Subject: [PATCH] feat(coding-agent): set AI_AGENT environment variable (#7493) --- packages/coding-agent/README.md | 1 + packages/coding-agent/src/cli.ts | 1 + packages/coding-agent/src/rpc-entry.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/packages/coding-agent/README.md b/packages/coding-agent/README.md index b1d02ae1b..6b56a6aab 100644 --- a/packages/coding-agent/README.md +++ b/packages/coding-agent/README.md @@ -663,6 +663,7 @@ pi --thinking high "Solve this complex problem" | Variable | Description | |----------|-------------| +| `AI_AGENT` | Set to `pi` by the CLI and RPC entry points so generic tooling can attribute child processes to Pi | | `PI_CODING_AGENT` | Set to `true` by the CLI and RPC entry points so child processes can detect that they run inside Pi | | `PI_CODING_AGENT_DIR` | Override config directory (default: `~/.pi/agent`) | | `PI_CODING_AGENT_SESSION_DIR` | Override session storage directory (overridden by `--session-dir`) | diff --git a/packages/coding-agent/src/cli.ts b/packages/coding-agent/src/cli.ts index b0b11ca5c..caa447229 100644 --- a/packages/coding-agent/src/cli.ts +++ b/packages/coding-agent/src/cli.ts @@ -11,6 +11,7 @@ import { main } from "./main.ts"; process.title = APP_NAME; process.env.PI_CODING_AGENT = "true"; +process.env.AI_AGENT = "pi"; process.emitWarning = (() => {}) as typeof process.emitWarning; // Configure undici's global dispatcher before provider SDKs issue requests. diff --git a/packages/coding-agent/src/rpc-entry.ts b/packages/coding-agent/src/rpc-entry.ts index a07f9b337..11059a8d4 100644 --- a/packages/coding-agent/src/rpc-entry.ts +++ b/packages/coding-agent/src/rpc-entry.ts @@ -5,6 +5,7 @@ import { main } from "./main.ts"; process.title = `${APP_NAME}-rpc`; process.env.PI_CODING_AGENT = "true"; +process.env.AI_AGENT = "pi"; process.emitWarning = (() => {}) as typeof process.emitWarning; configureHttpDispatcher();