test-wuying-agentbay-sdk 0.13.1-beta.20251223203147 → 0.13.1-beta.20251224094729
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 +445 -295
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +75 -119
- package/dist/index.d.ts +75 -119
- package/dist/index.mjs +445 -295
- package/dist/index.mjs.map +1 -1
- package/docs/api/common-features/advanced/agent.md +5 -3
- package/docs/api/common-features/advanced/mobile-use-agent.md +161 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3510,9 +3510,16 @@ interface ExecutionResult extends ApiResponse {
|
|
|
3510
3510
|
* Result of query operations.
|
|
3511
3511
|
*/
|
|
3512
3512
|
interface QueryResult extends ApiResponse {
|
|
3513
|
+
taskId: string;
|
|
3513
3514
|
taskStatus: string;
|
|
3514
3515
|
taskAction: string;
|
|
3515
3516
|
taskProduct: string;
|
|
3517
|
+
stream?: Array<{
|
|
3518
|
+
content?: string;
|
|
3519
|
+
reasoning?: string;
|
|
3520
|
+
timestamp_ms?: number;
|
|
3521
|
+
}>;
|
|
3522
|
+
error?: string;
|
|
3516
3523
|
}
|
|
3517
3524
|
/**
|
|
3518
3525
|
* Result of agent initialization.
|
|
@@ -3546,94 +3553,38 @@ interface McpSession {
|
|
|
3546
3553
|
callMcpTool(toolName: string, args: any): Promise<McpToolResult>;
|
|
3547
3554
|
}
|
|
3548
3555
|
/**
|
|
3549
|
-
*
|
|
3556
|
+
* Base class for task execution agents.
|
|
3557
|
+
* Provides common functionality for ComputerUseAgent and BrowserUseAgent.
|
|
3550
3558
|
*/
|
|
3551
|
-
declare class
|
|
3552
|
-
|
|
3559
|
+
declare abstract class BaseTaskAgent {
|
|
3560
|
+
protected session: McpSession;
|
|
3561
|
+
protected abstract toolPrefix: string;
|
|
3562
|
+
constructor(session: McpSession);
|
|
3553
3563
|
/**
|
|
3554
|
-
*
|
|
3555
|
-
*
|
|
3556
|
-
* @param session - The Session instance that this Agent belongs to.
|
|
3564
|
+
* Get the full MCP tool name based on prefix and action.
|
|
3557
3565
|
*/
|
|
3558
|
-
|
|
3566
|
+
protected getToolName(action: string): string;
|
|
3559
3567
|
/**
|
|
3560
3568
|
* Execute a specific task described in human language.
|
|
3561
|
-
*
|
|
3562
|
-
* @param task - Task description in human language.
|
|
3563
|
-
* @param maxTryTimes - Maximum number of retry attempts.
|
|
3564
|
-
* @returns ExecutionResult containing success status, task output, and error
|
|
3565
|
-
* message if any.
|
|
3566
|
-
*
|
|
3567
|
-
* @example
|
|
3568
|
-
* ```typescript
|
|
3569
|
-
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3570
|
-
* const result = await agentBay.create({ imageId: 'windows_latest' });
|
|
3571
|
-
* if (result.success) {
|
|
3572
|
-
* const taskResult = await result.session.agent.computer.executeTask(
|
|
3573
|
-
* 'Open notepad',
|
|
3574
|
-
* 10
|
|
3575
|
-
* );
|
|
3576
|
-
* console.log(`Task status: ${taskResult.taskStatus}`);
|
|
3577
|
-
* await result.session.delete();
|
|
3578
|
-
* }
|
|
3579
|
-
* ```
|
|
3580
3569
|
*/
|
|
3581
3570
|
executeTask(task: string, maxTryTimes: number): Promise<ExecutionResult>;
|
|
3582
3571
|
/**
|
|
3583
3572
|
* Get the status of the task with the given task ID.
|
|
3584
|
-
*
|
|
3585
|
-
* @param taskId - Task ID
|
|
3586
|
-
* @returns QueryResult containing the task status
|
|
3587
|
-
*
|
|
3588
|
-
* @example
|
|
3589
|
-
* ```typescript
|
|
3590
|
-
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3591
|
-
* const result = await agentBay.create({ imageId: 'windows_latest' });
|
|
3592
|
-
* if (result.success) {
|
|
3593
|
-
* const taskResult = await result.session.agent.computer.executeTask('Open
|
|
3594
|
-
* calculator', 10); const statusResult = await
|
|
3595
|
-
* result.session.agent.computer.getTaskStatus(taskResult.taskId);
|
|
3596
|
-
* console.log(`Status:
|
|
3597
|
-
* ${JSON.parse(statusResult.output).status}`); await result.session.delete();
|
|
3598
|
-
* }
|
|
3599
|
-
* ```
|
|
3600
3573
|
*/
|
|
3601
3574
|
getTaskStatus(taskId: string): Promise<QueryResult>;
|
|
3602
3575
|
/**
|
|
3603
3576
|
* Terminate a task with a specified task ID.
|
|
3604
|
-
*
|
|
3605
|
-
* @param taskId - The ID of the running task.
|
|
3606
|
-
* @returns ExecutionResult containing success status, task output, and
|
|
3607
|
-
* error message if any.
|
|
3608
|
-
*
|
|
3609
|
-
* @example
|
|
3610
|
-
* ```typescript
|
|
3611
|
-
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3612
|
-
* const result = await agentBay.create({ imageId: 'windows_latest' });
|
|
3613
|
-
* if (result.success) {
|
|
3614
|
-
* const taskResult = await result.session.agent.computer.executeTask(
|
|
3615
|
-
* 'Open notepad',
|
|
3616
|
-
* 5
|
|
3617
|
-
* );
|
|
3618
|
-
* const terminateResult = await result.session.agent.computer.terminateTask(
|
|
3619
|
-
* taskResult.taskId
|
|
3620
|
-
* );
|
|
3621
|
-
* console.log(`Terminated: ${terminateResult.taskStatus}`);
|
|
3622
|
-
* await result.session.delete();
|
|
3623
|
-
* }
|
|
3624
|
-
* ```
|
|
3625
3577
|
*/
|
|
3626
3578
|
terminateTask(taskId: string): Promise<ExecutionResult>;
|
|
3627
3579
|
}
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
constructor(session: McpSession);
|
|
3580
|
+
/**
|
|
3581
|
+
* An Agent to perform tasks on the computer.
|
|
3582
|
+
*/
|
|
3583
|
+
declare class ComputerUseAgent extends BaseTaskAgent {
|
|
3584
|
+
protected toolPrefix: string;
|
|
3585
|
+
}
|
|
3586
|
+
declare class BrowserUseAgent extends BaseTaskAgent {
|
|
3587
|
+
protected toolPrefix: string;
|
|
3637
3588
|
/**
|
|
3638
3589
|
* Initialize the browser agent with specific options.
|
|
3639
3590
|
* @param options - agent initialization options
|
|
@@ -3653,78 +3604,74 @@ declare class BrowserUseAgent {
|
|
|
3653
3604
|
* ```
|
|
3654
3605
|
*/
|
|
3655
3606
|
initialize(options: AgentOptions): Promise<InitializationResult>;
|
|
3607
|
+
}
|
|
3608
|
+
/**
|
|
3609
|
+
* An Agent to perform tasks on mobile devices.
|
|
3610
|
+
*/
|
|
3611
|
+
declare class MobileUseAgent extends BaseTaskAgent {
|
|
3612
|
+
protected toolPrefix: string;
|
|
3656
3613
|
/**
|
|
3657
|
-
* Execute a
|
|
3614
|
+
* Execute a task in human language without waiting for completion
|
|
3615
|
+
* (non-blocking). This is a fire-and-return interface that immediately
|
|
3616
|
+
* provides a task ID. Call getTaskStatus to check the task status.
|
|
3658
3617
|
*
|
|
3659
3618
|
* @param task - Task description in human language.
|
|
3660
|
-
* @param
|
|
3661
|
-
*
|
|
3662
|
-
*
|
|
3663
|
-
*
|
|
3664
|
-
*
|
|
3665
|
-
*
|
|
3666
|
-
*
|
|
3667
|
-
*
|
|
3668
|
-
* if (result.success) {
|
|
3669
|
-
* const taskResult = await result.session.agent.browser.executeTask(
|
|
3670
|
-
* 'Navigate to baidu and query the weather of Shanghai',
|
|
3671
|
-
* 10
|
|
3672
|
-
* );
|
|
3673
|
-
* console.log(`Task status: ${taskResult.taskStatus}`);
|
|
3674
|
-
* await result.session.delete();
|
|
3675
|
-
* }
|
|
3676
|
-
* ```
|
|
3677
|
-
*/
|
|
3678
|
-
executeTask(task: string, maxTryTimes: number): Promise<ExecutionResult>;
|
|
3679
|
-
/**
|
|
3680
|
-
* Get the status of the task with the given task ID.
|
|
3681
|
-
*
|
|
3682
|
-
* @param taskId - Task ID
|
|
3683
|
-
* @returns QueryResult containing the task status
|
|
3619
|
+
* @param maxSteps - Maximum number of steps (clicks/swipes/etc.) allowed.
|
|
3620
|
+
* Used to prevent infinite loops or excessive resource
|
|
3621
|
+
* consumption. Default is 50.
|
|
3622
|
+
* @param maxStepRetries - Maximum retry times for MCP tool call failures
|
|
3623
|
+
* at SDK level. Used to retry when callMcpTool fails
|
|
3624
|
+
* (e.g., network errors, timeouts). Default is 3.
|
|
3625
|
+
* @returns ExecutionResult containing success status, task ID, task status,
|
|
3626
|
+
* and error message if any.
|
|
3684
3627
|
*
|
|
3685
3628
|
* @example
|
|
3686
3629
|
* ```typescript
|
|
3687
3630
|
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3688
|
-
* const result = await agentBay.create({ imageId: '
|
|
3631
|
+
* const result = await agentBay.create({ imageId: 'mobile_latest' });
|
|
3689
3632
|
* if (result.success) {
|
|
3690
|
-
* const
|
|
3691
|
-
* '
|
|
3692
|
-
* 10
|
|
3693
|
-
* );
|
|
3694
|
-
* const statusResult = await result.session.agent.browser.getTaskStatus(
|
|
3695
|
-
* taskResult.taskId
|
|
3633
|
+
* const execResult = await result.session.agent.mobile.executeTask(
|
|
3634
|
+
* 'Open WeChat app', 100, 5
|
|
3696
3635
|
* );
|
|
3697
|
-
* console.log(`
|
|
3636
|
+
* console.log(`Task ID: ${execResult.taskId}`);
|
|
3698
3637
|
* await result.session.delete();
|
|
3699
3638
|
* }
|
|
3700
3639
|
* ```
|
|
3701
3640
|
*/
|
|
3702
|
-
|
|
3641
|
+
executeTask(task: string, maxSteps?: number, maxStepRetries?: number): Promise<ExecutionResult>;
|
|
3703
3642
|
/**
|
|
3704
|
-
*
|
|
3643
|
+
* Execute a specific task described in human language synchronously.
|
|
3644
|
+
* This is a synchronous interface that blocks until the task is completed or
|
|
3645
|
+
* an error occurs, or timeout happens. The default polling interval is
|
|
3646
|
+
* 3 seconds.
|
|
3705
3647
|
*
|
|
3706
|
-
* @param
|
|
3707
|
-
* @
|
|
3708
|
-
*
|
|
3648
|
+
* @param task - Task description in human language.
|
|
3649
|
+
* @param maxSteps - Maximum number of steps (clicks/swipes/etc.) allowed.
|
|
3650
|
+
* Used to prevent infinite loops or excessive resource
|
|
3651
|
+
* consumption. Default is 50.
|
|
3652
|
+
* @param maxStepRetries - Maximum retry times for MCP tool call failures
|
|
3653
|
+
* at SDK level. Used to retry when callMcpTool fails
|
|
3654
|
+
* (e.g., network errors, timeouts). Default is 3.
|
|
3655
|
+
* @param maxTryTimes - Maximum number of polling attempts (each 3 seconds).
|
|
3656
|
+
* Used to control how long to wait for task completion.
|
|
3657
|
+
* Default is 300 (about 15 minutes).
|
|
3658
|
+
* @returns ExecutionResult containing success status, task ID, task status,
|
|
3659
|
+
* and error message if any.
|
|
3709
3660
|
*
|
|
3710
3661
|
* @example
|
|
3711
3662
|
* ```typescript
|
|
3712
3663
|
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3713
|
-
* const result = await agentBay.create({ imageId: '
|
|
3664
|
+
* const result = await agentBay.create({ imageId: 'mobile_latest' });
|
|
3714
3665
|
* if (result.success) {
|
|
3715
|
-
* const
|
|
3716
|
-
* '
|
|
3717
|
-
* 10
|
|
3718
|
-
* );
|
|
3719
|
-
* const terminateResult = await result.session.agent.browser.terminateTask(
|
|
3720
|
-
* taskResult.taskId
|
|
3666
|
+
* const execResult = await result.session.agent.mobile.executeTaskAndWait(
|
|
3667
|
+
* 'Open WeChat app', 100, 3, 200
|
|
3721
3668
|
* );
|
|
3722
|
-
* console.log(`
|
|
3669
|
+
* console.log(`Task result: ${execResult.taskResult}`);
|
|
3723
3670
|
* await result.session.delete();
|
|
3724
3671
|
* }
|
|
3725
3672
|
* ```
|
|
3726
3673
|
*/
|
|
3727
|
-
|
|
3674
|
+
executeTaskAndWait(task: string, maxSteps?: number, maxStepRetries?: number, maxTryTimes?: number): Promise<ExecutionResult>;
|
|
3728
3675
|
}
|
|
3729
3676
|
/**
|
|
3730
3677
|
* An Agent to manipulate applications to complete specific tasks.
|
|
@@ -3741,6 +3688,10 @@ declare class Agent {
|
|
|
3741
3688
|
* An instance of Browser Use Agent.
|
|
3742
3689
|
*/
|
|
3743
3690
|
browser: BrowserUseAgent;
|
|
3691
|
+
/**
|
|
3692
|
+
* An instance of Mobile Use Agent.
|
|
3693
|
+
*/
|
|
3694
|
+
mobile: MobileUseAgent;
|
|
3744
3695
|
/**
|
|
3745
3696
|
* Initialize an Agent object.
|
|
3746
3697
|
*
|
|
@@ -7610,6 +7561,10 @@ declare class MobileSimulateService {
|
|
|
7610
7561
|
* Log level type
|
|
7611
7562
|
*/
|
|
7612
7563
|
type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
7564
|
+
/**
|
|
7565
|
+
* Log format type
|
|
7566
|
+
*/
|
|
7567
|
+
type LogFormat = 'pretty' | 'sls';
|
|
7613
7568
|
/**
|
|
7614
7569
|
* Logger configuration options
|
|
7615
7570
|
*
|
|
@@ -7649,6 +7604,7 @@ interface LoggerConfig {
|
|
|
7649
7604
|
logFile?: string;
|
|
7650
7605
|
maxFileSize?: string;
|
|
7651
7606
|
enableConsole?: boolean;
|
|
7607
|
+
format?: LogFormat | string;
|
|
7652
7608
|
}
|
|
7653
7609
|
/**
|
|
7654
7610
|
* Set the log level
|
package/dist/index.d.ts
CHANGED
|
@@ -3510,9 +3510,16 @@ interface ExecutionResult extends ApiResponse {
|
|
|
3510
3510
|
* Result of query operations.
|
|
3511
3511
|
*/
|
|
3512
3512
|
interface QueryResult extends ApiResponse {
|
|
3513
|
+
taskId: string;
|
|
3513
3514
|
taskStatus: string;
|
|
3514
3515
|
taskAction: string;
|
|
3515
3516
|
taskProduct: string;
|
|
3517
|
+
stream?: Array<{
|
|
3518
|
+
content?: string;
|
|
3519
|
+
reasoning?: string;
|
|
3520
|
+
timestamp_ms?: number;
|
|
3521
|
+
}>;
|
|
3522
|
+
error?: string;
|
|
3516
3523
|
}
|
|
3517
3524
|
/**
|
|
3518
3525
|
* Result of agent initialization.
|
|
@@ -3546,94 +3553,38 @@ interface McpSession {
|
|
|
3546
3553
|
callMcpTool(toolName: string, args: any): Promise<McpToolResult>;
|
|
3547
3554
|
}
|
|
3548
3555
|
/**
|
|
3549
|
-
*
|
|
3556
|
+
* Base class for task execution agents.
|
|
3557
|
+
* Provides common functionality for ComputerUseAgent and BrowserUseAgent.
|
|
3550
3558
|
*/
|
|
3551
|
-
declare class
|
|
3552
|
-
|
|
3559
|
+
declare abstract class BaseTaskAgent {
|
|
3560
|
+
protected session: McpSession;
|
|
3561
|
+
protected abstract toolPrefix: string;
|
|
3562
|
+
constructor(session: McpSession);
|
|
3553
3563
|
/**
|
|
3554
|
-
*
|
|
3555
|
-
*
|
|
3556
|
-
* @param session - The Session instance that this Agent belongs to.
|
|
3564
|
+
* Get the full MCP tool name based on prefix and action.
|
|
3557
3565
|
*/
|
|
3558
|
-
|
|
3566
|
+
protected getToolName(action: string): string;
|
|
3559
3567
|
/**
|
|
3560
3568
|
* Execute a specific task described in human language.
|
|
3561
|
-
*
|
|
3562
|
-
* @param task - Task description in human language.
|
|
3563
|
-
* @param maxTryTimes - Maximum number of retry attempts.
|
|
3564
|
-
* @returns ExecutionResult containing success status, task output, and error
|
|
3565
|
-
* message if any.
|
|
3566
|
-
*
|
|
3567
|
-
* @example
|
|
3568
|
-
* ```typescript
|
|
3569
|
-
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3570
|
-
* const result = await agentBay.create({ imageId: 'windows_latest' });
|
|
3571
|
-
* if (result.success) {
|
|
3572
|
-
* const taskResult = await result.session.agent.computer.executeTask(
|
|
3573
|
-
* 'Open notepad',
|
|
3574
|
-
* 10
|
|
3575
|
-
* );
|
|
3576
|
-
* console.log(`Task status: ${taskResult.taskStatus}`);
|
|
3577
|
-
* await result.session.delete();
|
|
3578
|
-
* }
|
|
3579
|
-
* ```
|
|
3580
3569
|
*/
|
|
3581
3570
|
executeTask(task: string, maxTryTimes: number): Promise<ExecutionResult>;
|
|
3582
3571
|
/**
|
|
3583
3572
|
* Get the status of the task with the given task ID.
|
|
3584
|
-
*
|
|
3585
|
-
* @param taskId - Task ID
|
|
3586
|
-
* @returns QueryResult containing the task status
|
|
3587
|
-
*
|
|
3588
|
-
* @example
|
|
3589
|
-
* ```typescript
|
|
3590
|
-
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3591
|
-
* const result = await agentBay.create({ imageId: 'windows_latest' });
|
|
3592
|
-
* if (result.success) {
|
|
3593
|
-
* const taskResult = await result.session.agent.computer.executeTask('Open
|
|
3594
|
-
* calculator', 10); const statusResult = await
|
|
3595
|
-
* result.session.agent.computer.getTaskStatus(taskResult.taskId);
|
|
3596
|
-
* console.log(`Status:
|
|
3597
|
-
* ${JSON.parse(statusResult.output).status}`); await result.session.delete();
|
|
3598
|
-
* }
|
|
3599
|
-
* ```
|
|
3600
3573
|
*/
|
|
3601
3574
|
getTaskStatus(taskId: string): Promise<QueryResult>;
|
|
3602
3575
|
/**
|
|
3603
3576
|
* Terminate a task with a specified task ID.
|
|
3604
|
-
*
|
|
3605
|
-
* @param taskId - The ID of the running task.
|
|
3606
|
-
* @returns ExecutionResult containing success status, task output, and
|
|
3607
|
-
* error message if any.
|
|
3608
|
-
*
|
|
3609
|
-
* @example
|
|
3610
|
-
* ```typescript
|
|
3611
|
-
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3612
|
-
* const result = await agentBay.create({ imageId: 'windows_latest' });
|
|
3613
|
-
* if (result.success) {
|
|
3614
|
-
* const taskResult = await result.session.agent.computer.executeTask(
|
|
3615
|
-
* 'Open notepad',
|
|
3616
|
-
* 5
|
|
3617
|
-
* );
|
|
3618
|
-
* const terminateResult = await result.session.agent.computer.terminateTask(
|
|
3619
|
-
* taskResult.taskId
|
|
3620
|
-
* );
|
|
3621
|
-
* console.log(`Terminated: ${terminateResult.taskStatus}`);
|
|
3622
|
-
* await result.session.delete();
|
|
3623
|
-
* }
|
|
3624
|
-
* ```
|
|
3625
3577
|
*/
|
|
3626
3578
|
terminateTask(taskId: string): Promise<ExecutionResult>;
|
|
3627
3579
|
}
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
constructor(session: McpSession);
|
|
3580
|
+
/**
|
|
3581
|
+
* An Agent to perform tasks on the computer.
|
|
3582
|
+
*/
|
|
3583
|
+
declare class ComputerUseAgent extends BaseTaskAgent {
|
|
3584
|
+
protected toolPrefix: string;
|
|
3585
|
+
}
|
|
3586
|
+
declare class BrowserUseAgent extends BaseTaskAgent {
|
|
3587
|
+
protected toolPrefix: string;
|
|
3637
3588
|
/**
|
|
3638
3589
|
* Initialize the browser agent with specific options.
|
|
3639
3590
|
* @param options - agent initialization options
|
|
@@ -3653,78 +3604,74 @@ declare class BrowserUseAgent {
|
|
|
3653
3604
|
* ```
|
|
3654
3605
|
*/
|
|
3655
3606
|
initialize(options: AgentOptions): Promise<InitializationResult>;
|
|
3607
|
+
}
|
|
3608
|
+
/**
|
|
3609
|
+
* An Agent to perform tasks on mobile devices.
|
|
3610
|
+
*/
|
|
3611
|
+
declare class MobileUseAgent extends BaseTaskAgent {
|
|
3612
|
+
protected toolPrefix: string;
|
|
3656
3613
|
/**
|
|
3657
|
-
* Execute a
|
|
3614
|
+
* Execute a task in human language without waiting for completion
|
|
3615
|
+
* (non-blocking). This is a fire-and-return interface that immediately
|
|
3616
|
+
* provides a task ID. Call getTaskStatus to check the task status.
|
|
3658
3617
|
*
|
|
3659
3618
|
* @param task - Task description in human language.
|
|
3660
|
-
* @param
|
|
3661
|
-
*
|
|
3662
|
-
*
|
|
3663
|
-
*
|
|
3664
|
-
*
|
|
3665
|
-
*
|
|
3666
|
-
*
|
|
3667
|
-
*
|
|
3668
|
-
* if (result.success) {
|
|
3669
|
-
* const taskResult = await result.session.agent.browser.executeTask(
|
|
3670
|
-
* 'Navigate to baidu and query the weather of Shanghai',
|
|
3671
|
-
* 10
|
|
3672
|
-
* );
|
|
3673
|
-
* console.log(`Task status: ${taskResult.taskStatus}`);
|
|
3674
|
-
* await result.session.delete();
|
|
3675
|
-
* }
|
|
3676
|
-
* ```
|
|
3677
|
-
*/
|
|
3678
|
-
executeTask(task: string, maxTryTimes: number): Promise<ExecutionResult>;
|
|
3679
|
-
/**
|
|
3680
|
-
* Get the status of the task with the given task ID.
|
|
3681
|
-
*
|
|
3682
|
-
* @param taskId - Task ID
|
|
3683
|
-
* @returns QueryResult containing the task status
|
|
3619
|
+
* @param maxSteps - Maximum number of steps (clicks/swipes/etc.) allowed.
|
|
3620
|
+
* Used to prevent infinite loops or excessive resource
|
|
3621
|
+
* consumption. Default is 50.
|
|
3622
|
+
* @param maxStepRetries - Maximum retry times for MCP tool call failures
|
|
3623
|
+
* at SDK level. Used to retry when callMcpTool fails
|
|
3624
|
+
* (e.g., network errors, timeouts). Default is 3.
|
|
3625
|
+
* @returns ExecutionResult containing success status, task ID, task status,
|
|
3626
|
+
* and error message if any.
|
|
3684
3627
|
*
|
|
3685
3628
|
* @example
|
|
3686
3629
|
* ```typescript
|
|
3687
3630
|
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3688
|
-
* const result = await agentBay.create({ imageId: '
|
|
3631
|
+
* const result = await agentBay.create({ imageId: 'mobile_latest' });
|
|
3689
3632
|
* if (result.success) {
|
|
3690
|
-
* const
|
|
3691
|
-
* '
|
|
3692
|
-
* 10
|
|
3693
|
-
* );
|
|
3694
|
-
* const statusResult = await result.session.agent.browser.getTaskStatus(
|
|
3695
|
-
* taskResult.taskId
|
|
3633
|
+
* const execResult = await result.session.agent.mobile.executeTask(
|
|
3634
|
+
* 'Open WeChat app', 100, 5
|
|
3696
3635
|
* );
|
|
3697
|
-
* console.log(`
|
|
3636
|
+
* console.log(`Task ID: ${execResult.taskId}`);
|
|
3698
3637
|
* await result.session.delete();
|
|
3699
3638
|
* }
|
|
3700
3639
|
* ```
|
|
3701
3640
|
*/
|
|
3702
|
-
|
|
3641
|
+
executeTask(task: string, maxSteps?: number, maxStepRetries?: number): Promise<ExecutionResult>;
|
|
3703
3642
|
/**
|
|
3704
|
-
*
|
|
3643
|
+
* Execute a specific task described in human language synchronously.
|
|
3644
|
+
* This is a synchronous interface that blocks until the task is completed or
|
|
3645
|
+
* an error occurs, or timeout happens. The default polling interval is
|
|
3646
|
+
* 3 seconds.
|
|
3705
3647
|
*
|
|
3706
|
-
* @param
|
|
3707
|
-
* @
|
|
3708
|
-
*
|
|
3648
|
+
* @param task - Task description in human language.
|
|
3649
|
+
* @param maxSteps - Maximum number of steps (clicks/swipes/etc.) allowed.
|
|
3650
|
+
* Used to prevent infinite loops or excessive resource
|
|
3651
|
+
* consumption. Default is 50.
|
|
3652
|
+
* @param maxStepRetries - Maximum retry times for MCP tool call failures
|
|
3653
|
+
* at SDK level. Used to retry when callMcpTool fails
|
|
3654
|
+
* (e.g., network errors, timeouts). Default is 3.
|
|
3655
|
+
* @param maxTryTimes - Maximum number of polling attempts (each 3 seconds).
|
|
3656
|
+
* Used to control how long to wait for task completion.
|
|
3657
|
+
* Default is 300 (about 15 minutes).
|
|
3658
|
+
* @returns ExecutionResult containing success status, task ID, task status,
|
|
3659
|
+
* and error message if any.
|
|
3709
3660
|
*
|
|
3710
3661
|
* @example
|
|
3711
3662
|
* ```typescript
|
|
3712
3663
|
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3713
|
-
* const result = await agentBay.create({ imageId: '
|
|
3664
|
+
* const result = await agentBay.create({ imageId: 'mobile_latest' });
|
|
3714
3665
|
* if (result.success) {
|
|
3715
|
-
* const
|
|
3716
|
-
* '
|
|
3717
|
-
* 10
|
|
3718
|
-
* );
|
|
3719
|
-
* const terminateResult = await result.session.agent.browser.terminateTask(
|
|
3720
|
-
* taskResult.taskId
|
|
3666
|
+
* const execResult = await result.session.agent.mobile.executeTaskAndWait(
|
|
3667
|
+
* 'Open WeChat app', 100, 3, 200
|
|
3721
3668
|
* );
|
|
3722
|
-
* console.log(`
|
|
3669
|
+
* console.log(`Task result: ${execResult.taskResult}`);
|
|
3723
3670
|
* await result.session.delete();
|
|
3724
3671
|
* }
|
|
3725
3672
|
* ```
|
|
3726
3673
|
*/
|
|
3727
|
-
|
|
3674
|
+
executeTaskAndWait(task: string, maxSteps?: number, maxStepRetries?: number, maxTryTimes?: number): Promise<ExecutionResult>;
|
|
3728
3675
|
}
|
|
3729
3676
|
/**
|
|
3730
3677
|
* An Agent to manipulate applications to complete specific tasks.
|
|
@@ -3741,6 +3688,10 @@ declare class Agent {
|
|
|
3741
3688
|
* An instance of Browser Use Agent.
|
|
3742
3689
|
*/
|
|
3743
3690
|
browser: BrowserUseAgent;
|
|
3691
|
+
/**
|
|
3692
|
+
* An instance of Mobile Use Agent.
|
|
3693
|
+
*/
|
|
3694
|
+
mobile: MobileUseAgent;
|
|
3744
3695
|
/**
|
|
3745
3696
|
* Initialize an Agent object.
|
|
3746
3697
|
*
|
|
@@ -7610,6 +7561,10 @@ declare class MobileSimulateService {
|
|
|
7610
7561
|
* Log level type
|
|
7611
7562
|
*/
|
|
7612
7563
|
type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
7564
|
+
/**
|
|
7565
|
+
* Log format type
|
|
7566
|
+
*/
|
|
7567
|
+
type LogFormat = 'pretty' | 'sls';
|
|
7613
7568
|
/**
|
|
7614
7569
|
* Logger configuration options
|
|
7615
7570
|
*
|
|
@@ -7649,6 +7604,7 @@ interface LoggerConfig {
|
|
|
7649
7604
|
logFile?: string;
|
|
7650
7605
|
maxFileSize?: string;
|
|
7651
7606
|
enableConsole?: boolean;
|
|
7607
|
+
format?: LogFormat | string;
|
|
7652
7608
|
}
|
|
7653
7609
|
/**
|
|
7654
7610
|
* Set the log level
|