← Back to Cookbook

Create Sentry dashboards with your AI coding agent

Let your AI coding agent use the Sentry CLI to build dashboards tailored to your codebase, with no manual widget configuration required.

Features
Category Workflow
Time
10-15 minutes
Difficulty
Beginner
Steps
5 steps

Before you start

Accounts & access
  • Sentry account with at least one project sending data
  • An AI coding agent that supports the skills system (e.g., Claude Code)
Knowledge
  • Basic familiarity with running CLI commands in a terminal

1
Install the Sentry CLI

Install the Sentry CLI using one of the methods below. It provides the sentry dashboard commands your agent will use to create and populate dashboards.

Sentry CLI getting started guide
# Install script (all platforms)
curl https://cli.sentry.dev/install -fsS | bash

# macOS (Homebrew)
brew install getsentry/tools/sentry

# npm
npm install -g sentry

2
Authenticate the CLI

Log in to Sentry from the CLI so it can create and modify dashboards on your behalf. Running sentry auth login opens a browser window to complete OAuth authentication. Alternatively, pass your token directly using sentry auth login --token YOUR_TOKEN. This is useful if you want your agent to run CLI commands non-interactively.

Sentry CLI getting started guide
sentry auth login

# Or use a token directly (non-interactive)
sentry auth login --token YOUR_SENTRY_API_TOKEN

3
Register the CLI skill with your agent

Give your AI agent structured access to the Sentry CLI by registering it as a skill. This lets the agent discover and use all available sentry commands directly, rather than relying on it to infer the syntax. Run this in your terminal, then open or restart your agent session:

Sentry CLI agentic usage guide
npx skills add https://cli.sentry.dev

4
Ask your agent to create dashboards

Open your AI coding agent inside your project directory and give it a prompt like the one below. Because the agent has full repo context (your routes, models, key functions, and common flows), it can decide which metrics actually matter for your app. Feel free to be specific or leave it open-ended and let the agent decide based on the codebase.

Use the Sentry CLI to create dashboards for this project.

Answer these questions with dashboards:

- What errors are affecting the most users right now?
- Where are the slowest parts of the app?
- Which user flows are most commonly used?
- Did the latest release introduce any new errors?
- Which pages or endpoints have the highest error rates?
- Which users or accounts are most affected by errors?
- How has error rate changed over the past week?

Make the widgets specific to what this codebase actually does.

5
View and refine your dashboards

Once the agent finishes running the CLI commands, your dashboards are live. Open Dashboards in Sentry to see them. From here you can pin dashboards to your home screen and share them with your team. If a widget isn't quite right, ask the agent to iterate using sentry dashboard widget edit or sentry dashboard widget delete, or tell it to add new ones with more specific queries.

Customizing Sentry Dashboards
Sentry dashboard titled 'CLI Performance Monitor' showing KPI widgets for P95 response time, total spans, and throughput, alongside line charts for duration over time and command volume, and tables for slowest and highest-volume commands

That's it.

Your dashboards build themselves.

Because your AI agent already knows your codebase, it knows exactly which metrics, flows, and queries belong in your dashboards.

  • Installed and authenticated the Sentry CLI
  • Registered the CLI as a skill so your AI agent can use it directly
  • Prompted your agent to build dashboards tailored to your codebase

Pro tips

  • 💡 Tell your agent what kind of app it is (CLI tool, web app, mobile app) and which user actions matter most. This gives it better context for widget queries.
  • 💡 Use sentry dashboard list to see all dashboards your agent created, and sentry dashboard view 'DASHBOARD_NAME' to inspect their widget definitions before opening the browser.
  • 💡 If a widget looks off, ask the agent to adjust it with sentry dashboard widget edit 'DASHBOARD_NAME' 'WIDGET_NAME'. You can change the display type, query, or layout position without recreating the whole dashboard.
  • 💡 Set SENTRY_AUTH_TOKEN in your project's .env file so the agent can run CLI commands without prompting for credentials during a session.

Common pitfalls

  • ⚠️ Don't skip step 3. If the CLI skill isn't registered, your agent will try to guess command syntax and will likely get it wrong.
  • ⚠️ Widget queries use aggregate functions (count, p95:span.duration, count_unique:user), not raw field names. Passing a plain field name will return an error.
  • ⚠️ Stick to supported --display types: big_number, line, area, bar, table, stacked_area, top_n, categorical_bar, text. Anything else will fail.
  • ⚠️ Dashboards created via the CLI are owned by your user account by default. Share them from the Sentry UI if your team needs access.

Frequently asked questions

No. Dashboards are available on the free plan. You can create custom dashboards and widgets without upgrading.
Any agent that supports the skills system works, such as Claude Code. The agent needs to support npx skills add to register the Sentry CLI skill and be able to execute sentry CLI commands in your project directory.
Yes. Use sentry dashboard widget edit to update existing widgets and sentry dashboard widget delete to remove them. You can also delete an entire dashboard from the Sentry UI.
Ask the agent to fix specific widgets using sentry dashboard widget edit '' --title '' --query . Or use sentry dashboard view ''</code> to list current widget definitions and iterate from there.
Yes. Set the SENTRY_URL environment variable to your self-hosted instance URL before running any CLI commands.

Fix it, don't observe it.

Get started with the only application monitoring platform that empowers developers to fix application problems without compromising on velocity.