# Demo: Sentry monitoring with SDK

> Build a Sentry webhook handler that triggers agents to investigate errors and create draft PRs.

- 网址：https://funcoding.ai/agents/warp/factories/api-and-sdk/demo-sentry-monitoring-with-sdk/
- 来源：Warp 官方文档原文（英文），MIT 许可，同步于 2026-10-11
- 官方原文：https://docs.warp.dev/factories/api-and-sdk/demo-sentry-monitoring-with-sdk/

---
### Turn production errors into draft PRs with Cloud Agents + TypeScript SDK

<div class="callout callout-note">

Example repository: [**Sentry monitor example repository**](https://github.com/warpdotdev/warp-agents-sdk-demo-sentry-monitor)

</div>

In this demo, Ben builds a small TypeScript “Sentry monitor” service that listens for specific Sentry alerts (like a Go nil pointer dereference) and triggers a Warp cloud agent to investigate. The server validates the webhook, extracts the stack trace, and injects it into an agent run inside a Warp Environment so the agent can inspect the repo and propose a fix.

To route the alert through a factory's named agents and workflow instead, use [factory endpoints](https://funcoding.ai/agents/warp/factories/factory-api/) to dispatch the request. This example remains useful for custom standalone cloud-agent intake.

He also covers the task lifecycle basics in the TypeScript SDK (running an agent, polling task state to fetch a session link for debugging), and shows the end result: a draft GitHub pull request created from the Sentry event for a maintainer to review.

**What Ben covers**

* Using Warp's TypeScript SDK to trigger agent runs and retrieve run details.
* Handling run lifecycle states (queued → running) to reliably fetch a session link.
* Running agents inside a Warp Environment so they can investigate real code, run tests, and validate fixes.
* Building a lightweight Sentry webhook server that filters, validates, and routes only the right errors to an agent.
* Creating a workflow that results in draft PRs for human review, instead of silent autonomous changes.
