test-wuying-agentbay-sdk 0.13.0-beta.20251210135226 → 0.13.0-beta.20251210170519
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +406 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +152 -18
- package/dist/index.d.ts +152 -18
- package/dist/index.mjs +405 -59
- package/dist/index.mjs.map +1 -1
- package/docs/api/README.md +2 -0
- package/docs/api/common-features/advanced/agent.md +7 -63
- package/docs/api/common-features/advanced/browser-use-agent.md +113 -0
- package/docs/api/common-features/advanced/computer-use-agent.md +79 -0
- package/docs/examples/common-features/advanced/agent-module-example.ts +1 -1
- package/package.json +1 -1
package/docs/api/README.md
CHANGED
|
@@ -5,77 +5,21 @@
|
|
|
5
5
|
- [Agent Modules Guide](../../../../../docs/guides/common-features/advanced/agent-modules.md) - Learn about agent modules and custom agents
|
|
6
6
|
|
|
7
7
|
An Agent to manipulate applications to complete specific tasks.
|
|
8
|
+
According to the use scenary, The agent can a browser use agent which is
|
|
9
|
+
specialized for browser automation tasks, The agent also can be a computer
|
|
10
|
+
use agent which is specialized for multiple applications automation tasks.
|
|
8
11
|
|
|
9
12
|
## Table of contents
|
|
10
13
|
|
|
11
14
|
|
|
12
|
-
###
|
|
15
|
+
### Properties
|
|
13
16
|
|
|
14
|
-
- [executeTask](#executetask)
|
|
15
|
-
- [terminateTask](#terminatetask)
|
|
16
17
|
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
### executeTask
|
|
20
|
-
|
|
21
|
-
▸ **executeTask**(`task`, `maxTryTimes`): `Promise`\<``ExecutionResult``\>
|
|
22
|
-
|
|
23
|
-
Execute a specific task described in human language.
|
|
24
|
-
|
|
25
|
-
#### Parameters
|
|
26
|
-
|
|
27
|
-
| Name | Type | Description |
|
|
28
|
-
| :------ | :------ | :------ |
|
|
29
|
-
| `task` | `string` | Task description in human language. |
|
|
30
|
-
| `maxTryTimes` | `number` | Maximum number of retry attempts. |
|
|
31
|
-
|
|
32
|
-
#### Returns
|
|
33
|
-
|
|
34
|
-
`Promise`\<``ExecutionResult``\>
|
|
35
|
-
|
|
36
|
-
ExecutionResult containing success status, task output, and error message if any.
|
|
37
|
-
|
|
38
|
-
**`Example`**
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
42
|
-
const result = await agentBay.create({ imageId: 'windows_latest' });
|
|
43
|
-
if (result.success) {
|
|
44
|
-
const taskResult = await result.session.agent.executeTask('Open notepad', 10);
|
|
45
|
-
console.log(`Task status: ${taskResult.taskStatus}`);
|
|
46
|
-
await result.session.delete();
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### terminateTask
|
|
51
|
-
|
|
52
|
-
▸ **terminateTask**(`taskId`): `Promise`\<``ExecutionResult``\>
|
|
53
|
-
|
|
54
|
-
Terminate a task with a specified task ID.
|
|
55
|
-
|
|
56
|
-
#### Parameters
|
|
57
|
-
|
|
58
|
-
| Name | Type | Description |
|
|
59
|
-
| :------ | :------ | :------ |
|
|
60
|
-
| `taskId` | `string` | The ID of the running task. |
|
|
61
|
-
|
|
62
|
-
#### Returns
|
|
63
|
-
|
|
64
|
-
`Promise`\<``ExecutionResult``\>
|
|
65
|
-
|
|
66
|
-
ExecutionResult containing success status, task output, and error message if any.
|
|
67
|
-
|
|
68
|
-
**`Example`**
|
|
18
|
+
## Properties
|
|
69
19
|
|
|
70
20
|
```typescript
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (result.success) {
|
|
74
|
-
const taskResult = await result.session.agent.executeTask('Open notepad', 5);
|
|
75
|
-
const terminateResult = await result.session.agent.terminateTask(taskResult.taskId);
|
|
76
|
-
console.log(`Terminated: ${terminateResult.taskStatus}`);
|
|
77
|
-
await result.session.delete();
|
|
78
|
-
}
|
|
21
|
+
browser: [`BrowserUseAgent`](browser-use-agent.md)
|
|
22
|
+
computer: [`ComputerUseAgent`](computer-use-agent.md)
|
|
79
23
|
```
|
|
80
24
|
|
|
81
25
|
## Related Resources
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Class: BrowserUseAgent
|
|
2
|
+
|
|
3
|
+
## Table of contents
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Methods
|
|
7
|
+
|
|
8
|
+
- [executeTask](#executetask)
|
|
9
|
+
- [initialize](#initialize)
|
|
10
|
+
- [terminateTask](#terminatetask)
|
|
11
|
+
|
|
12
|
+
## Methods
|
|
13
|
+
|
|
14
|
+
### executeTask
|
|
15
|
+
|
|
16
|
+
▸ **executeTask**(`task`, `maxTryTimes`): `Promise`\<``ExecutionResult``\>
|
|
17
|
+
|
|
18
|
+
Execute a specific task described in human language.
|
|
19
|
+
|
|
20
|
+
#### Parameters
|
|
21
|
+
|
|
22
|
+
| Name | Type | Description |
|
|
23
|
+
| :------ | :------ | :------ |
|
|
24
|
+
| `task` | `string` | Task description in human language. |
|
|
25
|
+
| `maxTryTimes` | `number` | Maximum number of retry attempts. |
|
|
26
|
+
|
|
27
|
+
#### Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<``ExecutionResult``\>
|
|
30
|
+
|
|
31
|
+
ExecutionResult containing success status, task output, and
|
|
32
|
+
error message if any.
|
|
33
|
+
|
|
34
|
+
**`Example`**
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
38
|
+
const result = await agentBay.create({ imageId: 'linux_latest' });
|
|
39
|
+
if (result.success) {
|
|
40
|
+
const taskResult = await
|
|
41
|
+
result.session.agent.browser.executeTask('Navigate to baidu and query the
|
|
42
|
+
weather of Shanghai', 10); console.log(`Task status:
|
|
43
|
+
${taskResult.taskStatus}`); await result.session.delete();
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### initialize
|
|
48
|
+
|
|
49
|
+
▸ **initialize**(`options`): `Promise`\<``InitializationResult``\>
|
|
50
|
+
|
|
51
|
+
Initialize the browser agent with specific options.
|
|
52
|
+
|
|
53
|
+
#### Parameters
|
|
54
|
+
|
|
55
|
+
| Name | Type | Description |
|
|
56
|
+
| :------ | :------ | :------ |
|
|
57
|
+
| `options` | ``AgentOptions`` | agent initialization options |
|
|
58
|
+
|
|
59
|
+
#### Returns
|
|
60
|
+
|
|
61
|
+
`Promise`\<``InitializationResult``\>
|
|
62
|
+
|
|
63
|
+
InitializationResult containing success status, task output,
|
|
64
|
+
and error message if any.
|
|
65
|
+
|
|
66
|
+
**`Example`**
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
70
|
+
const result = await agentBay.create({ imageId: 'linux_latest' });
|
|
71
|
+
if (result.success) {
|
|
72
|
+
options:AgentOptions = new AgentOptions(use_vision=False,
|
|
73
|
+
output_schema=""); const initResult = await
|
|
74
|
+
result.session.agent.browser.initialize(options); console.log(`Initialize
|
|
75
|
+
success: ${initResult.success}`); await result.session.delete();
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
___
|
|
80
|
+
|
|
81
|
+
### terminateTask
|
|
82
|
+
|
|
83
|
+
▸ **terminateTask**(`taskId`): `Promise`\<``ExecutionResult``\>
|
|
84
|
+
|
|
85
|
+
Terminate a task with a specified task ID.
|
|
86
|
+
|
|
87
|
+
#### Parameters
|
|
88
|
+
|
|
89
|
+
| Name | Type | Description |
|
|
90
|
+
| :------ | :------ | :------ |
|
|
91
|
+
| `taskId` | `string` | The ID of the running task. |
|
|
92
|
+
|
|
93
|
+
#### Returns
|
|
94
|
+
|
|
95
|
+
`Promise`\<``ExecutionResult``\>
|
|
96
|
+
|
|
97
|
+
ExecutionResult containing success status, task output, and
|
|
98
|
+
error message if any.
|
|
99
|
+
|
|
100
|
+
**`Example`**
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
104
|
+
const result = await agentBay.create({ imageId: 'windows_latest' });
|
|
105
|
+
if (result.success) {
|
|
106
|
+
const taskResult = await
|
|
107
|
+
result.session.agent.browser.executeTask(Navigate to baidu and query the
|
|
108
|
+
weather of Shanghai, 10); const terminateResult = await
|
|
109
|
+
result.session.agent.browser.terminateTask(taskResult.taskId);
|
|
110
|
+
console.log(`Terminated: ${terminateResult.taskStatus}`);
|
|
111
|
+
await result.session.delete();
|
|
112
|
+
}
|
|
113
|
+
```
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Class: ComputerUseAgent
|
|
2
|
+
|
|
3
|
+
An Agent to perform tasks on the computer.
|
|
4
|
+
|
|
5
|
+
## Table of contents
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Methods
|
|
9
|
+
|
|
10
|
+
- [executeTask](#executetask)
|
|
11
|
+
- [terminateTask](#terminatetask)
|
|
12
|
+
|
|
13
|
+
## Methods
|
|
14
|
+
|
|
15
|
+
### executeTask
|
|
16
|
+
|
|
17
|
+
▸ **executeTask**(`task`, `maxTryTimes`): `Promise`\<``ExecutionResult``\>
|
|
18
|
+
|
|
19
|
+
Execute a specific task described in human language.
|
|
20
|
+
|
|
21
|
+
#### Parameters
|
|
22
|
+
|
|
23
|
+
| Name | Type | Description |
|
|
24
|
+
| :------ | :------ | :------ |
|
|
25
|
+
| `task` | `string` | Task description in human language. |
|
|
26
|
+
| `maxTryTimes` | `number` | Maximum number of retry attempts. |
|
|
27
|
+
|
|
28
|
+
#### Returns
|
|
29
|
+
|
|
30
|
+
`Promise`\<``ExecutionResult``\>
|
|
31
|
+
|
|
32
|
+
ExecutionResult containing success status, task output, and error
|
|
33
|
+
message if any.
|
|
34
|
+
|
|
35
|
+
**`Example`**
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
39
|
+
const result = await agentBay.create({ imageId: 'windows_latest' });
|
|
40
|
+
if (result.success) {
|
|
41
|
+
const taskResult = await result.session.agent.computer.executeTask('Open
|
|
42
|
+
notepad', 10); console.log(`Task status: ${taskResult.taskStatus}`); await
|
|
43
|
+
result.session.delete();
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### terminateTask
|
|
48
|
+
|
|
49
|
+
▸ **terminateTask**(`taskId`): `Promise`\<``ExecutionResult``\>
|
|
50
|
+
|
|
51
|
+
Terminate a task with a specified task ID.
|
|
52
|
+
|
|
53
|
+
#### Parameters
|
|
54
|
+
|
|
55
|
+
| Name | Type | Description |
|
|
56
|
+
| :------ | :------ | :------ |
|
|
57
|
+
| `taskId` | `string` | The ID of the running task. |
|
|
58
|
+
|
|
59
|
+
#### Returns
|
|
60
|
+
|
|
61
|
+
`Promise`\<``ExecutionResult``\>
|
|
62
|
+
|
|
63
|
+
ExecutionResult containing success status, task output, and
|
|
64
|
+
error message if any.
|
|
65
|
+
|
|
66
|
+
**`Example`**
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
70
|
+
const result = await agentBay.create({ imageId: 'windows_latest' });
|
|
71
|
+
if (result.success) {
|
|
72
|
+
const taskResult = await
|
|
73
|
+
result.session.agent.computer.executeTask('Open notepad', 5); const
|
|
74
|
+
terminateResult = await
|
|
75
|
+
result.session.agent.computer.terminateTask(taskResult.taskId);
|
|
76
|
+
console.log(`Terminated: ${terminateResult.taskStatus}`);
|
|
77
|
+
await result.session.delete();
|
|
78
|
+
}
|
|
79
|
+
```
|
|
@@ -33,7 +33,7 @@ async function main() {
|
|
|
33
33
|
const taskDescription = "Calculate the square root of 144";
|
|
34
34
|
console.log(`Executing task: ${taskDescription}`);
|
|
35
35
|
|
|
36
|
-
const executionResult = await session.agent.executeTask(taskDescription, 5);
|
|
36
|
+
const executionResult = await session.agent.computer.executeTask(taskDescription, 5);
|
|
37
37
|
|
|
38
38
|
if (executionResult.success) {
|
|
39
39
|
console.log("Task completed successfully!");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "test-wuying-agentbay-sdk",
|
|
3
|
-
"version": "0.13.0-beta.
|
|
3
|
+
"version": "0.13.0-beta.20251210170519",
|
|
4
4
|
"description": "TypeScript SDK for interacting with the Wuying AgentBay cloud runtime environment",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|