# Sentry (/deployment/add-other-services/sentry)

Add Sentry monitoring to your agent services



## Overview

Learn how to add Sentry monitoring to your Inkeep Agent Framework services.

## Step 1: Install Sentry

```bash
pnpm install @sentry/node
```

## Step 2: Update your `.env` file

Add your Sentry DSN to the `.env` file in the root of your workspace.

```bash
SENTRY_DSN=https://<your-sentry-dsn>@sentry.io/<your-sentry-project>
```

## Step 3: Configure Sentry

In `apps/agents-api` create a new file called `sentry.ts` and add the following code:

```typescript
import * as Sentry from "@sentry/node";

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  sampleRate: 1.0,
  tracesSampleRate: 1.0,
});
```

In `apps/agents-api/src/index.ts` add the following code to the top of the file before all other imports:

```typescript
import "./sentry";
```

## Forward Error Logs to Sentry

You can use [pino-sentry-transport](https://github.com/tomer-yechiel/pino-sentry-transport) to forward error logs to Sentry.

### Step 1: Install pino-sentry-transport

```bash
pnpm install pino-sentry-transport
```

### Step 2: Configure pino-sentry-transport

Add the following code to the top of your `apps/agents-api/src/index.ts` file:

```typescript
logger = getLogger('agents-api');
logger.addTransport({
  target: 'pino-sentry-transport',
  options: {
    sentry: {
      dsn: process.env.SENTRY_DSN,
    },
  },
});
```

## Additional Resources

For more information on how to configure Sentry, you can consult the official Sentry Node.js [documentation](https://docs.sentry.io/platforms/node/).