Dev Practice

How to Build a Code-Based Agent with the Cursor Agent SDK

Key Takeaway

The Cursor Agent SDK lets you define an agent as a project folder, test it locally, and deploy it to Cursor. General release was announced in the 2026-10-20 changelog.

A laptop with a blurred screen on a sunlit oak desk beside wooden blocks, a plant, a mug, a notebook, and a phone

How do I start a project?

The current Agent SDK documentation calls for Node.js 22.13 or newer and the @grok/agent-sdk package. Follow its install and login steps, then create a project with agent-sdk init ./my-bot. Run agent-sdk dev inside the project and a local playground starts.

The October 20 changelog has an init example that uses @cursor/agent-sdk, and that isn't the package the current documentation names. The changelog says the --template option picks a template for a security reviewer, owner policy approval, automatic PR fixes, or Linear or Jira issue triage. So check the current package and access requirements before you install.

Where do the agent's instructions and tools go?

Cursor describes instructions.md as the agent's instructions. Typed actions the model can call go in tools/. Procedures to load when needed go in skills/. mcp-connections/ connects MCP server tools, and channels/ defines the paths for receiving or responding to messages.

Use agent-sdk validate to check the project structure and agent-sdk info to see what it discovers. But a passing validation doesn't cover everything. Check the connected services' permissions and the actual task results separately.

Which events can trigger it?

The official announcement lists pull requests and comments on GitHub, GitLab, and Bitbucket, as well as CI events, as triggers. Slack mentions and DMs, webhooks, and cron schedules work too. The announcement also says GitHub events don't need a public webhook URL, since Cursor receives them through the Cursor account.

Each conversation keeps its own session and records messages and tool calls. A follow-up question in a PR or Slack thread continues in the same session. Also check that access to each connected channel is limited to what the work requires.

How do I deploy and validate it?

For local testing, agent-sdk eval sends fixed messages, so you can check tool calls and response formats. The changelog also lists agent-sdk github replay <pr-url> for testing with a GitHub PR, and the --dry-run --fixtures-dir fixtures/ options save payloads as fixtures for evaluation.

When the project is ready to deploy to Cursor, run agent-sdk deploy from the project directory. Cursor says the command builds the project, gives it a URL, and runs it on Cursor infrastructure. You manage secrets and integrations in the dashboard.

Before you deploy, go through the tools the agent can call and the permissions they've been given. Then run local evaluations and check that the permitted actions and response formats are right. The changelog was checked on 2026-11-2.

Frequently Asked Questions

Can I specify a template when creating a project?

Yes. The official changelog says adding the --template option to the initialization command selects a template.

Can I test locally before deploying?

You can launch a local playground with agent-sdk dev and use agent-sdk eval to test behavior against fixed messages.

Where does the agent run after deployment?

According to the changelog, agent-sdk deploy builds the project, gives it a URL, and runs it on Cursor infrastructure.

Sources & Verification Date

  1. Cursor Changelog — Agent SDK · Verified
  2. Cursor Docs — Agent SDK · Verified

All materials have been verified from official announcements and may have changed since verification.