# Create Sentry Dashboards with Your AI Coding Agent

> Use the Sentry CLI and your AI coding agent's repo context to automatically create meaningful dashboards (errors, performance, product analytics) in minutes.

**URL:** https://sentry.io/cookbook/create-dashboards-with-ai-agent/

---

Point your AI coding agent at the Sentry CLI and it builds dashboards tailored to your codebase, with no manual widget configuration required.

**Time:** 10-15 minutes | **Difficulty:** Beginner

## What You'll Learn

- 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

**Topics:** Dashboards, CLI

## Before you start

**Accounts & access**

- [Sentry account](https://sentry.io/signup/) 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

## Steps

### 1. Install the Sentry CLI

Install the [Sentry CLI](https://cli.sentry.dev) using one of the methods below. It provides the `sentry dashboard` commands your agent will use to create and populate dashboards.

```bash
# Install script (all platforms)
curl https://cli.sentry.dev/install -fsS | bash

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

# npm
npm install -g sentry
```

[Sentry CLI getting started guide](https://cli.sentry.dev/getting-started/)

### 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.

```bash
sentry auth login

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

[Sentry CLI getting started guide](https://cli.sentry.dev/getting-started/)

### 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:

```bash
npx skills add https://cli.sentry.dev
```

[Sentry CLI agentic usage guide](https://cli.sentry.dev/agentic-usage/)

### 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.

```text
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](https://sentry.io/orgredirect/organizations/:orgslug/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](https://docs.sentry.io/product/dashboards/)

## Summary

**Your dashboards build themselves.**

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

## 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.

## FAQ

**Do I need a paid Sentry plan to use Dashboards?**

No. Dashboards are available on the free plan. You can create custom dashboards and widgets without upgrading.

**Which AI coding agents work with this recipe?**

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.

**Can the agent update or delete dashboards it already created?**

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.

**What if the agent creates widgets with the wrong queries?**

Ask the agent to fix specific widgets using `sentry dashboard widget edit '' --title '' --query `. Or use `sentry dashboard view ''` to list current widget definitions and iterate from there.

**Does the Sentry CLI work with self-hosted Sentry?**

Yes. Set the `SENTRY_URL` environment variable to your self-hosted instance URL before running any CLI commands.

## Next Steps

- [product/error-monitoring](https://sentry.io/product/error-monitoring/)

- [product/tracing](https://sentry.io/product/tracing/)

- [Sentry CLI dashboard reference](https://cli.sentry.dev/commands/dashboard/): Full reference for all `sentry dashboard` subcommands and widget options.

---

*Source: [sentry.io/cookbook/create-dashboards-with-ai-agent/](https://sentry.io/cookbook/create-dashboards-with-ai-agent/)*
