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
89 changes: 4 additions & 85 deletions docs/src/api/class-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ current working directory.

Raw CSS content to be injected into frame.

## property: Page.agent
* since: v1.58
- type: <[PageAgent]>

## async method: Page.bringToFront
* since: v1.8

Expand Down Expand Up @@ -2035,49 +2039,6 @@ Name of the function on the window object

Callback function which will be called in Playwright's context.

## async method: Page.extract
* since: v1.58
- returns: <[Object]>
- `result` <[any]>
- `usage` <[Object]>
- `turns` <[int]>
- `inputTokens` <[int]>
- `outputTokens` <[int]>

Extract information from the page using the agentic loop, return it in a given Zod format.

**Usage**

```js
await page.extract('List of items in the cart', z.object({
title: z.string().describe('Item title to extract'),
price: z.string().describe('Item price to extract'),
}).array());
```

### param: Page.extract.query
* since: v1.58
- `query` <[string]>

Task to perform using agentic loop.

### param: Page.extract.schema
* since: v1.58
- `schema` <[z.ZodSchema]>

### option: Page.extract.maxTokens
* since: v1.58
- `maxTokens` <[int]>

Maximum number of tokens to consume. The agentic loop will stop after input + output tokens exceed this value.
Defaults to context-wide value specified in `agent` property.

### option: Page.extract.maxTurns
* since: v1.58
- `maxTurns` <[int]>

Maximum number of agentic turns during this call, defaults to context-wide value specified in `agent` property.

## async method: Page.fill
* since: v1.8
* discouraged: Use locator-based [`method: Locator.fill`] instead. Read more about [locators](../locators.md).
Expand Down Expand Up @@ -3051,48 +3012,6 @@ Whether or not to generate tagged (accessible) PDF. Defaults to `false`.

Whether or not to embed the document outline into the PDF. Defaults to `false`.

## async method: Page.perform
* since: v1.58
- returns: <[Object]>
- `usage` <[Object]>
- `turns` <[int]>
- `inputTokens` <[int]>
- `outputTokens` <[int]>

Perform action using agentic loop.

**Usage**

```js
await page.perform('Click submit button');
```

### param: Page.perform.task
* since: v1.58
- `task` <[string]>

Task to perform using agentic loop.

### option: Page.perform.key
* since: v1.58
- `key` <[string]>

All the agentic actions are converted to the Playwright calls and are cached.
By default, they are cached globally with the `task` as a key. This option allows controlling the cache key explicitly.

### option: Page.perform.maxTokens
* since: v1.58
- `maxTokens` <[int]>

Maximum number of tokens to consume. The agentic loop will stop after input + output tokens exceed this value.
Defaults to context-wide value specified in `agent` property.

### option: Page.perform.maxTurns
* since: v1.58
- `maxTurns` <[int]>

Maximum number of agentic turns during this call, defaults to context-wide value specified in `agent` property.


## async method: Page.press
* since: v1.8
Expand Down
82 changes: 82 additions & 0 deletions docs/src/api/class-pageagent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# class: PageAgent
* since: v1.58


## async method: PageAgent.expect
* since: v1.58

Expect certain condition to be met.

**Usage**

```js
await page.agent.expect('"0 items" to be reported');
```

### param: PageAgent.expect.expectation
* since: v1.58
- `expectation` <[string]>

Expectation to assert.

### option: PageAgent.expect.-inline- = %%-page-agent-call-options-v1.58-%%
* since: v1.58

## async method: PageAgent.extract
* since: v1.58
- returns: <[Object]>
- `result` <[any]>
- `usage` <[Object]>
- `turns` <[int]>
- `inputTokens` <[int]>
- `outputTokens` <[int]>

Extract information from the page using the agentic loop, return it in a given Zod format.

**Usage**

```js
await page.agent.extract('List of items in the cart', z.object({
title: z.string().describe('Item title to extract'),
price: z.string().describe('Item price to extract'),
}).array());
```

### param: PageAgent.extract.query
* since: v1.58
- `query` <[string]>

Task to perform using agentic loop.

### param: PageAgent.extract.schema
* since: v1.58
- `schema` <[z.ZodSchema]>

### option: PageAgent.extract.-inline- = %%-page-agent-call-options-v1.58-%%
* since: v1.58


## async method: PageAgent.perform
* since: v1.58
- returns: <[Object]>
- `usage` <[Object]>
- `turns` <[int]>
- `inputTokens` <[int]>
- `outputTokens` <[int]>

Perform action using agentic loop.

**Usage**

```js
await page.agent.perform('Click submit button');
```

### param: PageAgent.perform.task
* since: v1.58
- `task` <[string]>

Task to perform using agentic loop.

### option: PageAgent.perform.-inline- = %%-page-agent-call-options-v1.58-%%
* since: v1.58
27 changes: 26 additions & 1 deletion docs/src/api/params.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,32 @@ Emulates consistent window screen size available inside web page via `window.scr
- `maxTurns` ?<[int]> Maximum number of agentic turns to take per call. Defaults to 10.
- `maxTokens` ?<[int]> Maximum number of tokens to consume per call. The agentic loop will stop after input + output tokens exceed this value. Defaults on unlimited.

Agent settings for [`method: Page.perform`] and [`method: Page.extract`].
Agent settings for [`property: Page.agent`].

## page-agent-key
* since: v1.58
- `key` <[string]>

All the agentic actions are converted to the Playwright calls and are cached.
By default, they are cached globally with the `task` as a key. This option allows controlling the cache key explicitly.

## page-agent-max-tokens
* since: v1.58
- `maxTokens` <[int]>

Maximum number of tokens to consume. The agentic loop will stop after input + output tokens exceed this value.
Defaults to context-wide value specified in `agent` property.

## page-agent-max-turns
* since: v1.58
- `maxTurns` <[int]>

Maximum number of agentic turns during this call, defaults to context-wide value specified in `agent` property.

## page-agent-call-options-v1.58
- %%-page-agent-key-%%
- %%-page-agent-max-tokens-%%
- %%-page-agent-max-turns-%%

## fetch-param-url
- `url` <[string]>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/test-api/class-fullconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Base directory for all relative paths used in the reporters.
* since: v1.58
- type: <['RunAgentsMode]<"all"|"missing"|"none">>

Whether to run LLM agent for [`method: Page.perform`]:
Whether to run LLM agent for [`property: Page.agent`]:
* "all" disregards existing cache and performs all actions via LLM
* "missing" only performs actions that don't have generated cache actions
* "none" does not talk to LLM at all, relies on the cached actions (default)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/test-api/class-testconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ export default defineConfig({
* since: v1.58
- type: ?<['RunAgentsMode]<"all"|"missing"|"none">>

Whether to run LLM agent for [`method: Page.perform`]:
Whether to run LLM agent for [`property: Page.agent`]:
* "all" disregards existing cache and performs all actions via LLM
* "missing" only performs actions that don't have generated cache actions
* "none" does not talk to LLM at all, relies on the cached actions (default)
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading