browser-use-sdk 2.0.13 → 2.0.15

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.
Files changed (90) hide show
  1. package/dist/cjs/Client.d.ts +0 -3
  2. package/dist/cjs/Client.js +2 -7
  3. package/dist/cjs/api/resources/browsers/client/requests/CreateBrowserSessionRequest.d.ts +2 -0
  4. package/dist/cjs/api/resources/index.d.ts +0 -2
  5. package/dist/cjs/api/resources/index.js +1 -3
  6. package/dist/cjs/api/resources/sessions/client/Client.d.ts +1 -0
  7. package/dist/cjs/api/resources/sessions/client/Client.js +3 -0
  8. package/dist/cjs/api/resources/sessions/client/requests/CreateSessionRequest.d.ts +4 -0
  9. package/dist/cjs/api/resources/skills/client/Client.d.ts +37 -0
  10. package/dist/cjs/api/resources/skills/client/Client.js +160 -0
  11. package/dist/cjs/api/resources/skills/client/requests/GetSkillExecutionOutputSkillsSkillIdExecutionsExecutionIdOutputGetRequest.d.ts +11 -0
  12. package/dist/cjs/api/resources/skills/client/requests/GetSkillExecutionOutputSkillsSkillIdExecutionsExecutionIdOutputGetRequest.js +3 -0
  13. package/dist/cjs/api/resources/skills/client/requests/ListSkillExecutionsSkillsSkillIdExecutionsGetRequest.d.ts +11 -0
  14. package/dist/cjs/api/resources/skills/client/requests/ListSkillExecutionsSkillsSkillIdExecutionsGetRequest.js +3 -0
  15. package/dist/cjs/api/resources/skills/client/requests/index.d.ts +2 -0
  16. package/dist/cjs/api/resources/tasks/client/Client.d.ts +32 -4
  17. package/dist/cjs/api/resources/tasks/client/Client.js +83 -4
  18. package/dist/cjs/api/resources/tasks/client/requests/GetTaskStatusTasksTaskIdStatusGetRequest.d.ts +9 -0
  19. package/dist/cjs/api/resources/tasks/client/requests/GetTaskStatusTasksTaskIdStatusGetRequest.js +3 -0
  20. package/dist/cjs/api/resources/tasks/client/requests/index.d.ts +1 -0
  21. package/dist/cjs/api/types/BrowserSessionItemView.d.ts +6 -0
  22. package/dist/cjs/api/types/BrowserSessionView.d.ts +6 -0
  23. package/dist/cjs/api/types/CustomProxy.d.ts +13 -0
  24. package/dist/cjs/api/types/CustomProxy.js +3 -0
  25. package/dist/cjs/api/types/ExecuteSkillRequest.d.ts +2 -0
  26. package/dist/cjs/api/types/InsufficientCreditsError.d.ts +1 -1
  27. package/dist/cjs/api/types/SessionItemView.d.ts +6 -0
  28. package/dist/cjs/api/types/SessionView.d.ts +6 -0
  29. package/dist/cjs/api/types/SkillExecutionListResponse.d.ts +14 -0
  30. package/dist/cjs/api/types/SkillExecutionListResponse.js +3 -0
  31. package/dist/cjs/api/types/SkillExecutionOutputResponse.d.ts +7 -0
  32. package/dist/cjs/api/types/SkillExecutionOutputResponse.js +3 -0
  33. package/dist/cjs/api/types/SkillExecutionView.d.ts +21 -0
  34. package/dist/cjs/api/types/SkillExecutionView.js +3 -0
  35. package/dist/cjs/api/types/SupportedLlMs.d.ts +2 -0
  36. package/dist/cjs/api/types/SupportedLlMs.js +2 -0
  37. package/dist/cjs/api/types/TaskItemView.d.ts +4 -0
  38. package/dist/cjs/api/types/TaskStatusView.d.ts +19 -0
  39. package/dist/cjs/api/types/TaskStatusView.js +3 -0
  40. package/dist/cjs/api/types/TaskView.d.ts +4 -0
  41. package/dist/cjs/api/types/index.d.ts +6 -20
  42. package/dist/cjs/api/types/index.js +6 -20
  43. package/dist/cjs/version.d.ts +1 -1
  44. package/dist/cjs/version.js +1 -1
  45. package/dist/esm/Client.d.mts +0 -3
  46. package/dist/esm/Client.mjs +2 -7
  47. package/dist/esm/api/resources/browsers/client/requests/CreateBrowserSessionRequest.d.mts +2 -0
  48. package/dist/esm/api/resources/index.d.mts +0 -2
  49. package/dist/esm/api/resources/index.mjs +0 -2
  50. package/dist/esm/api/resources/sessions/client/Client.d.mts +1 -0
  51. package/dist/esm/api/resources/sessions/client/Client.mjs +3 -0
  52. package/dist/esm/api/resources/sessions/client/requests/CreateSessionRequest.d.mts +4 -0
  53. package/dist/esm/api/resources/skills/client/Client.d.mts +37 -0
  54. package/dist/esm/api/resources/skills/client/Client.mjs +160 -0
  55. package/dist/esm/api/resources/skills/client/requests/GetSkillExecutionOutputSkillsSkillIdExecutionsExecutionIdOutputGetRequest.d.mts +11 -0
  56. package/dist/esm/api/resources/skills/client/requests/GetSkillExecutionOutputSkillsSkillIdExecutionsExecutionIdOutputGetRequest.mjs +2 -0
  57. package/dist/esm/api/resources/skills/client/requests/ListSkillExecutionsSkillsSkillIdExecutionsGetRequest.d.mts +11 -0
  58. package/dist/esm/api/resources/skills/client/requests/ListSkillExecutionsSkillsSkillIdExecutionsGetRequest.mjs +2 -0
  59. package/dist/esm/api/resources/skills/client/requests/index.d.mts +2 -0
  60. package/dist/esm/api/resources/tasks/client/Client.d.mts +32 -4
  61. package/dist/esm/api/resources/tasks/client/Client.mjs +83 -4
  62. package/dist/esm/api/resources/tasks/client/requests/GetTaskStatusTasksTaskIdStatusGetRequest.d.mts +9 -0
  63. package/dist/esm/api/resources/tasks/client/requests/GetTaskStatusTasksTaskIdStatusGetRequest.mjs +2 -0
  64. package/dist/esm/api/resources/tasks/client/requests/index.d.mts +1 -0
  65. package/dist/esm/api/types/BrowserSessionItemView.d.mts +6 -0
  66. package/dist/esm/api/types/BrowserSessionView.d.mts +6 -0
  67. package/dist/esm/api/types/CustomProxy.d.mts +13 -0
  68. package/dist/esm/api/types/CustomProxy.mjs +2 -0
  69. package/dist/esm/api/types/ExecuteSkillRequest.d.mts +2 -0
  70. package/dist/esm/api/types/InsufficientCreditsError.d.mts +1 -1
  71. package/dist/esm/api/types/SessionItemView.d.mts +6 -0
  72. package/dist/esm/api/types/SessionView.d.mts +6 -0
  73. package/dist/esm/api/types/SkillExecutionListResponse.d.mts +14 -0
  74. package/dist/esm/api/types/SkillExecutionListResponse.mjs +2 -0
  75. package/dist/esm/api/types/SkillExecutionOutputResponse.d.mts +7 -0
  76. package/dist/esm/api/types/SkillExecutionOutputResponse.mjs +2 -0
  77. package/dist/esm/api/types/SkillExecutionView.d.mts +21 -0
  78. package/dist/esm/api/types/SkillExecutionView.mjs +2 -0
  79. package/dist/esm/api/types/SupportedLlMs.d.mts +2 -0
  80. package/dist/esm/api/types/SupportedLlMs.mjs +2 -0
  81. package/dist/esm/api/types/TaskItemView.d.mts +4 -0
  82. package/dist/esm/api/types/TaskStatusView.d.mts +19 -0
  83. package/dist/esm/api/types/TaskStatusView.mjs +2 -0
  84. package/dist/esm/api/types/TaskView.d.mts +4 -0
  85. package/dist/esm/api/types/index.d.mts +6 -20
  86. package/dist/esm/api/types/index.mjs +6 -20
  87. package/dist/esm/version.d.mts +1 -1
  88. package/dist/esm/version.mjs +1 -1
  89. package/package.json +82 -83
  90. package/reference.md +117 -1051
@@ -122,7 +122,9 @@ export class Skills {
122
122
  * @param {Skills.RequestOptions} requestOptions - Request-specific configuration.
123
123
  *
124
124
  * @throws {@link BrowserUse.BadRequestError}
125
+ * @throws {@link BrowserUse.PaymentRequiredError}
125
126
  * @throws {@link BrowserUse.UnprocessableEntityError}
127
+ * @throws {@link BrowserUse.TooManyRequestsError}
126
128
  *
127
129
  * @example
128
130
  * await client.skills.createSkill({
@@ -158,8 +160,12 @@ export class Skills {
158
160
  switch (_response.error.statusCode) {
159
161
  case 400:
160
162
  throw new BrowserUse.BadRequestError(_response.error.body, _response.rawResponse);
163
+ case 402:
164
+ throw new BrowserUse.PaymentRequiredError(_response.error.body, _response.rawResponse);
161
165
  case 422:
162
166
  throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
167
+ case 429:
168
+ throw new BrowserUse.TooManyRequestsError(_response.error.body, _response.rawResponse);
163
169
  default:
164
170
  throw new errors.BrowserUseError({
165
171
  statusCode: _response.error.statusCode,
@@ -545,6 +551,7 @@ export class Skills {
545
551
  * @throws {@link BrowserUse.PaymentRequiredError}
546
552
  * @throws {@link BrowserUse.NotFoundError}
547
553
  * @throws {@link BrowserUse.UnprocessableEntityError}
554
+ * @throws {@link BrowserUse.TooManyRequestsError}
548
555
  *
549
556
  * @example
550
557
  * await client.skills.executeSkill({
@@ -587,6 +594,8 @@ export class Skills {
587
594
  throw new BrowserUse.NotFoundError(_response.error.body, _response.rawResponse);
588
595
  case 422:
589
596
  throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
597
+ case 429:
598
+ throw new BrowserUse.TooManyRequestsError(_response.error.body, _response.rawResponse);
590
599
  default:
591
600
  throw new errors.BrowserUseError({
592
601
  statusCode: _response.error.statusCode,
@@ -621,6 +630,7 @@ export class Skills {
621
630
  * @throws {@link BrowserUse.BadRequestError}
622
631
  * @throws {@link BrowserUse.NotFoundError}
623
632
  * @throws {@link BrowserUse.UnprocessableEntityError}
633
+ * @throws {@link BrowserUse.TooManyRequestsError}
624
634
  *
625
635
  * @example
626
636
  * await client.skills.refineSkill({
@@ -661,6 +671,8 @@ export class Skills {
661
671
  throw new BrowserUse.NotFoundError(_response.error.body, _response.rawResponse);
662
672
  case 422:
663
673
  throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
674
+ case 429:
675
+ throw new BrowserUse.TooManyRequestsError(_response.error.body, _response.rawResponse);
664
676
  default:
665
677
  throw new errors.BrowserUseError({
666
678
  statusCode: _response.error.statusCode,
@@ -686,6 +698,154 @@ export class Skills {
686
698
  }
687
699
  });
688
700
  }
701
+ /**
702
+ * List executions for a specific skill.
703
+ *
704
+ * @param {BrowserUse.ListSkillExecutionsSkillsSkillIdExecutionsGetRequest} request
705
+ * @param {Skills.RequestOptions} requestOptions - Request-specific configuration.
706
+ *
707
+ * @throws {@link BrowserUse.NotFoundError}
708
+ * @throws {@link BrowserUse.UnprocessableEntityError}
709
+ *
710
+ * @example
711
+ * await client.skills.listSkillExecutions({
712
+ * skill_id: "skill_id"
713
+ * })
714
+ */
715
+ listSkillExecutions(request, requestOptions) {
716
+ return core.HttpResponsePromise.fromPromise(this.__listSkillExecutions(request, requestOptions));
717
+ }
718
+ __listSkillExecutions(request, requestOptions) {
719
+ return __awaiter(this, void 0, void 0, function* () {
720
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
721
+ const { skill_id: skillId, pageSize, pageNumber } = request;
722
+ const _queryParams = {};
723
+ if (pageSize != null) {
724
+ _queryParams.pageSize = pageSize.toString();
725
+ }
726
+ if (pageNumber != null) {
727
+ _queryParams.pageNumber = pageNumber.toString();
728
+ }
729
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
730
+ const _response = yield core.fetcher({
731
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrowserUseEnvironment.Production, `skills/${core.url.encodePathParam(skillId)}/executions`),
732
+ method: "GET",
733
+ headers: _headers,
734
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
735
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
736
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
737
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
738
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
739
+ logging: this._options.logging,
740
+ });
741
+ if (_response.ok) {
742
+ return {
743
+ data: _response.body,
744
+ rawResponse: _response.rawResponse,
745
+ };
746
+ }
747
+ if (_response.error.reason === "status-code") {
748
+ switch (_response.error.statusCode) {
749
+ case 404:
750
+ throw new BrowserUse.NotFoundError(_response.error.body, _response.rawResponse);
751
+ case 422:
752
+ throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
753
+ default:
754
+ throw new errors.BrowserUseError({
755
+ statusCode: _response.error.statusCode,
756
+ body: _response.error.body,
757
+ rawResponse: _response.rawResponse,
758
+ });
759
+ }
760
+ }
761
+ switch (_response.error.reason) {
762
+ case "non-json":
763
+ throw new errors.BrowserUseError({
764
+ statusCode: _response.error.statusCode,
765
+ body: _response.error.rawBody,
766
+ rawResponse: _response.rawResponse,
767
+ });
768
+ case "timeout":
769
+ throw new errors.BrowserUseTimeoutError("Timeout exceeded when calling GET /skills/{skill_id}/executions.");
770
+ case "unknown":
771
+ throw new errors.BrowserUseError({
772
+ message: _response.error.errorMessage,
773
+ rawResponse: _response.rawResponse,
774
+ });
775
+ }
776
+ });
777
+ }
778
+ /**
779
+ * Get presigned URL for downloading skill execution output.
780
+ *
781
+ * @param {BrowserUse.GetSkillExecutionOutputSkillsSkillIdExecutionsExecutionIdOutputGetRequest} request
782
+ * @param {Skills.RequestOptions} requestOptions - Request-specific configuration.
783
+ *
784
+ * @throws {@link BrowserUse.NotFoundError}
785
+ * @throws {@link BrowserUse.UnprocessableEntityError}
786
+ *
787
+ * @example
788
+ * await client.skills.getSkillExecutionOutput({
789
+ * skill_id: "skill_id",
790
+ * execution_id: "execution_id"
791
+ * })
792
+ */
793
+ getSkillExecutionOutput(request, requestOptions) {
794
+ return core.HttpResponsePromise.fromPromise(this.__getSkillExecutionOutput(request, requestOptions));
795
+ }
796
+ __getSkillExecutionOutput(request, requestOptions) {
797
+ return __awaiter(this, void 0, void 0, function* () {
798
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
799
+ const { skill_id: skillId, execution_id: executionId } = request;
800
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
801
+ const _response = yield core.fetcher({
802
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrowserUseEnvironment.Production, `skills/${core.url.encodePathParam(skillId)}/executions/${core.url.encodePathParam(executionId)}/output`),
803
+ method: "GET",
804
+ headers: _headers,
805
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
806
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
807
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
808
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
809
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
810
+ logging: this._options.logging,
811
+ });
812
+ if (_response.ok) {
813
+ return {
814
+ data: _response.body,
815
+ rawResponse: _response.rawResponse,
816
+ };
817
+ }
818
+ if (_response.error.reason === "status-code") {
819
+ switch (_response.error.statusCode) {
820
+ case 404:
821
+ throw new BrowserUse.NotFoundError(_response.error.body, _response.rawResponse);
822
+ case 422:
823
+ throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
824
+ default:
825
+ throw new errors.BrowserUseError({
826
+ statusCode: _response.error.statusCode,
827
+ body: _response.error.body,
828
+ rawResponse: _response.rawResponse,
829
+ });
830
+ }
831
+ }
832
+ switch (_response.error.reason) {
833
+ case "non-json":
834
+ throw new errors.BrowserUseError({
835
+ statusCode: _response.error.statusCode,
836
+ body: _response.error.rawBody,
837
+ rawResponse: _response.rawResponse,
838
+ });
839
+ case "timeout":
840
+ throw new errors.BrowserUseTimeoutError("Timeout exceeded when calling GET /skills/{skill_id}/executions/{execution_id}/output.");
841
+ case "unknown":
842
+ throw new errors.BrowserUseError({
843
+ message: _response.error.errorMessage,
844
+ rawResponse: _response.rawResponse,
845
+ });
846
+ }
847
+ });
848
+ }
689
849
  _getCustomAuthorizationHeaders() {
690
850
  return __awaiter(this, void 0, void 0, function* () {
691
851
  const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * skill_id: "skill_id",
5
+ * execution_id: "execution_id"
6
+ * }
7
+ */
8
+ export interface GetSkillExecutionOutputSkillsSkillIdExecutionsExecutionIdOutputGetRequest {
9
+ skill_id: string;
10
+ execution_id: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * skill_id: "skill_id"
5
+ * }
6
+ */
7
+ export interface ListSkillExecutionsSkillsSkillIdExecutionsGetRequest {
8
+ skill_id: string;
9
+ pageSize?: number;
10
+ pageNumber?: number;
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -2,7 +2,9 @@ export type { CancelGenerationSkillsSkillIdCancelPostRequest } from "./CancelGen
2
2
  export type { CreateSkillRequest } from "./CreateSkillRequest.mjs";
3
3
  export type { DeleteSkillSkillsSkillIdDeleteRequest } from "./DeleteSkillSkillsSkillIdDeleteRequest.mjs";
4
4
  export type { ExecuteSkillSkillsSkillIdExecutePostRequest } from "./ExecuteSkillSkillsSkillIdExecutePostRequest.mjs";
5
+ export type { GetSkillExecutionOutputSkillsSkillIdExecutionsExecutionIdOutputGetRequest } from "./GetSkillExecutionOutputSkillsSkillIdExecutionsExecutionIdOutputGetRequest.mjs";
5
6
  export type { GetSkillSkillsSkillIdGetRequest } from "./GetSkillSkillsSkillIdGetRequest.mjs";
7
+ export type { ListSkillExecutionsSkillsSkillIdExecutionsGetRequest } from "./ListSkillExecutionsSkillsSkillIdExecutionsGetRequest.mjs";
6
8
  export type { ListSkillsSkillsGetRequest } from "./ListSkillsSkillsGetRequest.mjs";
7
9
  export type { RefineSkillRequest } from "./RefineSkillRequest.mjs";
8
10
  export type { RollbackSkillSkillsSkillIdRollbackPostRequest } from "./RollbackSkillSkillsSkillIdRollbackPostRequest.mjs";
@@ -27,12 +27,15 @@ export declare class Tasks {
27
27
  * Create and start a new task.
28
28
  *
29
29
  * You can either:
30
- * 1. Start a new task without a sessionId (auto-creates a session with US proxy by default)
30
+ * 1. Start a new task without a sessionId (auto-creates a session with US proxy by default).
31
+ * Note: Tasks without a sessionId are one-off tasks that automatically close the session
32
+ * upon completion (keep_alive=false).
31
33
  * 2. Start a new task in an existing session (reuse for follow-up tasks or custom configuration)
32
34
  *
33
- * Important: Proxy configuration (proxyCountryCode) is a session-level setting, not a task-level setting.
34
- * To use a custom proxy location, create a session first via POST /sessions with your desired proxyCountryCode,
35
- * then pass that sessionId when creating tasks.
35
+ * Important: Proxy configuration (proxyCountryCode) and other session settings (like keep_alive) are
36
+ * session-level settings, not task-level settings. For full control over session configuration,
37
+ * create a session first via POST /sessions with your desired settings, then pass that sessionId
38
+ * when creating tasks.
36
39
  *
37
40
  * @param {BrowserUse.CreateTaskRequest} request
38
41
  * @param {Tasks.RequestOptions} requestOptions - Request-specific configuration.
@@ -82,6 +85,31 @@ export declare class Tasks {
82
85
  */
83
86
  updateTask(request: BrowserUse.UpdateTaskRequest, requestOptions?: Tasks.RequestOptions): core.HttpResponsePromise<BrowserUse.TaskView>;
84
87
  private __updateTask;
88
+ /**
89
+ * Lightweight endpoint optimized for polling task status.
90
+ *
91
+ * Returns only the task status, output, and cost without loading steps,
92
+ * files, or session details. Use this endpoint for efficient polling
93
+ * instead of GET /tasks/{task_id}.
94
+ *
95
+ * Recommended polling pattern:
96
+ * 1. POST /tasks to create a task
97
+ * 2. Poll GET /tasks/{task_id}/status until status is 'finished' or 'stopped'
98
+ * 3. GET /tasks/{task_id} once at the end for full details including steps
99
+ *
100
+ * @param {BrowserUse.GetTaskStatusTasksTaskIdStatusGetRequest} request
101
+ * @param {Tasks.RequestOptions} requestOptions - Request-specific configuration.
102
+ *
103
+ * @throws {@link BrowserUse.NotFoundError}
104
+ * @throws {@link BrowserUse.UnprocessableEntityError}
105
+ *
106
+ * @example
107
+ * await client.tasks.getTaskStatus({
108
+ * task_id: "task_id"
109
+ * })
110
+ */
111
+ getTaskStatus(request: BrowserUse.GetTaskStatusTasksTaskIdStatusGetRequest, requestOptions?: Tasks.RequestOptions): core.HttpResponsePromise<BrowserUse.TaskStatusView>;
112
+ private __getTaskStatus;
85
113
  /**
86
114
  * Get secure download URL for task execution logs with step-by-step details.
87
115
  *
@@ -113,12 +113,15 @@ export class Tasks {
113
113
  * Create and start a new task.
114
114
  *
115
115
  * You can either:
116
- * 1. Start a new task without a sessionId (auto-creates a session with US proxy by default)
116
+ * 1. Start a new task without a sessionId (auto-creates a session with US proxy by default).
117
+ * Note: Tasks without a sessionId are one-off tasks that automatically close the session
118
+ * upon completion (keep_alive=false).
117
119
  * 2. Start a new task in an existing session (reuse for follow-up tasks or custom configuration)
118
120
  *
119
- * Important: Proxy configuration (proxyCountryCode) is a session-level setting, not a task-level setting.
120
- * To use a custom proxy location, create a session first via POST /sessions with your desired proxyCountryCode,
121
- * then pass that sessionId when creating tasks.
121
+ * Important: Proxy configuration (proxyCountryCode) and other session settings (like keep_alive) are
122
+ * session-level settings, not task-level settings. For full control over session configuration,
123
+ * create a session first via POST /sessions with your desired settings, then pass that sessionId
124
+ * when creating tasks.
122
125
  *
123
126
  * @param {BrowserUse.CreateTaskRequest} request
124
127
  * @param {Tasks.RequestOptions} requestOptions - Request-specific configuration.
@@ -330,6 +333,82 @@ export class Tasks {
330
333
  }
331
334
  });
332
335
  }
336
+ /**
337
+ * Lightweight endpoint optimized for polling task status.
338
+ *
339
+ * Returns only the task status, output, and cost without loading steps,
340
+ * files, or session details. Use this endpoint for efficient polling
341
+ * instead of GET /tasks/{task_id}.
342
+ *
343
+ * Recommended polling pattern:
344
+ * 1. POST /tasks to create a task
345
+ * 2. Poll GET /tasks/{task_id}/status until status is 'finished' or 'stopped'
346
+ * 3. GET /tasks/{task_id} once at the end for full details including steps
347
+ *
348
+ * @param {BrowserUse.GetTaskStatusTasksTaskIdStatusGetRequest} request
349
+ * @param {Tasks.RequestOptions} requestOptions - Request-specific configuration.
350
+ *
351
+ * @throws {@link BrowserUse.NotFoundError}
352
+ * @throws {@link BrowserUse.UnprocessableEntityError}
353
+ *
354
+ * @example
355
+ * await client.tasks.getTaskStatus({
356
+ * task_id: "task_id"
357
+ * })
358
+ */
359
+ getTaskStatus(request, requestOptions) {
360
+ return core.HttpResponsePromise.fromPromise(this.__getTaskStatus(request, requestOptions));
361
+ }
362
+ __getTaskStatus(request, requestOptions) {
363
+ return __awaiter(this, void 0, void 0, function* () {
364
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
365
+ const { task_id: taskId } = request;
366
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
367
+ const _response = yield core.fetcher({
368
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrowserUseEnvironment.Production, `tasks/${core.url.encodePathParam(taskId)}/status`),
369
+ method: "GET",
370
+ headers: _headers,
371
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
372
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
373
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
374
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
375
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
376
+ logging: this._options.logging,
377
+ });
378
+ if (_response.ok) {
379
+ return { data: _response.body, rawResponse: _response.rawResponse };
380
+ }
381
+ if (_response.error.reason === "status-code") {
382
+ switch (_response.error.statusCode) {
383
+ case 404:
384
+ throw new BrowserUse.NotFoundError(_response.error.body, _response.rawResponse);
385
+ case 422:
386
+ throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
387
+ default:
388
+ throw new errors.BrowserUseError({
389
+ statusCode: _response.error.statusCode,
390
+ body: _response.error.body,
391
+ rawResponse: _response.rawResponse,
392
+ });
393
+ }
394
+ }
395
+ switch (_response.error.reason) {
396
+ case "non-json":
397
+ throw new errors.BrowserUseError({
398
+ statusCode: _response.error.statusCode,
399
+ body: _response.error.rawBody,
400
+ rawResponse: _response.rawResponse,
401
+ });
402
+ case "timeout":
403
+ throw new errors.BrowserUseTimeoutError("Timeout exceeded when calling GET /tasks/{task_id}/status.");
404
+ case "unknown":
405
+ throw new errors.BrowserUseError({
406
+ message: _response.error.errorMessage,
407
+ rawResponse: _response.rawResponse,
408
+ });
409
+ }
410
+ });
411
+ }
333
412
  /**
334
413
  * Get secure download URL for task execution logs with step-by-step details.
335
414
  *
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * task_id: "task_id"
5
+ * }
6
+ */
7
+ export interface GetTaskStatusTasksTaskIdStatusGetRequest {
8
+ task_id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,5 +1,6 @@
1
1
  export type { CreateTaskRequest } from "./CreateTaskRequest.mjs";
2
2
  export type { GetTaskLogsTasksTaskIdLogsGetRequest } from "./GetTaskLogsTasksTaskIdLogsGetRequest.mjs";
3
+ export type { GetTaskStatusTasksTaskIdStatusGetRequest } from "./GetTaskStatusTasksTaskIdStatusGetRequest.mjs";
3
4
  export type { GetTaskTasksTaskIdGetRequest } from "./GetTaskTasksTaskIdGetRequest.mjs";
4
5
  export type { ListTasksTasksGetRequest } from "./ListTasksTasksGetRequest.mjs";
5
6
  export type { UpdateTaskRequest } from "./UpdateTaskRequest.mjs";
@@ -17,4 +17,10 @@ export interface BrowserSessionItemView {
17
17
  startedAt: string;
18
18
  /** Timestamp when the session was stopped (None if still active) */
19
19
  finishedAt?: string | null;
20
+ /** Amount of proxy data used in MB */
21
+ proxyUsedMb?: string;
22
+ /** Cost of proxy usage in USD */
23
+ proxyCost?: string;
24
+ /** Cost of browser session hosting in USD */
25
+ browserCost?: string;
20
26
  }
@@ -17,4 +17,10 @@ export interface BrowserSessionView {
17
17
  startedAt: string;
18
18
  /** Timestamp when the session was stopped (None if still active) */
19
19
  finishedAt?: string | null;
20
+ /** Amount of proxy data used in MB */
21
+ proxyUsedMb?: string;
22
+ /** Cost of proxy usage in USD */
23
+ proxyCost?: string;
24
+ /** Cost of browser session hosting in USD */
25
+ browserCost?: string;
20
26
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Request model for creating a custom proxy.
3
+ */
4
+ export interface CustomProxy {
5
+ /** Host of the proxy. */
6
+ host: string;
7
+ /** Port of the proxy. */
8
+ port: number;
9
+ /** Username for proxy authentication. */
10
+ username?: string | null;
11
+ /** Password for proxy authentication. */
12
+ password?: string | null;
13
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -4,4 +4,6 @@
4
4
  export interface ExecuteSkillRequest {
5
5
  /** Parameters to pass to the skill handler */
6
6
  parameters?: Record<string, unknown>;
7
+ /** Optional session ID (UUID) for IP persistence. */
8
+ sessionId?: string | null;
7
9
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Error response when user has insufficient credits
2
+ * Error response when there are insufficient credits
3
3
  */
4
4
  export interface InsufficientCreditsError {
5
5
  detail?: string;
@@ -15,4 +15,10 @@ export interface SessionItemView {
15
15
  finishedAt?: string | null;
16
16
  /** Whether tasks in this session share memory and history with each other */
17
17
  persistMemory: boolean;
18
+ /** Whether the browser session stays alive after tasks complete */
19
+ keepAlive: boolean;
20
+ /** Amount of proxy data used in MB */
21
+ proxyUsedMb?: string;
22
+ /** Cost of proxy usage in USD */
23
+ proxyCost?: string;
18
24
  }
@@ -19,4 +19,10 @@ export interface SessionView {
19
19
  publicShareUrl?: string | null;
20
20
  /** Whether tasks in this session share memory and history with each other */
21
21
  persistMemory?: boolean;
22
+ /** Whether the browser session stays alive after tasks complete */
23
+ keepAlive?: boolean;
24
+ /** Amount of proxy data used in MB */
25
+ proxyUsedMb?: string;
26
+ /** Cost of proxy usage in USD */
27
+ proxyCost?: string;
22
28
  }
@@ -0,0 +1,14 @@
1
+ import type * as BrowserUse from "../index.mjs";
2
+ /**
3
+ * Response for listing skill executions.
4
+ */
5
+ export interface SkillExecutionListResponse {
6
+ /** List of executions */
7
+ items: BrowserUse.SkillExecutionView[];
8
+ /** Total number of items in the list */
9
+ totalItems: number;
10
+ /** Page number */
11
+ pageNumber: number;
12
+ /** Number of items per page */
13
+ pageSize: number;
14
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Response containing presigned URL for downloading execution output.
3
+ */
4
+ export interface SkillExecutionOutputResponse {
5
+ /** Presigned URL for downloading the execution output (valid for 5 minutes) */
6
+ downloadUrl: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * View for a skill execution.
3
+ */
4
+ export interface SkillExecutionView {
5
+ /** Unique identifier for the execution */
6
+ id: string;
7
+ /** ID of the skill that was executed */
8
+ skillId: string;
9
+ /** Execution status (running, completed, failed) */
10
+ status: string;
11
+ /** Whether the execution succeeded */
12
+ success: boolean;
13
+ /** When the execution started */
14
+ startedAt: string;
15
+ /** When the execution finished */
16
+ finishedAt: string | null;
17
+ /** Execution latency in milliseconds */
18
+ latencyMs: number | null;
19
+ /** Whether output is available for download */
20
+ hasOutput: boolean;
21
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,5 +1,6 @@
1
1
  export declare const SupportedLlMs: {
2
2
  readonly BrowserUseLlm: "browser-use-llm";
3
+ readonly BrowserUse20: "browser-use-2.0";
3
4
  readonly Gpt41: "gpt-4.1";
4
5
  readonly Gpt41Mini: "gpt-4.1-mini";
5
6
  readonly O4Mini: "o4-mini";
@@ -7,6 +8,7 @@ export declare const SupportedLlMs: {
7
8
  readonly Gemini25Flash: "gemini-2.5-flash";
8
9
  readonly Gemini25Pro: "gemini-2.5-pro";
9
10
  readonly Gemini3ProPreview: "gemini-3-pro-preview";
11
+ readonly Gemini3FlashPreview: "gemini-3-flash-preview";
10
12
  readonly GeminiFlashLatest: "gemini-flash-latest";
11
13
  readonly GeminiFlashLiteLatest: "gemini-flash-lite-latest";
12
14
  readonly ClaudeSonnet420250514: "claude-sonnet-4-20250514";
@@ -1,6 +1,7 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
2
  export const SupportedLlMs = {
3
3
  BrowserUseLlm: "browser-use-llm",
4
+ BrowserUse20: "browser-use-2.0",
4
5
  Gpt41: "gpt-4.1",
5
6
  Gpt41Mini: "gpt-4.1-mini",
6
7
  O4Mini: "o4-mini",
@@ -8,6 +9,7 @@ export const SupportedLlMs = {
8
9
  Gemini25Flash: "gemini-2.5-flash",
9
10
  Gemini25Pro: "gemini-2.5-pro",
10
11
  Gemini3ProPreview: "gemini-3-pro-preview",
12
+ Gemini3FlashPreview: "gemini-3-flash-preview",
11
13
  GeminiFlashLatest: "gemini-flash-latest",
12
14
  GeminiFlashLiteLatest: "gemini-flash-lite-latest",
13
15
  ClaudeSonnet420250514: "claude-sonnet-4-20250514",
@@ -30,4 +30,8 @@ export interface TaskItemView {
30
30
  judgement?: string | null;
31
31
  /** Judge verdict - True if the judge found the task to be successful, False otherwise (None if judge is not enabled) */
32
32
  judgeVerdict?: boolean | null;
33
+ /** Total cost of the task in USD. This is the sum of all step costs incurred during task execution. */
34
+ cost?: string | null;
35
+ /** List of actionable suggestions for improving task configuration based on detected issues during execution. */
36
+ suggestions?: Record<string, unknown>[] | null;
33
37
  }
@@ -0,0 +1,19 @@
1
+ import type * as BrowserUse from "../index.mjs";
2
+ /**
3
+ * Lightweight view optimized for polling. Use GET /tasks/{id}/status for efficient polling
4
+ * instead of GET /tasks/{id} which loads full step details.
5
+ */
6
+ export interface TaskStatusView {
7
+ /** Unique identifier for the task */
8
+ id: string;
9
+ /** Current status of the task */
10
+ status: BrowserUse.TaskStatus;
11
+ /** Final output/result of the task (null while running) */
12
+ output?: string | null;
13
+ /** Naive UTC timestamp when the task completed (null if still running) */
14
+ finishedAt?: string | null;
15
+ /** Whether the task was successful based on the agent's self-reported output */
16
+ isSuccess?: boolean | null;
17
+ /** Total cost of the task in USD */
18
+ cost?: string | null;
19
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};