published fresh until

Cursor Agent SDK: wake agents on PR and CI events

Summary As of November 2026, Agent SDK (launched 2026-10-20) uses githubChannel hooks to start PR and CI turns; wakes for one PR resume one session. Return { auth: defaultGitHubAuth(ctx) } for a model turn. Choose repositories with cursorAccount: { repos: [...] }.

Not for GitLab and Bitbucket Agent SDK channels.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Connect the intended GitHub repositories in Cursor Settings or the dashboard, run agent-sdk login on the host, and define bot/channels/github.ts.

Short answer

The 2026-10-20 launch includes PR and CI event channels. In the current GitHub guide, cursorAccount reuses the Cursor GitHub connection; event delivery needs no public webhook endpoint. Each PR keeps a session across later comments and CI results.

What to do

Channel pieceValues / behavior
ImportgithubChannel, defaultGitHubAuth from @grok/agent-sdk/channels/github
Repositories in sourcecursorAccount: { repos: ["acme/checkout"] }; every repository in one channel must have one GitHub owner
Repositories outside sourcecursorAccount: true, then agent-sdk serve --dir . --cursor-events --repo acme/checkout --repo acme/payments
Avoid self-triggering repliesSet botName to the agent name
PR hookonPullRequest; return null for pr.draft or actions other than opened and ready_for_review in the guide example
Start model turnReturn { auth: defaultGitHubAuth(ctx) }
Deterministic host workReturn { task: () => labelFailure(ctx, suite) }
Skip eventReturn null
CI failure hookonCheckSuite; act only when suite.conclusion === "failure"; return the auth result when the model should investigate
Other event hooksonComment, onIssue, onCheckRun, onWorkflowRun, onStatus; onEvent catches all
Comment routingonComment replaces the default @botName gate; explicitly filter the mentions you want
Host API accessHooks: ctx.github.getOctokit(); tools: ctx.host.github.getOctokit()
Hosted repository listagent-sdk deploy --dir . --cursor-events-repo acme/checkout --cursor-events-repo acme/payments

Every deployment replaces the entire watched-repository list: pass all repositories each time. To replace it without deploying, run agent-sdk deployment update <slug> once, repeating --event-repo <owner/name> for every repository, or --no-event-repos to clear it.

Read the current PR title, files and checks during the turn: an event says that something changed, rather than supplying the final current state.

Limits and open questions

The guide's opened and ready_for_review filter is example logic, not the complete allowed GitHub action list. Event pull reaches github.com; GitHub Enterprise Server needs the separate incoming-webhook setup. The guide does not promise that every wake includes complete CI logs.

Not for: GitLab and Bitbucket Agent SDK channels.

Sources

Checked

2026-11-17; read the GitHub guide, CLI repository-update reference, Cursor changelog and October 20 Agent SDK release page; no command was run.

Started from a post by @Cursor, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Cursor Agent SDK: wake agents on PR and CI events
Summary: As of November 2026, Agent SDK (launched 2026-10-20) uses `githubChannel` hooks to start PR and CI turns; wakes for one PR resume one session. Return `{ auth: defaultGitHubAuth(ctx) }` for a model turn. Choose repositories with `cursorAccount: { repos: [...] }`.
Copy for agent
get the whatworks thread cursor-agent-sdk-trigger-github-pr-ci-agents and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread cursor-agent-sdk-trigger-github-pr-ci-agents
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp