Skip to main content

Pi coding agent telemetry

Stream pi coding agent sessions into Latitude as traces with the first-party @latitude-data/pi-telemetry extension. No Latitude account yet? Your agent can create a temporary one and do this whole setup with the latitude-setup skill, no signup. After setup, pi prompts appear in your Latitude project’s Traces view with model calls, prompts, responses, token usage, tool calls, and tool results.
Using an agent? Install the Latitude skills and let it handle the setup below. latitude-setup instruments your app or agent harness, verifies traces arrive, creates a temporary account if you don’t have one yet (no signup), and ends by building your first Artifact.

Prerequisites

  • A Latitude account with a project, or none yet: your agent can create a temporary one with the latitude-setup skill, no signup, and fill in the values below
  • A Latitude API key from Settings → API Keys
  • Your Latitude project slug from the project sidebar
  • pi installed locally
  • Node.js available on your PATH

Install

Run the installer:
The installer prompts for your API key and project slug, adds the pi extension package to ~/.pi/agent/settings.json, and writes Latitude config to ~/.pi/agent/latitude-telemetry.json. You can also pass values directly:

Restart and verify

Restart pi so it can install and load the package. Send a prompt that uses the model or a tool, then open your Latitude project and go to Traces. The new trace should appear within a few seconds. A trace includes:
  • an interaction root span for the pi prompt
  • llm_request spans for model calls
  • tool_call:<name> spans for tool executions
  • gen_ai.input.messages and gen_ai.output.messages for prompt/response reconstruction
  • gen_ai.tool.call.arguments and gen_ai.tool.call.result for tool I/O

See what was captured

Once a real run has landed, your agent builds your first Artifact: a single HTML page, in the Latitude look, with everything the telemetry captured from that session: model calls, tool calls, tokens, cost, timing, and the conversation as the model saw it. It is the fastest way to check the integration end to end and to see what Latitude will have to work with. The latitude-setup skill does this as its last step from its bundled first-artifact.html template, filling the page with the values the latitude CLI returns for the trace, and adds a Claim your workspace button when the account is temporary. If you set things up by hand, the same template and instructions live in the skills repo. Prompt, if you need to ask for it:

Structural-only telemetry

By default, Latitude receives the content needed to reconstruct pi runs, including prompts, assistant responses, system instructions when available, tool arguments, and tool results. If you want trace structure without conversation or tool content, install with:
Structural-only traces still include timing, token usage, provider/model names, tool names, session metadata, user/host identity, and whether content capture was enabled.

Disable or uninstall

Disable the extension for one pi process:
Remove the extension and config:
Restart pi after uninstalling to unload the extension.

Advanced configuration

The installer stores config in ~/.pi/agent/latitude-telemetry.json. Environment variables override file values: Use --staging, --dev, or --base-url=<url> during install to target a non-production Latitude ingest endpoint.

Captured data and privacy

Full-content mode sends prompts, responses, system instructions when available, tool inputs, and tool outputs. Use --no-content for structural-only telemetry or configure custom redaction as described below. Disable telemetry before working with sensitive material you do not want sent to Latitude. Even --no-content mode still sends structural metadata such as cwd/session identifiers, model names, tool names, timing, token usage, and user/host identity.

Custom redaction

If you want to keep content capture enabled but mask specific span attributes before they leave your machine, use redact in ~/.pi/agent/latitude-telemetry.json or the LATITUDE_REDACT_ATTRIBUTES environment variable. Redaction happens locally, after the content gate and before the OTLP export. redact.attributes (or LATITUDE_REDACT_ATTRIBUTES) accepts an array of patterns. Each pattern can be:
  • An exact attribute name"gen_ai.tool.call.arguments"
  • A regex source string"^gen_ai\\.(input|output)\\.messages$" (anchored match)
  • A /pattern/flags string"/^gen_ai\\.tool\\.call\\.(arguments|result)$/i"
redact.mask (or LATITUDE_REDACT_MASK) sets the replacement value (default: ******). Set it to "[]" to replace message arrays with an empty array instead of a string.

Via config file

Add a redact block to ~/.pi/agent/latitude-telemetry.json:

Via environment variable

Troubleshooting

No traces appear. Restart pi or run /reload, then send a new prompt. Confirm the API key and project slug are correct. HTTP 401. The API key is missing or invalid. Re-run the installer with a valid key. HTTP 400 about X-Latitude-Project. The project slug is missing. Re-run the installer with --project=your-project-slug. Traces show timing but no prompt/response content. Structural-only mode is enabled. Reinstall without --no-content, or set LATITUDE_PI_NO_CONTENT=0 and reload pi. Need diagnostics. Run LATITUDE_DEBUG=1 pi and trigger another prompt.