After studying this material, you should be able to:
Software teams repeatedly handle the same tasks across their development lifecycle:
Before Agent SDK, teams had two painful options:
| Option | Problem |
|---|---|
| Use existing products | Built around someone else's workflow |
| Build from scratch | Time-consuming and complex |
Agent SDK solves this by giving teams a framework to build custom agents that match their specific workflow.
๐ก Key Insight: The same framework Cursor uses internally for Bugbot, Security Reviewer, and Rollouts is now publicly available.
An agent is essentially a automated worker that:
Trigger Event โ Agent Responds โ Takes Action โ Produces Outcome
kb-reviewerA Cursor team needed every pull request checked against their knowledge base of lessons learned.
The workflow:
Result: Built in approximately one day, now runs on every PR automatically.
Think of an agent as a small software project with specific files:
my-agent/
โโโ prompts/ โ Instructions written in Markdown
โโโ tools/ โ Capabilities written as TypeScript functions
โโโ integrations/ โ Connections to outside services (GitHub, GitLab, etc.)
โโโ evals/ โ Tests to verify agent behavior
Prompts (Markdown files)
Tools (TypeScript functions)
Integrations
Evals
๐ก Key Insight: Because everything is code, agents go through the same version control and review process as your regular software.
Agents respond to events your team already handles:
For complex work, agents can:
Main Agent
โโโ Hand off task โ Specialized Sub-Agent (with own tools)
โโโ Divide work โ Multiple Parallel Sub-Agents
| Option | How |
|---|---|
| Cursor Infrastructure | agent-sdk deploy command |
| Your Own Infrastructure | Package as a Node.js container |
agent-sdk deploy
This single command:
After deployment, manage via dashboard:
Here is the minimal code to define an agent:
import { homedir } from "node:os";
import { join } from "node:path";
import { defineAgent } from "@cursor/agent-sdk";
export default defineAgent({
name: "Robo", // Agent's name
model: {
id: "composer-2.5", // Which AI model to use
params: [
{ id: "effort", value: "high" }, // Quality setting
{ id: "fast", value: "true" }, // Speed setting
],
},
local: {
cwd: join(homedir(), ".cache", "factory", "robo"), // Local working directory
},
})
| Property | Purpose |
|---|---|
name | Identifies your agent |
model.id | Specifies which AI model powers the agent |
model.params | Tunes model behavior (effort level, speed) |
local.cwd | Sets where the agent works locally |
1. Create project directory
โ
2. Launch local playground
โ
3. Iterate and test locally
โ
4. Run evals to verify behavior
โ
5. Deploy with: agent-sdk deploy
PROBLEM SOLUTION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Repetitive dev tasks โ Define agents as code
Rigid existing tools โ Build around YOUR workflow
Hard to test โ Built-in evals + event replay
Complex deployment โ One command: agent-sdk deploy
Scaling complexity โ Multi-agent collaboration
Ask yourself:
defineAgent code and explain each part?If you can answer all five, you have successfully understood the core concepts of the Agent SDK.