Technology
Pi
Track what Pi costs, who uses it, and which pull requests it helps ship, across your engineering teams.
Overview
Pi
Pi is a terminal-based coding agent that can use models from several providers in one session. The Dash0 agent plugin adds a Pi extension that sends an OpenTelemetry trace for each completed Pi turn, with one span per model call, its own provider and token usage, and paired tool calls. Dash0 links those sessions to the pull requests they help ship. Engineering leaders and platform teams see in one place how widely Pi is used, what it costs, and what it delivers.
Use Cases
- Cost visibility: Track spend by user, team, model, and provider so you can understand and control what Pi costs.
- Adoption tracking: Follow active users, new adopters, and usage distribution to see how Pi rolls out across your engineering teams.
- Productivity signals: Correlate sessions, tool calls, and assisted pull requests to understand the impact Pi has on your team's output.
Setup
Overview
The Dash0 agent plugin includes a native Pi extension, published on
npm as @dash0/agent-plugin-pi. It runs inside Pi, collects
each completed user turn, and hands it to a small helper that sends it to Dash0 as OpenTelemetry traces.
A turn never waits for the export. Dash0 prices reported tokens to show cost. Prompt, response, and tool content stays
redacted by default. See Data collected and privacy.
Prerequisites
- Pi installed on macOS, Linux, or Windows, on
amd64orarm64. - HTTPS access to GitHub on the first session, when the extension downloads its helper.
- A Dash0 auth token with ingest permissions.
- Your name and email in your git configuration. The plugin uses them to attribute activity to users:
git config --global user.name "{{user_full_name}}"
git config --global user.email "{{user_email}}"Install the extension
Install the package from npm:
pi install npm:@dash0/agent-plugin-piPi adds it to packages in ~/.pi/agent/settings.json. Add -l to install it for the current project only, in
.pi/settings.json. To try it for one run without installing, use pi -e npm:@dash0/agent-plugin-pi.
The package contains no binary. When the first session starts, the extension downloads the pi-on-event helper for its
version from the plugin's GitHub release, verifies it against the release checksums, and caches it under
~/.local/state/dash0-agent-plugin/pi/bin. pi update --extensions moves an unpinned install to the newest version,
which downloads its own helper in its first session.
Configure
In a Pi session, run the configuration skill that ships with the package:
/skill:dash0-configureEnter these values when it asks:
- OTLP URL:
{{endpoint_otlp_http}} - Auth token:
{{token_ingestion}} - Dataset, optional:
{{dataset}}
The skill writes ~/.pi/dash0-agent-plugin.local.md. No reload is needed: the helper reads the file on every turn. To
write the file yourself, use:
---
otlp_url: "{{endpoint_otlp_http}}"
auth_token: "{{token_ingestion}}"
dataset: "{{dataset}}"
---Keep the file out of Git and restrict its permissions to mode 600 on Unix. For one project, use
.pi/dash0-agent-plugin.local.md in the project directory instead. The first file that exists wins as a whole; values
are not merged.
The file is not in Pi's agent directory (~/.pi/agent), and PI_CODING_AGENT_DIR does not move it, so every Pi
profile on a machine reads the same file. For a value per profile, set environment variables in that profile's
launcher:
PI_PLUGIN_OPTION_OTLP_URL={{endpoint_otlp_http}}
PI_PLUGIN_OPTION_AUTH_TOKEN={{token_ingestion}}
PI_PLUGIN_OPTION_DATASET={{dataset}}PI_PLUGIN_OPTION_* values override the file. Other settings also fall back to DASH0_OTLP_URL, DASH0_DATASET, and
DASH0_TEAM_NAME, but the token never falls back to DASH0_AUTH_TOKEN: DASH0_* variables are inherited by tool
subprocesses and would leak it.
Attribute Usage by Team (Optional)
Dash0 breaks Pi activity down by user, model, and provider without extra setup. To break it down by team as well, enter
a team name when you run the dash0-configure skill, or set team_name in the configuration file or
PI_PLUGIN_OPTION_TEAM_NAME=<your team> in the environment. The plugin sends
it as dash0.team.name on every span.
Verify
- Start Pi, send a prompt that uses a tool, and let the turn finish.
- Open Dash0's AI Coding section. The turn appears as a
chat <model>root span, with achat <model>child for each earlier model call andexecute_tool <tool>children for tool calls. Sessions showpias the harness.
The first turn waits until the helper has downloaded. If the download or an export fails, Pi shows
dash0: telemetry unavailable once per session, and the next turn tries again. Check GitHub access, the endpoint,
token, and dataset permissions. See the plugin reference for details.
One Pi session can use several providers, so each span carries the provider of its own model call. Input token counts include cache reads and writes. A turn that you stop, for example with Esc, is recorded as aborted, not as an error.
Sub-agents
Pi has no built-in sub-agents. With the pi-subagents extension:
- Foreground children appear under the parent's
execute_tool subagentspan as oneinvoke_agent <agent>span per child, with achatspan carrying the child's total tokens. - Background children (
async: true) report as separate sessions.dash0.pi.session.parent.idnames the parent session.
For per-call detail of foreground children, load the extension into children too, as described in the plugin reference.
Uninstall
Remove the package from Pi:
pi remove npm:@dash0/agent-plugin-piAdd -l for a project install. Then delete ~/.pi/dash0-agent-plugin.local.md and the helper cache in
~/.local/state/dash0-agent-plugin/pi/bin if you no longer need them.
Data collected and privacy
The plugin sends spans over OTLP/HTTP to your configured endpoint with your auth token and, when set, the
Dash0-Dataset header. Spans include git identity, repository, branch, commit, working directory, team, tool names,
models, providers, and token usage.
With the default omit_io: true, prompt, response, and tool input/output content is replaced with <REDACTED>. Pi tool
arguments and results can contain whole files, so keep it on unless you need the content. Content is truncated, not
scrubbed for secrets. Thinking blocks and image data are never sent.
With omit_user_info: true, the exporter hashes user.name, drops user.email, and replaces your home directory in
the working directory with ~. The plugin writes no transcript or event log.