Software Dev

Cursor Agent SDK: Test What an Agent Does

Cursor Agent SDK: Test What an Agent Does
Written byVien Hong
Published
Reading time4 min

An agent can give a convincing explanation after taking the wrong action. For event-driven automation, reading the final answer is therefore an incomplete test. You also need to inspect which tools it called and which actions it avoided.

Cursor made its Agent SDK generally available on October 20, 2026, according to its release changelog. The part worth examining is its approach to testing behavior: define the agent as a project, give it a fixed input, and check the resulting tool use alongside the response. There is an important caveat. Those evaluations can run real tools.

Put the agent's behavior in a project

Cursor describes the SDK as a way to define an agent as a folder of code, test it with evals, and deploy it to Cursor or your own infrastructure. That is the vendor's documented capability, not evidence that every deployment environment will work.

The layout makes the pieces explicit. instructions.md holds the prompt. The tools/ folder contains typed actions the model can call, while skills/ holds procedures loaded on demand. mcp-connections/ provides MCP tools, and channels/ defines where messages enter and responses go.

A project folder connected to separate instruction, tool, procedure, and message cards

This separation gives a reviewer concrete things to examine. A change to an instruction is different from a change to a tool that writes externally. Both might alter behavior, but they deserve different scrutiny.

The changelog also documents event inputs such as pull-request activity, Slack messages, webhooks, and schedules. It says follow-ups on a pull request or in Slack resume the conversation session. That makes testing follow-up behavior relevant alongside testing the first response.

Start with a read-only pull-request inspector

Consider a hypothetical agent asked to inspect a pull request and report blockers. Its job is deliberately narrow: gather evidence, explain what it found, and never approve the change. This is a proposed experiment, not a system tested for this article.

A useful test would check that the agent called the inspection tool. It would separately check that it did not call an approval tool. The answer should also match the evidence: a report of a failing check should not become an assurance that the change is ready.

Cursor's eval guide uses this kind of distinction. Its official example asserts that an inspection tool was called and an approval tool was not called. An eval sends fixed input to a real agent and checks tool use and the response.

An event card passing through an inspection step while an approval path is marked as forbidden

For this experiment, I would keep actual access read-only. A forbidden-action assertion can reveal an unwanted decision during a test, but it is not an authorization boundary. The test should describe the policy; permissions should limit what the agent can do.

Replay inputs and check the follow-up

A fixed prompt helps, but an event-driven agent also needs representative event data. Cursor's eval documentation describes using agent-sdk github replay with --dry-run --fixtures-dir to save GitHub webhook payloads as fixtures. It separately shows how to seed workspace files so a case does not depend on the current checkout.

These mechanisms solve different problems. A saved event makes the triggering input available for another run. Seeded files give the case an explicit workspace. Neither should be treated as a guarantee that the tools invoked later cannot change something externally.

For the hypothetical inspector, a useful case would include a failing check and a follow-up asking whether approval is now appropriate. The desired behavior would be to inspect the available evidence again and stay within the read-only task.

The guide says multiple messages in one eval case share a session. Assertions attached to an individual returned turn apply to that turn; assertions on the test context apply to the conversation. That distinction matters when checking whether the first request caused an inspection and whether any turn attempted an approval.

A conversation-wide check alone may be too broad for a specific expectation. Decide whether each assertion concerns one response or the entire exchange before interpreting a pass.

An eval run is not automatically a sandbox

The strongest warning in the eval guide is that evaluations run real tools. Calling something a test does not stop a write tool from posting externally.

Cursor documents purpose: "eval" on evaluation sessions. Its example checks that value inside the write tool and returns the decision without posting it. The protection comes from the tool's implementation checking the session purpose. It does not happen automatically for every tool.

An evaluation path returning a decision card before an external write gate

Keep three mechanisms separate when reviewing an evaluation setup:

  • Fixtures preserve inputs for replay.
  • Behavioral assertions check what happened during a run.
  • Write guards change what a tool does in evaluation mode.

A forbidden-call assertion could fail after a tool has already acted. For that reason, review side effects before running the case, rather than relying on the eventual test result to protect the target system. Even a passing case establishes only the conditions it checked.

Inspect the evidence before rewriting the prompt

Cursor's build guide recommends calling tools directly and correcting bad evidence before changing instructions. It then recommends running a real turn, inspecting its trace, and running smoke evals. It also says to finish with the project's TypeScript check: a passing agent turn does not prove the project type-checks.

That order is sensible. If an inspection tool returns incomplete information, a more forceful prompt does not repair the evidence. Looking at the tool output first gives you a specific failure to address.

For repeated checks, the eval guide documents local and CI execution, tagged smoke cases, and saved artifacts containing inputs, assertions, tool calls, and final text. It also shows JSON and JUnit reporting for CI. Those artifacts are useful review material, though they do not independently establish reliability.

For a first experiment, choose one narrow, read-only task. Inspect the tool output directly. Add a failure case and an assertion for an action the agent must avoid. Review write guards before any evaluation that could reach a write tool. Then inspect the trace, run the smoke cases, and finish with the type check. Expand access only after you can explain the decisions visible in those runs.

Sources

More from the blog

View all