Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/core/src/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,13 @@ Analyze the current page state and determine your next action based on previous
- Did all specified filters/criteria apply (price range, date, location, format)?
- Does your answer match the requested format?
3. Verify actions actually completed by checking the most recent page state:
- If you submitted a form, did the next page confirm success?
- If you submitted a form, look for a success message or a validation error:
- A validation error means it did NOT submit — fix and retry.
- Neither a confirmation nor an error is a normal outcome on many sites: treat the submission as completed and report it with done(), stating explicitly that no confirmation was shown.
- If you extracted data, did you actually find it in the page snapshot or extract() output?
4. Data grounding: every value in your answer must appear in a page snapshot, a tool result, or the task input. Do NOT use general knowledge to fill gaps. If a value was not found during this session, say so explicitly rather than inventing it.
5. Blockers vs. obstacles: if you hit an unrecoverable block (paywall, login wall, access denied, payment declined) that prevented completing a core requirement, call abort() with the reason. Temporary obstacles you handled (dismissed popups, retried errors) don't change the outcome.
6. If anything is unverified, incomplete, or uncertain — call abort() with the reason rather than done() with an overclaiming answer.
6. If the information or data the task asks you to return is unverified, or a core step was blocked outright, call abort() with the reason rather than done() with an overclaiming answer. But an action you actually performed — e.g. a form submit that returned no error and showed no validation error — is NOT "unverified" merely because the site displayed no explicit success message; report that with done() and the caveat, don't abort.

**When using done():**
Provide your final answer:
Expand Down
9 changes: 9 additions & 0 deletions packages/core/test/prompts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,15 @@ describe("prompts", () => {
expect(prompt).toContain("GUARDRAIL COMPLIANCE");
});

it("guides done() for an action that completed without error but showed no confirmation", () => {
const prompt = buildActionLoopSystemPrompt(false, false);

// A submitted form with neither confirmation nor error should be reported
// with done() (caveated), not aborted as "unverified".
expect(prompt).toContain("no confirmation was shown");
expect(prompt).toContain('is NOT "unverified"');
});

it("should support both guardrails and webSearch", () => {
const prompt = buildActionLoopSystemPrompt(true, true);

Expand Down
Loading