Skip to main content
The objective string is the most important input to Kane CLI. How you phrase it determines what the agent does and whether it succeeds. Objectives follow three patterns that you can combine freely.

Three Patterns

Assertions and extractions are evaluated as Checkpoints. See the reference for all analyze methods (Visual, Textual, URL, Title, DevTools) and comparison operators.

Actions

Use imperative verbs to describe what the agent should do:

Assertions

Assertions validate page state. The test fails if the condition is not met.

Extractions: The “store as” Pattern

Extractions read a value from the page and store it in the run output’s final_state field. Always use the explicit store X as 'name' syntax. Vague phrasing like “tell me” or “read” does not reliably capture data. ❌ Bad: the agent may see the value but does not save it:
✅ Good: the value is captured in final_state:

Combining Patterns

Chain all three patterns in one objective:
This objective: navigates → extracts two values → validates a condition → performs an action → validates the result.

What Makes a Good Objective

An objective is the natural-language instruction the agent follows. The clearer the objective, the more reliably the agent completes it.
  • Specific. Name the site, the action, and the field values where they matter.
  • Action-oriented. Lead with a verb: search, open, fill, click, verify.
  • Ends in a check of the result. State what “done” looks like as a claim about the page, so the agent knows when to stop and a replay has something to verify.
Two habits make an objective reliable enough to save and replay.

End Every Flow in a Check of the Result

Close with an assertion about the resulting page state (verify the cart shows 1 item), not a bare submit or confirm the dialog. Without a closing check, “done” only means the agent believed it had finished. With one, the run passes or fails based on the real end state. Check the outcome, not the control that triggered it: verify the Submit button is visible fails precisely when the action worked, because the button disappears on success. If an objective has several phases (log in, then search, then check out), each phase ends in its own check. Make the closing check something the agent can see on the screen the last action leaves it on, with no further click or navigation. If the proof lives on another page, get there with an explicit action first: place the order, open Order History, then verify the newest order shows "Processing", not verify the order succeeded by checking Order History. A check that has to find its own way to the evidence is really an action hidden inside an assertion, and the route the agent picks can differ from run to run.

Say the Goal, Not the Clicks

Phrase actions as goals (Log in as {{tester}}, Complete checkout with the saved card) so a run absorbs a reordered form or a new popup instead of breaking on it. Keep exact values such as credentials, prices, and URLs literal or in {{variables}}. For a step that only sometimes appears, such as a cookie banner, write it as a condition (if a cookie banner appears, dismiss it) rather than assuming it away.

Examples

Objectives can also set, delete, and clear cookies, localStorage, and the test clipboard directly. See Browser State Actions. Objectives can also make API calls directly: POST/GET a URL or paste a curl, save the response, and assert on it. See API Calls.

Bad to Better

The bad version leaves “test” undefined and gives the agent no end state. The better version names the URL, the credentials, and the assertion that closes the loop.

Real Examples

Login flow

Search with filters

Settings change

Checkout


Assertion Types


Dos and Don’ts


Objectives on Mobile

Objectives are written the same way for a native mobile app as for the browser. The difference is what the run points at: a mobile run installs an app you supply with --app, so the objective describes app screens and controls rather than a URL.
A mobile run cannot point at a website. WebViews inside the app under test are supported. See Mobile Testing.

Splitting Long Objectives

Objectives with more than 15 steps drift and become unreliable. Split them into multiple runs. In the Interactive TUI, the browser stays open between runs, so state carries over automatically:
In the Headless CLI, use --max-steps to cap each run:
A good rule: if your objective has more than three assert statements or more than five distinct actions, consider splitting it.