Skip to content

feat(uptime): Add AI-powered assertion suggestions backend#108377

Closed
jaydgoss wants to merge 2 commits intomasterfrom
jaygoss/uptime-assertions-ai-be
Closed

feat(uptime): Add AI-powered assertion suggestions backend#108377
jaydgoss wants to merge 2 commits intomasterfrom
jaygoss/uptime-assertions-ai-be

Conversation

@jaydgoss
Copy link
Copy Markdown
Member

Summary

  • Adds a new API endpoint POST /api/0/organizations/{org}/uptime-assertion-suggestions/ that runs a preview check and uses Seer's LLM proxy to analyze the HTTP response and suggest useful monitoring assertions
  • Introduces seer_assertions.py module with prompt engineering, structured output parsing (via Gemini), and conversion logic to translate AI suggestions into the uptime checker's assertion JSON format
  • Gates the endpoint behind gen-ai-features + uptime-runtime-assertions flags and respects hide_ai_features organization opt-out via has_seer_access()
  • Includes rate limiting (1 req/5s per user, 10 req/60s per org) since each call hits both the uptime checker and Seer

New files

  • src/sentry/uptime/endpoints/organization_uptime_assertion_suggestions.py — API endpoint
  • src/sentry/uptime/seer_assertions.py — Seer integration, prompt, parsing, assertion conversion
  • tests/sentry/uptime/test_seer_assertions.py — unit tests for parsing, prompting, and conversion logic

Test plan

  • Unit tests pass: pytest tests/sentry/uptime/test_seer_assertions.py
  • Endpoint integration: verify 403 when flags disabled, 200 with valid preview check data
  • Verify rate limiting behaves correctly
  • Confirm hide_ai_features org option blocks access even when flags are enabled

Depends on: #108178 (feature flag registration, already merged)

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 17, 2026
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@jaydgoss
Copy link
Copy Markdown
Member Author

The only frontend change here is a single line added to knownSentryApiUrls.generated.ts — an auto-generated TypeScript type union entry that was produced by registering the new URL in urls.py. It has no runtime impact and is safe to deploy independently of the backend (it just adds a URL string to a type).

The actual frontend UI changes (button, drawer, suggestion cards) are in the stacked PR #108378.

Add a new endpoint that uses Seer's LLM proxy to generate assertion
suggestions for uptime monitors based on preview check responses.

- New endpoint: POST /organizations/{org}/uptime-assertion-suggestions/
- Uses has_seer_access() to respect both gen-ai-features flag and
  hide_ai_features org opt-out
- Parses preview check responses and sends to Seer for analysis
- Converts Seer suggestions to uptime checker assertion JSON format
- Rate limited to 1 req/5s per user, 10 req/60s per org
- Includes comprehensive unit tests
@jaydgoss jaydgoss force-pushed the jaygoss/uptime-assertions-ai-be branch from 2fbd02d to 5fdd512 Compare February 17, 2026 21:13
@jaydgoss jaydgoss closed this Feb 17, 2026
jaydgoss added a commit that referenced this pull request Feb 18, 2026
## Summary
- Adds a new API endpoint `POST
/api/0/organizations/{org}/uptime-assertion-suggestions/` that runs a
preview check and uses Seer's LLM proxy to analyze the HTTP response and
suggest useful monitoring assertions
- Introduces `seer_assertions.py` module with prompt engineering,
structured output parsing (via Gemini), and conversion logic to
translate AI suggestions into the uptime checker's assertion JSON format
- Gates the endpoint behind `gen-ai-features` +
`uptime-runtime-assertions` flags and respects `hide_ai_features`
organization opt-out via `has_seer_access()`
- Includes rate limiting (1 req/5s per user, 10 req/60s per org) since
each call hits both the uptime checker and Seer

### New files
-
`src/sentry/uptime/endpoints/organization_uptime_assertion_suggestions.py`
— API endpoint
- `src/sentry/uptime/seer_assertions.py` — Seer integration, prompt,
parsing, assertion conversion
- `tests/sentry/uptime/test_seer_assertions.py` — unit tests for
parsing, prompting, and conversion logic

## Test plan
- [ ] Unit tests pass: `pytest
tests/sentry/uptime/test_seer_assertions.py`
- [ ] Endpoint integration: verify 403 when flags disabled, 200 with
valid preview check data
- [ ] Verify rate limiting behaves correctly
- [ ] Confirm `hide_ai_features` org option blocks access even when
flags are enabled

Depends on: #108178 (feature flag registration, already merged)
Replaces: #108377 (closed due to force-push race)

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
mchen-sentry pushed a commit that referenced this pull request Feb 24, 2026
## Summary
- Adds a new API endpoint `POST
/api/0/organizations/{org}/uptime-assertion-suggestions/` that runs a
preview check and uses Seer's LLM proxy to analyze the HTTP response and
suggest useful monitoring assertions
- Introduces `seer_assertions.py` module with prompt engineering,
structured output parsing (via Gemini), and conversion logic to
translate AI suggestions into the uptime checker's assertion JSON format
- Gates the endpoint behind `gen-ai-features` +
`uptime-runtime-assertions` flags and respects `hide_ai_features`
organization opt-out via `has_seer_access()`
- Includes rate limiting (1 req/5s per user, 10 req/60s per org) since
each call hits both the uptime checker and Seer

### New files
-
`src/sentry/uptime/endpoints/organization_uptime_assertion_suggestions.py`
— API endpoint
- `src/sentry/uptime/seer_assertions.py` — Seer integration, prompt,
parsing, assertion conversion
- `tests/sentry/uptime/test_seer_assertions.py` — unit tests for
parsing, prompting, and conversion logic

## Test plan
- [ ] Unit tests pass: `pytest
tests/sentry/uptime/test_seer_assertions.py`
- [ ] Endpoint integration: verify 403 when flags disabled, 200 with
valid preview check data
- [ ] Verify rate limiting behaves correctly
- [ ] Confirm `hide_ai_features` org option blocks access even when
flags are enabled

Depends on: #108178 (feature flag registration, already merged)
Replaces: #108377 (closed due to force-push race)

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant