← Catalog

pi-sentry-monitor

Sentry AI Monitoring extension for pi coding agent sessions and tool calls

Extension

Install

Install with PiG

pig install npm:pi-sentry-monitor

Install with Pi

pi install npm:pi-sentry-monitor
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "skills": [
    "skills"
  ],
  "extensions": [
    "dist/index.js"
  ]
}

README

Written by the package's publisher, shown as published in version 0.1.12 (README.md). PiG does not review it.

pi-sentry-monitor

Sentry AI Monitoring extension for pi coding agent sessions and tool calls.

Mirrors what opencode-sentry-monitor does for OpenCode — tracks agent sessions, tool executions, token usage, and errors as Sentry traces.

Trace Hierarchy

gen_ai.invoke_agent (session span)
├── gen_ai.execute_tool (per tool call)
│   ├── gen_ai.tool.input  (if recordInputs enabled)
│   └── gen_ai.tool.output (if recordOutputs enabled)
└── gen_ai.request (per assistant message)
    └── token usage attributes (input, output, cached)

Installation

Global (applies to all projects):

pi install npm:pi-sentry-monitor

Project-local (checked into the repo, shared with teammates):

pi install npm:pi-sentry-monitor -l

Then run /reload in pi to activate without restarting.

A companion skill is included — once installed, ask pi to "set up Sentry monitoring" and it will walk through creating a Sentry project, configuring the DSN, and verifying traces are flowing.

Configuration

Create .pi/sentry-monitor.json (or .jsonc) in your project:

{
  "dsn": "https://your-key@o123.ingest.sentry.io/456"
}

Config File Locations (searched in order)

  1. Path in PI_SENTRY_CONFIG env var
  2. <cwd>/.pi/sentry-monitor.json[c]
  3. ~/.pi/agent/sentry-monitor.json[c]

Environment Variable Overrides

VariableDescription
PI_SENTRY_DSN / SENTRY_DSNSentry DSN
PI_SENTRY_TRACES_SAMPLE_RATESample rate (0-1)
PI_SENTRY_RECORD_INPUTSRecord tool inputs (true/false)
PI_SENTRY_RECORD_OUTPUTSRecord tool outputs (true/false)
PI_SENTRY_ENABLE_METRICSEnable metrics (true/false)
PI_SENTRY_TAGSCustom tags (format: key:value,key:value)
SENTRY_ENVIRONMENTEnvironment name
SENTRY_RELEASERelease version

Full Config Schema

{
  "dsn": "https://...",
  "tracesSampleRate": 1,
  "environment": "production",
  "release": "1.0.0",
  "debug": false,
  "agentName": "my-agent",
  "projectName": "my-project",
  "recordInputs": true,
  "recordOutputs": true,
  "maxAttributeLength": 12000,
  "includeMessageUsageSpans": true,
  "includeSessionEvents": true,
  "enableMetrics": false,
  "tags": {
    "team": "platform"
  }
}

Event Mapping

pi eventSentry span/action
session_startCreate root gen_ai.invoke_agent span
session_shutdownEnd session span, flush Sentry
model_selectTrack model/provider changes
tool_execution_startStart gen_ai.execute_tool child span
tool_execution_endEnd tool span, capture errors
message_start (assistant)Open gen_ai.request span (captures real LLM latency)
message_end (assistant)Close gen_ai.request span, attach token usage + content
agent_endFlush pending data to Sentry

Development

git clone https://github.com/sergical/pi-sentry-monitor && cd pi-sentry-monitor
npm install
npm run build

# Install local copy for testing
pi install ./path/to/pi-sentry-monitor
# or test without installing (ephemeral)
pi -e ./dist/index.js

License

MIT