When to use an agent SDK instead of a CLI or a job

Use a decision contract to choose interactive agent control, an event-driven SDK, or deterministic automation, informed by the Cursor Agent SDK launch.

AIAgentsDevelopment

Sources are linked in the guide. Read our editorial policy.

On this page 6 sections

Use an agent SDK when model judgment needs to live inside a versioned application with explicit triggers, permissions, state, and evaluation. Keep an interactive CLI when a person is steering the work. Use an ordinary deterministic job when the decision is already expressible as rules.

Cursor’s Agent SDK announcement, published October 20, 2026, makes this choice timely. It describes agents defined as code, event-driven workflows, evaluation and event replay, and deployment to Cursor-managed or self-hosted infrastructure. The Hacker News discussion posted October 28 raises useful questions about custom harnesses, switching costs, and interactive versus webhook-driven workloads. Those questions are more durable than commenters’ unverified model or pricing comparisons.

The decision is not “which framework wins?” It is “what part of the workflow must our application control?”

Start with the smallest sufficient execution model

Your actual requirement Starting point What changes the decision
A developer explores a bug, clarifies intent, and reviews edits Interactive coding agent or CLI Unattended work needs durable ownership and explicit event handling
A fixed rule maps file paths to repository owners Deterministic job Ambiguous content requires judgment that the rule cannot supply
A scheduled task needs one bounded classification Job plus a model call, if sufficient Multi-step tool selection or ongoing sessions become necessary
A webhook starts a review with custom tools and application policy Agent SDK candidate Existing automation may already expose enough control
Only a prompt or trigger needs changing Existing automation interface Code review, custom logic, or evaluation needs exceed that interface

A CLI can support noninteractive execution, and an SDK can expose an interactive interface. The distinction is not terminal versus server. It is whether the existing interface exposes the lifecycle and controls your workload needs. Do not add an SDK merely to replace one scheduled command with more files.

Cursor’s current overview similarly distinguishes dashboard automation from a versioned Markdown and TypeScript project. Its conversion guide explicitly recommends staying in the dashboard when only the prompt or trigger changes.

Work through one concrete decision

Imagine a proposed PR-routing service. This is a design example, not a measured deployment.

Requirement A: assign reviewers from an agreed directory-to-team mapping. Implement the mapping directly. An agent adds uncertainty without providing necessary judgment.

Requirement B: explain whether a change conflicts with a maintained set of architectural decisions. Now the service must interpret prose and code, retrieve relevant decisions, and cite evidence. A bounded model-assisted workflow may be appropriate.

Requirement C: run that review on PR events, preserve discussion context, expose a narrow comment-writing tool, and evaluate behavior before deployment. An SDK becomes a stronger candidate because application control surrounds the judgment.

Even in C, keep event verification, repository allowlists, revision checks, and permission decisions deterministic. Let the model analyze the change; do not let it decide which repositories its credential authorizes.

Complete this adoption contract before choosing

The following worksheet is a proposed engineering contract, not a claim that an SDK automatically implements every row.

Contract Required decision and evidence
Trigger Accepted event types, authenticated origin, repository scope, duplicate handling
Judgment Why a rule or single bounded model call is insufficient; allowed outcomes
State Session identity, source revision, pending work, retention, concurrent-update policy
Permissions Executor identity, tool allowlist, network destinations, data boundary, approval rules
Deployment Managed or self-hosted owner, persistence, secrets, recovery and shutdown procedure
Evaluation Representative inputs, forbidden actions, escalation cases, acceptance threshold
Migration Portable inputs and outputs, state export requirements, replacement and rollback path

If a row has no owner or answer, an SDK installation has not resolved it. It has only selected some infrastructure.

For shared mutable records, define a multi-agent state contract. For consequential writes, use runtime human approval bound to the exact action. Neither policy is satisfied by telling the model to be careful.

Separate platform features from your obligations

Cursor’s project-layout documentation identifies instructions, tools, skills, connections, channels, hooks, and evaluation suites as separate project surfaces. That supports reviewable software organization, not automatic correctness.

Be especially careful with the word “hook”: the current project-layout reference describes hooks/*.ts as observe-only event subscribers. Do not assume a logging hook is a blocking authorization gate. Put enforcement at the documented execution boundary you actually control.

The deployment guide describes managed hosting from a pushed Git ref and self-hosting for your own network or process controls. Managed hosting still involves storing repository and agent data; inspect the documented privacy behavior. Self-hosting still needs authentication, protected persistent storage, and operational ownership. Neither choice means “no infrastructure decisions.”

Deployment access and downstream tool access are also different. Cursor documents Viewer, Editor, and Owner roles in its access reference. Those roles do not establish which customer record or repository a tool should modify; review the downstream identity separately.

Evaluate actions, then migrate deliberately

For the illustrative reviewer, require cases such as:

  • A straightforward change receives a cited finding or an explicit no-finding result.
  • Missing evidence causes escalation, not an invented architectural rule.
  • An untrusted PR comment cannot expand repository access.
  • A new commit invalidates a write proposed for an older revision.
  • Duplicate delivery does not produce duplicate external comments.
  • A denied write remains denied across resume or retry.

Evaluate the trajectory and external effects, not just a plausible final paragraph. Cursor’s eval documentation warns that evals run real tools. Isolate destinations and credentials and guard writes before replaying events; “evaluation” is not synonymous with a safe sandbox.

For migration, preserve domain inputs, evidence references, decision output, and tool contracts independently of runtime-specific session objects. Record the SDK and documentation revision used. Do not assume projects or state serialize portably between vendors merely because each uses Markdown, TypeScript, skills, or MCP.

When converting an existing automation, account for documented gaps: Cursor’s conversion guide says credentials, webhook registration, and Automation memory do not carry over. Resolve conversion warnings, replay representative inputs in isolation, and disable the old live trigger before enabling the equivalent new one. Keeping two writers live is not a rollback strategy.

An SDK is justified when it makes an already-defined control contract easier to implement and operate. It does not remove the need to define that contract.

Sources and discussion

Connected by shared topics