Cursor SDK を用いたプログラム型エージェントの構築方法
Cursor は、同社のデスクトップ・CLI・Web アプリで動作するエージェントを構築するための公式 SDK を公開し、開発者が自環境やクラウド上で独自のエージェントを構築・管理できる機能を強化した。
キーポイント
公式 SDK の公開と実行環境の柔軟性
TypeScript による簡易な API で、Cursor のランタイムとモデルを活用したエージェントをローカルまたは専用クラウド VM で実行可能にした。
Cloud Agents API の刷新
永続的なエージェント(durable agents)とプロンプトごとの実行(run-scoped)に再設計され、ステータス管理やストリーミング機能が強化された。
ライフサイクル制御と標準化
アーカイブ、復元、削除などの明示的な制御機能に加え、エラーコードやレスポンス形式が v1 で統一され、開発体験が向上した。
重要な引用
We're introducing the Cursor SDK so you can build agents with the same runtime, harness, and models that power Cursor.
Reworked the API around durable agents and per-prompt runs, so follow-ups, status, streaming, and cancellation are now run-scoped.
影響分析・編集コメントを表示
影響分析
この発表は、Cursor を単なる IDE ツールから、カスタムエージェントを構築・展開できるプラットフォームへと進化させる重要な転換点です。開発者が自社のワークフローに合わせた自律型エージェントを容易に実装できるようになることで、AI エージェントの普及と実業務への統合が加速すると予想されます。
編集コメント
開発者が自社のロジックを維持しつつ、Cursor の強力なバックエンド能力を活用できるため、実務での採用ハードルが大幅に低下しています。特に API の標準化とライフサイクル管理機能は、本番環境でのエージェント運用において不可欠な要素です。
Cursor SDK を導入しました。これにより、Cursor の基盤となるランタイム、ハネス、モデルをそのまま利用してエージェントを構築できるようになります。
現在、Cursor デスクトップアプリ、CLI、Web アプリで動作しているエージェントは、TypeScript コード数行でアクセス可能になりました。自分のマシン上で実行することも、Cursor のクラウド上の専用 VM で実行することもでき、最先端のあらゆるモデルに対応しています。
まずは npm install @cursor/sdk を実行して始めましょう。また、Cursor SDK プラグインを使用することで、Cursor 自体があなたの開発をサポートします。
`jsx import { Agent } from "@cursor/sdk";
const agent = await Agent.create({ apiKey: process.env.CURSOR_API_KEY!, model: { id: "composer-2" }, local: { cwd: process.cwd() }, });
const run = await agent.send("Summarize what this repository does");
for await (const event of run.stream()) { console.log(event); } `
公開リポジトリからサンプルプロジェクトをいくつか用意しました。これらのプロジェクトをフォークし、ご自身のユースケースに合わせて拡張してください。
Cursor SDK は現在、すべてのユーザー向けにパブリックベータとして利用可能です。料金はトークンベースの従量課金制です。詳細は発表記事とドキュメントをご覧ください。
Cloud Agents API のアップデート
永続的なエージェントとプロンプトごとの実行を軸に API を再設計しました。これにより、フォローアップ、ステータス確認、ストリーミング、キャンセル機能はすべて「実行単位」で管理されるようになりました。
SSE イベントによるネイティブな実行ストリーミング機能を追加し、Last-Event-ID による再接続サポートと、より明確なターミナル状態の定義を行いました。
アーカイブ化、復元、永久削除といったエージェントのライフサイクル制御を明示的に実装しました。
v1 のレスポンスとエラー形式を標準化し、構造化されたエラーコード、items リスト形式のレスポンス、そして agent と run オブジェクトを分離した構造を採用しました。
原文を表示
We're introducing the Cursor SDK so you can build agents with the same runtime, harness, and models that power Cursor.
The agents that run in the Cursor desktop app, CLI, and web app are now accessible with a few lines of TypeScript. Run it on your machine or on Cursor's cloud against a dedicated VM, with any frontier model.
Run npm install @cursor/sdk to get started and use the Cursor SDK plugin so Cursor can help you build.
`jsx import { Agent } from "@cursor/sdk";
const agent = await Agent.create({ apiKey: process.env.CURSOR_API_KEY!, model: { id: "composer-2" }, local: { cwd: process.cwd() }, });
const run = await agent.send("Summarize what this repository does");
for await (const event of run.stream()) { console.log(event); } `
We built a few sample projects that you can access from a public repo. Fork and extend them for your own use case.
The Cursor SDK is now available for all users in public beta and is billed based on standard, token-based consumption pricing. Learn more in our announcement and docs.
Updates to the Cloud Agents API
Reworked the API around durable agents and per-prompt runs, so follow-ups, status, streaming, and cancellation are now run-scoped.
Added first-class run streaming with SSE events, reconnect support via Last-Event-ID, and clearer terminal states.
Added explicit agent lifecycle controls with archive, unarchive, and permanent delete.
Standardized v1 response and error shapes, including structured error codes, items list responses, and separate agent / run objects.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み