This demonstrates how you can use the Warp Agent TypeScript SDK to trigger an ambient agent from a Node.js server. This example listens for Sentry alerts and triggers a coding agent to fix the bug.
You'll need to install the following tools to run both the monitor server and the error-trigger written in Golang:
- Go 1.21+ for the
error-trigger - Node.js 18+ for the monitor server
- ngrok to expose the monitor server as a Sentry webhook
- Sentry organization with admin access
- Warp API key (create one here)
First, install the dependencies for the monitor and the error-trigger:
Monitor (TypeScript):
cd monitor
npm installError Trigger (Golang):
cd error-trigger
go mod downloadThen, you can verify that the warp-agent-sdk is able to connect by running the test.js script. This will start a coding agent and poll for a session link for you to interact with the agent as it is running.
You can create a Warp API key and set as an environment variable in a .env file. Copy the example template like so:
cd monitor
cp .env.example .envAnd set the WARP_API_KEY to the key you created.
Finally, run the test script and wait for a session link to be returned:
node --env-file=.env test.jsYou will need to expose your dev server as a public URL, then configure an integration from Sentry.
This will expose your monitor server as a public URL for Sentry to forward alerts:
ngrok http 3000Then, copy the forwarding URL (e.g., https://abc123.ngrok-free.dev) to configure in Sentry.
- Go to Settings > Developer Settings > New Internal Integration
- Name:
Nil Pointer Monitor - Webhook URL:
<your-ngrok-url>/sentry/webhook - Enable Alert Rule Action toggle
- Permissions: Read access to Issue & Event
- Save and copy the Client Secret
- Go to Alerts > Create Alert > Issue Alert
- Select your project
- Triggers: "A new issue is created" and "The issue changes state from resolved to unresolved"
- Filter: The event's message value contains "nil pointer dereference"
- Action: Send a notification via [your integration name]
- Save rule
Update your .env file with the following values:
SENTRY_CLIENT_SECRET- Client secret from Sentry internal integration (required)PORT- Server port to expose as a webhook (default:3000)
cd monitor
npm run devSet the SENTRY_DSN environment variable to your Sentry project DSN (found in Settings > Projects > [your project] > Client Keys):
cd error-trigger
SENTRY_DSN=<your-dsn> go run script.goThis should trigger an alert in your Sentry dashboard, and ping /sentry/webhook in your Node.js server.
POST /sentry/webhook- Sentry webhook receiverGET /health- Health check