From 339c894340896f6141fa7d5397c6742e9359ae69 Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Sat, 17 May 2025 10:33:43 -0700 Subject: [PATCH] Skyvern Evaluation New Endpoint - general /runs (#2374) --- skyvern-frontend/src/api/types.ts | 39 +++- skyvern-frontend/src/components/SwitchBar.tsx | 12 +- .../src/components/icons/SearchIcon.tsx | 30 +++ .../src/components/ui/button-variants.ts | 2 + .../src/components/ui/grid-form.tsx | 60 +++++ .../src/components/ui/pagination.tsx | 5 +- skyvern-frontend/src/components/ui/search.tsx | 52 +++++ skyvern/client/__init__.py | 6 +- skyvern/client/agent/client.py | 100 ++++---- skyvern/client/browser_session/client.py | 63 ++---- skyvern/client/client.py | 8 +- skyvern/client/core/client_wrapper.py | 2 +- skyvern/client/credentials/client.py | 214 +----------------- skyvern/client/errors/__init__.py | 4 +- ...rbidden_error.py => unauthorized_error.py} | 4 +- skyvern/client/types/__init__.py | 2 - skyvern/client/types/action_block.py | 1 - .../client/types/browser_session_response.py | 17 +- skyvern/client/types/extraction_block.py | 1 - skyvern/client/types/file_download_block.py | 1 - .../types/for_loop_block_loop_blocks_item.py | 8 - skyvern/client/types/login_block.py | 1 - skyvern/client/types/navigation_block.py | 1 - skyvern/client/types/task_block.py | 1 - skyvern/client/types/task_run_request.py | 19 +- skyvern/client/types/task_run_response.py | 6 +- skyvern/client/types/totp_code.py | 78 ------- skyvern/client/types/url_block.py | 1 - skyvern/client/types/validation_block.py | 1 - .../types/workflow_definition_blocks_item.py | 8 - skyvern/client/types/workflow_run_request.py | 20 +- skyvern/client/types/workflow_run_response.py | 6 +- 32 files changed, 288 insertions(+), 485 deletions(-) create mode 100644 skyvern-frontend/src/components/icons/SearchIcon.tsx create mode 100644 skyvern-frontend/src/components/ui/grid-form.tsx create mode 100644 skyvern-frontend/src/components/ui/search.tsx rename skyvern/client/errors/{forbidden_error.py => unauthorized_error.py} (66%) delete mode 100644 skyvern/client/types/totp_code.py diff --git a/skyvern-frontend/src/api/types.ts b/skyvern-frontend/src/api/types.ts index 234af7b3..760a0817 100644 --- a/skyvern-frontend/src/api/types.ts +++ b/skyvern-frontend/src/api/types.ts @@ -236,16 +236,41 @@ export type Action = { index: number; }; +export type EvalKind = "workflow" | "task"; + +export interface Eval { + kind: EvalKind; + created_at: string; + organization_id: string; + status: Status; + title: string | null; + workflow_permanent_id: string | null; + workflow_run_id: string | null; +} + +export interface EvalWorkflow extends Eval { + kind: "workflow"; +} + +export interface EvalTask extends Eval { + kind: "task"; + task_id: string; + url: string | null; +} + +export type EvalApiResponse = EvalWorkflow[] | EvalTask[]; + export type WorkflowRunApiResponse = { + created_at: string; + failure_reason: string | null; + modified_at: string; + proxy_location: ProxyLocation | null; + status: Status; + title?: string; + webhook_callback_url: string; + workflow_id: string; workflow_permanent_id: string; workflow_run_id: string; - workflow_id: string; - status: Status; - proxy_location: ProxyLocation | null; - webhook_callback_url: string; - created_at: string; - modified_at: string; - failure_reason: string | null; workflow_title: string | null; }; diff --git a/skyvern-frontend/src/components/SwitchBar.tsx b/skyvern-frontend/src/components/SwitchBar.tsx index c24d83a6..b3c21685 100644 --- a/skyvern-frontend/src/components/SwitchBar.tsx +++ b/skyvern-frontend/src/components/SwitchBar.tsx @@ -6,21 +6,27 @@ type Option = { }; type Props = { + className?: string; options: Option[]; value: string; onChange: (value: string) => void; }; -function SwitchBar({ options, value, onChange }: Props) { +function SwitchBar({ className, options, value, onChange }: Props) { return ( -
+
{options.map((option) => { const selected = option.value === value; return (
+ + + + ); +} + +export { SearchIcon }; diff --git a/skyvern-frontend/src/components/ui/button-variants.ts b/skyvern-frontend/src/components/ui/button-variants.ts index 893451ed..f372ef87 100644 --- a/skyvern-frontend/src/components/ui/button-variants.ts +++ b/skyvern-frontend/src/components/ui/button-variants.ts @@ -9,6 +9,8 @@ const buttonVariants = cva( "bg-primary text-primary-foreground shadow hover:bg-primary/90 font-bold", destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90", + disabled: + "hover:bg-accent hover:text-accent-foreground opacity-50 pointer-events-none", outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground", secondary: diff --git a/skyvern-frontend/src/components/ui/grid-form.tsx b/skyvern-frontend/src/components/ui/grid-form.tsx new file mode 100644 index 00000000..068254c8 --- /dev/null +++ b/skyvern-frontend/src/components/ui/grid-form.tsx @@ -0,0 +1,60 @@ +import React, { useMemo, useId } from "react"; + +type Breakpoints = Record; // { columns: minWidth } + +type GridFormProps = { + breakpoints: Breakpoints; + className?: string; + children: React.ReactNode; +}; + +/** + * GridForm is a layout component that wraps its children in a CSS grid. + * Pass the breakpoints prop as an object mapping columns to min viewport width. + * + * Example usage: + * + * + * + * + */ +export const GridForm: React.FC = ({ + breakpoints, + className = "", + children, +}) => { + // Generate a unique className for this instance + const uniqueClass = `grid-form-${useId().replace(/:/g, "-")}`; + + // Generate CSS for breakpoints + const styleTag = useMemo(() => { + // Sort breakpoints by minWidth ascending + const sorted = Object.entries(breakpoints) + .map( + ([cols, minWidth]) => + [parseInt(cols, 10), minWidth] as [number, number], + ) + .sort((a, b) => a[1] - b[1]); + let css = `.${uniqueClass} { display: grid; gap: 1rem; }\n`; + for (const [cols, minWidth] of sorted) { + css += `@media (min-width: ${minWidth}px) { .${uniqueClass} { grid-template-columns: repeat(${cols}, minmax(0, 1fr)); } }\n`; + } + // Default to the smallest breakpoint (first one) + if (sorted.length > 0 && sorted[0]) { + const [firstCols, firstMinWidth] = sorted[0]; + css += `@media (max-width: ${firstMinWidth}px) { .${uniqueClass} { grid-template-columns: repeat(${firstCols}, minmax(0, 1fr)); } }\n`; + } + return ; + }, [breakpoints, uniqueClass]); + + return ( + <> + {styleTag} +
{children}
+ + ); +}; + +GridForm.displayName = "GridForm"; + +export default GridForm; diff --git a/skyvern-frontend/src/components/ui/pagination.tsx b/skyvern-frontend/src/components/ui/pagination.tsx index 99f2a144..94c97ce4 100644 --- a/skyvern-frontend/src/components/ui/pagination.tsx +++ b/skyvern-frontend/src/components/ui/pagination.tsx @@ -41,12 +41,14 @@ PaginationItem.displayName = "PaginationItem"; type PaginationLinkProps = { isActive?: boolean; + isDisabled?: boolean; } & Pick & React.ComponentProps<"a">; const PaginationLink = ({ className, isActive, + isDisabled, size = "icon", ...props }: PaginationLinkProps) => ( @@ -54,10 +56,11 @@ const PaginationLink = ({ aria-current={isActive ? "page" : undefined} className={cn( buttonVariants({ - variant: isActive ? "outline" : "ghost", + variant: isDisabled ? "disabled" : isActive ? "outline" : "ghost", size, }), className, + "cursor-pointer select-none", )} {...props} /> diff --git a/skyvern-frontend/src/components/ui/search.tsx b/skyvern-frontend/src/components/ui/search.tsx new file mode 100644 index 00000000..891218b1 --- /dev/null +++ b/skyvern-frontend/src/components/ui/search.tsx @@ -0,0 +1,52 @@ +import * as React from "react"; +import { Input } from "./input"; +import { SearchIcon } from "../icons/SearchIcon"; +import { cn } from "@/util/utils"; + +interface SearchProps extends React.InputHTMLAttributes { + value: string; + onChange: (e: React.ChangeEvent) => void; + placeholder?: string; + className?: string; + label?: string; +} + +export const Search = React.forwardRef( + ( + { + value, + onChange, + placeholder = "Search...", + className, + label = "Search", + ...props + }, + ref, + ) => { + return ( +
+ + + + + +
+ ); + }, +); +Search.displayName = "Search"; + +export default Search; diff --git a/skyvern/client/__init__.py b/skyvern/client/__init__.py index 07638544..974397e8 100644 --- a/skyvern/client/__init__.py +++ b/skyvern/client/__init__.py @@ -159,7 +159,6 @@ from .types import ( TextPromptBlockParametersItem_Credential, TextPromptBlockParametersItem_Output, TextPromptBlockParametersItem_Workflow, - TotpCode, UploadToS3Block, UrlBlock, UrlBlockDataSchema, @@ -234,7 +233,7 @@ from .types import ( WorkflowRunResponseOutput, WorkflowStatus, ) -from .errors import BadRequestError, ForbiddenError, NotFoundError, UnprocessableEntityError +from .errors import BadRequestError, NotFoundError, UnauthorizedError, UnprocessableEntityError from . import agent, browser_session, credentials from .agent import ( AgentGetRunResponse, @@ -359,7 +358,6 @@ __all__ = [ "ForLoopBlockLoopOver_Credential", "ForLoopBlockLoopOver_Output", "ForLoopBlockLoopOver_Workflow", - "ForbiddenError", "HttpValidationError", "LoginBlock", "LoginBlockDataSchema", @@ -421,7 +419,7 @@ __all__ = [ "TextPromptBlockParametersItem_Credential", "TextPromptBlockParametersItem_Output", "TextPromptBlockParametersItem_Workflow", - "TotpCode", + "UnauthorizedError", "UnprocessableEntityError", "UploadToS3Block", "UrlBlock", diff --git a/skyvern/client/agent/client.py b/skyvern/client/agent/client.py index a6c660c1..45c7a316 100644 --- a/skyvern/client/agent/client.py +++ b/skyvern/client/agent/client.py @@ -54,7 +54,7 @@ class AgentClient: authorization="YOUR_AUTHORIZATION", ) client.agent.get_run( - run_id="tsk_123", + run_id="run_id", ) """ _response = self._client_wrapper.httpx_client.request( @@ -156,7 +156,6 @@ class AgentClient: Parameters ---------- workflow_id : str - The ID of the workflow to update. Workflow ID starts with `wpid_`. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -175,7 +174,7 @@ class AgentClient: authorization="YOUR_AUTHORIZATION", ) client.agent.update_workflow( - workflow_id="wpid_123", + workflow_id="workflow_id", ) """ _response = self._client_wrapper.httpx_client.request( @@ -216,7 +215,6 @@ class AgentClient: Parameters ---------- workflow_id : str - The ID of the workflow to delete. Workflow ID starts with `wpid_`. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -235,7 +233,7 @@ class AgentClient: authorization="YOUR_AUTHORIZATION", ) client.agent.delete_workflow( - workflow_id="wpid_123", + workflow_id="workflow_id", ) """ _response = self._client_wrapper.httpx_client.request( @@ -273,8 +271,8 @@ class AgentClient: prompt: str, user_agent: typing.Optional[str] = None, url: typing.Optional[str] = OMIT, - engine: typing.Optional[RunEngine] = OMIT, title: typing.Optional[str] = OMIT, + engine: typing.Optional[RunEngine] = OMIT, proxy_location: typing.Optional[ProxyLocation] = OMIT, data_extraction_schema: typing.Optional[TaskRunRequestDataExtractionSchema] = OMIT, error_code_mapping: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, @@ -284,7 +282,6 @@ class AgentClient: totp_url: typing.Optional[str] = OMIT, browser_session_id: typing.Optional[str] = OMIT, publish_workflow: typing.Optional[bool] = OMIT, - include_action_history_in_verification: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> TaskRunResponse: """ @@ -300,11 +297,11 @@ class AgentClient: url : typing.Optional[str] The starting URL for the task. If not provided, Skyvern will attempt to determine an appropriate URL - engine : typing.Optional[RunEngine] - The Skyvern engine version to use for this task. The default value is skyvern-2.0. - title : typing.Optional[str] - The title for the task + Optional title for the task + + engine : typing.Optional[RunEngine] + The Skyvern engine version to use for this task proxy_location : typing.Optional[ProxyLocation] Geographic Proxy location to route the browser traffic through @@ -331,10 +328,7 @@ class AgentClient: ID of an existing browser session to reuse, having it continue from the current screen state publish_workflow : typing.Optional[bool] - Whether to publish this task as a reusable workflow. Only available for skyvern-2.0. - - include_action_history_in_verification : typing.Optional[bool] - Whether to include action history when verifying that the task is complete + Whether to publish this task as a reusable workflow. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -352,7 +346,7 @@ class AgentClient: api_key="YOUR_API_KEY", authorization="YOUR_AUTHORIZATION", ) - client.agent.run_task( + await client.agent.run_task( prompt="prompt", ) """ @@ -362,8 +356,8 @@ class AgentClient: json={ "prompt": prompt, "url": url, - "engine": engine, "title": title, + "engine": engine, "proxy_location": proxy_location, "data_extraction_schema": convert_and_respect_annotation_metadata( object_=data_extraction_schema, annotation=TaskRunRequestDataExtractionSchema, direction="write" @@ -375,7 +369,6 @@ class AgentClient: "totp_url": totp_url, "browser_session_id": browser_session_id, "publish_workflow": publish_workflow, - "include_action_history_in_verification": include_action_history_in_verification, }, headers={ "x-user-agent": str(user_agent) if user_agent is not None else None, @@ -424,8 +417,8 @@ class AgentClient: template: typing.Optional[bool] = None, max_steps_override: typing.Optional[int] = None, user_agent: typing.Optional[str] = None, - parameters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, title: typing.Optional[str] = OMIT, + parameters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, proxy_location: typing.Optional[ProxyLocation] = OMIT, webhook_url: typing.Optional[str] = OMIT, totp_url: typing.Optional[str] = OMIT, @@ -439,7 +432,7 @@ class AgentClient: Parameters ---------- workflow_id : str - ID of the workflow to run. Workflow ID starts with `wpid_`. + ID of the workflow to run template : typing.Optional[bool] @@ -447,26 +440,26 @@ class AgentClient: user_agent : typing.Optional[str] + title : typing.Optional[str] + Optional title for this workflow run + parameters : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] Parameters to pass to the workflow - title : typing.Optional[str] - The title for this workflow run - proxy_location : typing.Optional[ProxyLocation] Location of proxy to use for this workflow run webhook_url : typing.Optional[str] - URL to send workflow status updates to after a run is finished. Refer to https://docs.skyvern.com/running-tasks/webhooks-faq for webhook questions. + URL to send workflow status updates to after a run is finished totp_url : typing.Optional[str] - URL that serves TOTP/2FA/MFA codes for Skyvern to use during the workflow run. Refer to https://docs.skyvern.com/running-tasks/advanced-features#get-code-from-your-endpoint + URL for TOTP authentication setup if Skyvern should be polling endpoint for 2FA codes totp_identifier : typing.Optional[str] - Identifier for the TOTP/2FA/MFA code when the code is pushed to Skyvern. Refer to https://docs.skyvern.com/running-tasks/advanced-features#time-based-one-time-password-totp + Identifier for TOTP (Time-based One-Time Password) authentication if codes are being pushed to Skyvern browser_session_id : typing.Optional[str] - ID of a Skyvern browser session to reuse, having it continue from the current screen state + ID of an existing browser session to reuse, having it continue from the current screen state request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -485,7 +478,7 @@ class AgentClient: authorization="YOUR_AUTHORIZATION", ) client.agent.run_workflow( - workflow_id="wpid_123", + workflow_id="workflow_id", ) """ _response = self._client_wrapper.httpx_client.request( @@ -496,8 +489,8 @@ class AgentClient: }, json={ "workflow_id": workflow_id, - "parameters": parameters, "title": title, + "parameters": parameters, "proxy_location": proxy_location, "webhook_url": webhook_url, "totp_url": totp_url, @@ -643,7 +636,7 @@ class AsyncAgentClient: async def main() -> None: await client.agent.get_run( - run_id="tsk_123", + run_id="run_id", ) @@ -758,7 +751,6 @@ class AsyncAgentClient: Parameters ---------- workflow_id : str - The ID of the workflow to update. Workflow ID starts with `wpid_`. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -782,7 +774,7 @@ class AsyncAgentClient: async def main() -> None: await client.agent.update_workflow( - workflow_id="wpid_123", + workflow_id="workflow_id", ) @@ -826,7 +818,6 @@ class AsyncAgentClient: Parameters ---------- workflow_id : str - The ID of the workflow to delete. Workflow ID starts with `wpid_`. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -850,7 +841,7 @@ class AsyncAgentClient: async def main() -> None: await client.agent.delete_workflow( - workflow_id="wpid_123", + workflow_id="workflow_id", ) @@ -891,8 +882,8 @@ class AsyncAgentClient: prompt: str, user_agent: typing.Optional[str] = None, url: typing.Optional[str] = OMIT, - engine: typing.Optional[RunEngine] = OMIT, title: typing.Optional[str] = OMIT, + engine: typing.Optional[RunEngine] = OMIT, proxy_location: typing.Optional[ProxyLocation] = OMIT, data_extraction_schema: typing.Optional[TaskRunRequestDataExtractionSchema] = OMIT, error_code_mapping: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, @@ -902,7 +893,6 @@ class AsyncAgentClient: totp_url: typing.Optional[str] = OMIT, browser_session_id: typing.Optional[str] = OMIT, publish_workflow: typing.Optional[bool] = OMIT, - include_action_history_in_verification: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> TaskRunResponse: """ @@ -918,11 +908,11 @@ class AsyncAgentClient: url : typing.Optional[str] The starting URL for the task. If not provided, Skyvern will attempt to determine an appropriate URL - engine : typing.Optional[RunEngine] - The Skyvern engine version to use for this task. The default value is skyvern-2.0. - title : typing.Optional[str] - The title for the task + Optional title for the task + + engine : typing.Optional[RunEngine] + The Skyvern engine version to use for this task proxy_location : typing.Optional[ProxyLocation] Geographic Proxy location to route the browser traffic through @@ -949,10 +939,7 @@ class AsyncAgentClient: ID of an existing browser session to reuse, having it continue from the current screen state publish_workflow : typing.Optional[bool] - Whether to publish this task as a reusable workflow. Only available for skyvern-2.0. - - include_action_history_in_verification : typing.Optional[bool] - Whether to include action history when verifying that the task is complete + Whether to publish this task as a reusable workflow. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -988,8 +975,8 @@ class AsyncAgentClient: json={ "prompt": prompt, "url": url, - "engine": engine, "title": title, + "engine": engine, "proxy_location": proxy_location, "data_extraction_schema": convert_and_respect_annotation_metadata( object_=data_extraction_schema, annotation=TaskRunRequestDataExtractionSchema, direction="write" @@ -1001,7 +988,6 @@ class AsyncAgentClient: "totp_url": totp_url, "browser_session_id": browser_session_id, "publish_workflow": publish_workflow, - "include_action_history_in_verification": include_action_history_in_verification, }, headers={ "x-user-agent": str(user_agent) if user_agent is not None else None, @@ -1050,8 +1036,8 @@ class AsyncAgentClient: template: typing.Optional[bool] = None, max_steps_override: typing.Optional[int] = None, user_agent: typing.Optional[str] = None, - parameters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, title: typing.Optional[str] = OMIT, + parameters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, proxy_location: typing.Optional[ProxyLocation] = OMIT, webhook_url: typing.Optional[str] = OMIT, totp_url: typing.Optional[str] = OMIT, @@ -1065,7 +1051,7 @@ class AsyncAgentClient: Parameters ---------- workflow_id : str - ID of the workflow to run. Workflow ID starts with `wpid_`. + ID of the workflow to run template : typing.Optional[bool] @@ -1073,26 +1059,26 @@ class AsyncAgentClient: user_agent : typing.Optional[str] + title : typing.Optional[str] + Optional title for this workflow run + parameters : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] Parameters to pass to the workflow - title : typing.Optional[str] - The title for this workflow run - proxy_location : typing.Optional[ProxyLocation] Location of proxy to use for this workflow run webhook_url : typing.Optional[str] - URL to send workflow status updates to after a run is finished. Refer to https://docs.skyvern.com/running-tasks/webhooks-faq for webhook questions. + URL to send workflow status updates to after a run is finished totp_url : typing.Optional[str] - URL that serves TOTP/2FA/MFA codes for Skyvern to use during the workflow run. Refer to https://docs.skyvern.com/running-tasks/advanced-features#get-code-from-your-endpoint + URL for TOTP authentication setup if Skyvern should be polling endpoint for 2FA codes totp_identifier : typing.Optional[str] - Identifier for the TOTP/2FA/MFA code when the code is pushed to Skyvern. Refer to https://docs.skyvern.com/running-tasks/advanced-features#time-based-one-time-password-totp + Identifier for TOTP (Time-based One-Time Password) authentication if codes are being pushed to Skyvern browser_session_id : typing.Optional[str] - ID of a Skyvern browser session to reuse, having it continue from the current screen state + ID of an existing browser session to reuse, having it continue from the current screen state request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1116,7 +1102,7 @@ class AsyncAgentClient: async def main() -> None: await client.agent.run_workflow( - workflow_id="wpid_123", + workflow_id="workflow_id", ) @@ -1130,8 +1116,8 @@ class AsyncAgentClient: }, json={ "workflow_id": workflow_id, - "parameters": parameters, "title": title, + "parameters": parameters, "proxy_location": proxy_location, "webhook_url": webhook_url, "totp_url": totp_url, diff --git a/skyvern/client/browser_session/client.py b/skyvern/client/browser_session/client.py index a52544d4..b81a7b09 100644 --- a/skyvern/client/browser_session/client.py +++ b/skyvern/client/browser_session/client.py @@ -1,21 +1,18 @@ # This file was auto-generated by Fern from our API Definition. -import typing from ..core.client_wrapper import SyncClientWrapper +import typing from ..core.request_options import RequestOptions from ..types.browser_session_response import BrowserSessionResponse from ..core.jsonable_encoder import jsonable_encoder from ..core.pydantic_utilities import parse_obj_as -from ..errors.forbidden_error import ForbiddenError +from ..errors.unauthorized_error import UnauthorizedError from ..errors.not_found_error import NotFoundError from ..errors.unprocessable_entity_error import UnprocessableEntityError from json.decoder import JSONDecodeError from ..core.api_error import ApiError from ..core.client_wrapper import AsyncClientWrapper -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - class BrowserSessionClient: def __init__(self, *, client_wrapper: SyncClientWrapper): @@ -65,8 +62,8 @@ class BrowserSessionClient: object_=_response.json(), ), ) - if _response.status_code == 403: - raise ForbiddenError( + if _response.status_code == 401: + raise UnauthorizedError( typing.cast( typing.Optional[typing.Any], parse_obj_as( @@ -140,8 +137,8 @@ class BrowserSessionClient: object_=_response.json(), ), ) - if _response.status_code == 403: - raise ForbiddenError( + if _response.status_code == 401: + raise UnauthorizedError( typing.cast( typing.Optional[typing.Any], parse_obj_as( @@ -166,16 +163,13 @@ class BrowserSessionClient: raise ApiError(status_code=_response.status_code, body=_response_json) def create_browser_session( - self, *, timeout: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None + self, *, request_options: typing.Optional[RequestOptions] = None ) -> BrowserSessionResponse: """ Create a new browser session Parameters ---------- - timeout : typing.Optional[int] - Timeout in minutes for the session. Timeout is applied after the session is started. Must be between 5 and 10080. Defaults to 60. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -197,14 +191,7 @@ class BrowserSessionClient: _response = self._client_wrapper.httpx_client.request( "v1/browser_sessions", method="POST", - json={ - "timeout": timeout, - }, - headers={ - "content-type": "application/json", - }, request_options=request_options, - omit=OMIT, ) try: if 200 <= _response.status_code < 300: @@ -215,8 +202,8 @@ class BrowserSessionClient: object_=_response.json(), ), ) - if _response.status_code == 403: - raise ForbiddenError( + if _response.status_code == 401: + raise UnauthorizedError( typing.cast( typing.Optional[typing.Any], parse_obj_as( @@ -284,8 +271,8 @@ class BrowserSessionClient: object_=_response.json(), ), ) - if _response.status_code == 403: - raise ForbiddenError( + if _response.status_code == 401: + raise UnauthorizedError( typing.cast( typing.Optional[typing.Any], parse_obj_as( @@ -366,8 +353,8 @@ class AsyncBrowserSessionClient: object_=_response.json(), ), ) - if _response.status_code == 403: - raise ForbiddenError( + if _response.status_code == 401: + raise UnauthorizedError( typing.cast( typing.Optional[typing.Any], parse_obj_as( @@ -449,8 +436,8 @@ class AsyncBrowserSessionClient: object_=_response.json(), ), ) - if _response.status_code == 403: - raise ForbiddenError( + if _response.status_code == 401: + raise UnauthorizedError( typing.cast( typing.Optional[typing.Any], parse_obj_as( @@ -475,16 +462,13 @@ class AsyncBrowserSessionClient: raise ApiError(status_code=_response.status_code, body=_response_json) async def create_browser_session( - self, *, timeout: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None + self, *, request_options: typing.Optional[RequestOptions] = None ) -> BrowserSessionResponse: """ Create a new browser session Parameters ---------- - timeout : typing.Optional[int] - Timeout in minutes for the session. Timeout is applied after the session is started. Must be between 5 and 10080. Defaults to 60. - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -514,14 +498,7 @@ class AsyncBrowserSessionClient: _response = await self._client_wrapper.httpx_client.request( "v1/browser_sessions", method="POST", - json={ - "timeout": timeout, - }, - headers={ - "content-type": "application/json", - }, request_options=request_options, - omit=OMIT, ) try: if 200 <= _response.status_code < 300: @@ -532,8 +509,8 @@ class AsyncBrowserSessionClient: object_=_response.json(), ), ) - if _response.status_code == 403: - raise ForbiddenError( + if _response.status_code == 401: + raise UnauthorizedError( typing.cast( typing.Optional[typing.Any], parse_obj_as( @@ -609,8 +586,8 @@ class AsyncBrowserSessionClient: object_=_response.json(), ), ) - if _response.status_code == 403: - raise ForbiddenError( + if _response.status_code == 401: + raise UnauthorizedError( typing.cast( typing.Optional[typing.Any], parse_obj_as( diff --git a/skyvern/client/client.py b/skyvern/client/client.py index 469f8239..68656e6f 100644 --- a/skyvern/client/client.py +++ b/skyvern/client/client.py @@ -5,12 +5,12 @@ from .environment import SkyvernEnvironment import httpx from .core.client_wrapper import SyncClientWrapper from .agent.client import AgentClient -from .browser_session.client import BrowserSessionClient from .credentials.client import CredentialsClient +from .browser_session.client import BrowserSessionClient from .core.client_wrapper import AsyncClientWrapper from .agent.client import AsyncAgentClient -from .browser_session.client import AsyncBrowserSessionClient from .credentials.client import AsyncCredentialsClient +from .browser_session.client import AsyncBrowserSessionClient class Skyvern: @@ -76,8 +76,8 @@ class Skyvern: timeout=_defaulted_timeout, ) self.agent = AgentClient(client_wrapper=self._client_wrapper) - self.browser_session = BrowserSessionClient(client_wrapper=self._client_wrapper) self.credentials = CredentialsClient(client_wrapper=self._client_wrapper) + self.browser_session = BrowserSessionClient(client_wrapper=self._client_wrapper) class AsyncSkyvern: @@ -143,8 +143,8 @@ class AsyncSkyvern: timeout=_defaulted_timeout, ) self.agent = AsyncAgentClient(client_wrapper=self._client_wrapper) - self.browser_session = AsyncBrowserSessionClient(client_wrapper=self._client_wrapper) self.credentials = AsyncCredentialsClient(client_wrapper=self._client_wrapper) + self.browser_session = AsyncBrowserSessionClient(client_wrapper=self._client_wrapper) def _get_base_url(*, base_url: typing.Optional[str] = None, environment: SkyvernEnvironment) -> str: diff --git a/skyvern/client/core/client_wrapper.py b/skyvern/client/core/client_wrapper.py index 8471a644..8efb8790 100644 --- a/skyvern/client/core/client_wrapper.py +++ b/skyvern/client/core/client_wrapper.py @@ -24,7 +24,7 @@ class BaseClientWrapper: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "skyvern", - "X-Fern-SDK-Version": "0.1.83", + "X-Fern-SDK-Version": "0.1.82", } if self._api_key is not None: headers["x-api-key"] = self._api_key diff --git a/skyvern/client/credentials/client.py b/skyvern/client/credentials/client.py index 0747482b..1357caaf 100644 --- a/skyvern/client/credentials/client.py +++ b/skyvern/client/credentials/client.py @@ -2,14 +2,12 @@ import typing from ..core.client_wrapper import SyncClientWrapper -import datetime as dt from ..core.request_options import RequestOptions -from ..types.totp_code import TotpCode +from ..types.credential_response import CredentialResponse from ..core.pydantic_utilities import parse_obj_as from ..errors.unprocessable_entity_error import UnprocessableEntityError from json.decoder import JSONDecodeError from ..core.api_error import ApiError -from ..types.credential_response import CredentialResponse from ..types.credential_type import CredentialType from .types.create_credential_request_credential import CreateCredentialRequestCredential from ..core.serialization import convert_and_respect_annotation_metadata @@ -24,107 +22,6 @@ class CredentialsClient: def __init__(self, *, client_wrapper: SyncClientWrapper): self._client_wrapper = client_wrapper - def send_totp_code( - self, - *, - totp_identifier: str, - content: str, - task_id: typing.Optional[str] = OMIT, - workflow_id: typing.Optional[str] = OMIT, - workflow_run_id: typing.Optional[str] = OMIT, - source: typing.Optional[str] = OMIT, - expired_at: typing.Optional[dt.datetime] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> TotpCode: - """ - Forward a TOTP (2FA, MFA) code to Skyvern - - Parameters - ---------- - totp_identifier : str - The identifier of the TOTP code. It can be the email address, phone number, or the identifier of the user. - - content : str - The content of the TOTP code. It can be the email content that contains the TOTP code, or the sms message that contains the TOTP code. Skyvern will automatically extract the TOTP code from the content. - - task_id : typing.Optional[str] - The task_id the totp code is for. It can be the task_id of the task that the TOTP code is for. - - workflow_id : typing.Optional[str] - The workflow ID the TOTP code is for. It can be the workflow ID of the workflow that the TOTP code is for. - - workflow_run_id : typing.Optional[str] - The workflow run id that the TOTP code is for. It can be the workflow run id of the workflow run that the TOTP code is for. - - source : typing.Optional[str] - An optional field. The source of the TOTP code. e.g. email, sms, etc. - - expired_at : typing.Optional[dt.datetime] - The timestamp when the TOTP code expires - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - TotpCode - Successful Response - - Examples - -------- - from skyvern import Skyvern - - client = Skyvern( - api_key="YOUR_API_KEY", - authorization="YOUR_AUTHORIZATION", - ) - client.credentials.send_totp_code( - totp_identifier="john.doe@example.com", - content="Hello, your verification code is 123456", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "v1/credentials/totp", - method="POST", - json={ - "totp_identifier": totp_identifier, - "task_id": task_id, - "workflow_id": workflow_id, - "workflow_run_id": workflow_run_id, - "source": source, - "content": content, - "expired_at": expired_at, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - return typing.cast( - TotpCode, - parse_obj_as( - type_=TotpCode, # type: ignore - object_=_response.json(), - ), - ) - if _response.status_code == 422: - raise UnprocessableEntityError( - typing.cast( - typing.Optional[typing.Any], - parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore - object_=_response.json(), - ), - ) - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - def get_credentials( self, *, @@ -398,115 +295,6 @@ class AsyncCredentialsClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): self._client_wrapper = client_wrapper - async def send_totp_code( - self, - *, - totp_identifier: str, - content: str, - task_id: typing.Optional[str] = OMIT, - workflow_id: typing.Optional[str] = OMIT, - workflow_run_id: typing.Optional[str] = OMIT, - source: typing.Optional[str] = OMIT, - expired_at: typing.Optional[dt.datetime] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> TotpCode: - """ - Forward a TOTP (2FA, MFA) code to Skyvern - - Parameters - ---------- - totp_identifier : str - The identifier of the TOTP code. It can be the email address, phone number, or the identifier of the user. - - content : str - The content of the TOTP code. It can be the email content that contains the TOTP code, or the sms message that contains the TOTP code. Skyvern will automatically extract the TOTP code from the content. - - task_id : typing.Optional[str] - The task_id the totp code is for. It can be the task_id of the task that the TOTP code is for. - - workflow_id : typing.Optional[str] - The workflow ID the TOTP code is for. It can be the workflow ID of the workflow that the TOTP code is for. - - workflow_run_id : typing.Optional[str] - The workflow run id that the TOTP code is for. It can be the workflow run id of the workflow run that the TOTP code is for. - - source : typing.Optional[str] - An optional field. The source of the TOTP code. e.g. email, sms, etc. - - expired_at : typing.Optional[dt.datetime] - The timestamp when the TOTP code expires - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - TotpCode - Successful Response - - Examples - -------- - import asyncio - - from skyvern import AsyncSkyvern - - client = AsyncSkyvern( - api_key="YOUR_API_KEY", - authorization="YOUR_AUTHORIZATION", - ) - - - async def main() -> None: - await client.credentials.send_totp_code( - totp_identifier="john.doe@example.com", - content="Hello, your verification code is 123456", - ) - - - asyncio.run(main()) - """ - _response = await self._client_wrapper.httpx_client.request( - "v1/credentials/totp", - method="POST", - json={ - "totp_identifier": totp_identifier, - "task_id": task_id, - "workflow_id": workflow_id, - "workflow_run_id": workflow_run_id, - "source": source, - "content": content, - "expired_at": expired_at, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - return typing.cast( - TotpCode, - parse_obj_as( - type_=TotpCode, # type: ignore - object_=_response.json(), - ), - ) - if _response.status_code == 422: - raise UnprocessableEntityError( - typing.cast( - typing.Optional[typing.Any], - parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore - object_=_response.json(), - ), - ) - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - async def get_credentials( self, *, diff --git a/skyvern/client/errors/__init__.py b/skyvern/client/errors/__init__.py index 2511a0e6..abc026cc 100644 --- a/skyvern/client/errors/__init__.py +++ b/skyvern/client/errors/__init__.py @@ -1,8 +1,8 @@ # This file was auto-generated by Fern from our API Definition. from .bad_request_error import BadRequestError -from .forbidden_error import ForbiddenError from .not_found_error import NotFoundError +from .unauthorized_error import UnauthorizedError from .unprocessable_entity_error import UnprocessableEntityError -__all__ = ["BadRequestError", "ForbiddenError", "NotFoundError", "UnprocessableEntityError"] +__all__ = ["BadRequestError", "NotFoundError", "UnauthorizedError", "UnprocessableEntityError"] diff --git a/skyvern/client/errors/forbidden_error.py b/skyvern/client/errors/unauthorized_error.py similarity index 66% rename from skyvern/client/errors/forbidden_error.py rename to skyvern/client/errors/unauthorized_error.py index d17eb4b9..1c00f98a 100644 --- a/skyvern/client/errors/forbidden_error.py +++ b/skyvern/client/errors/unauthorized_error.py @@ -4,6 +4,6 @@ from ..core.api_error import ApiError import typing -class ForbiddenError(ApiError): +class UnauthorizedError(ApiError): def __init__(self, body: typing.Optional[typing.Any]): - super().__init__(status_code=403, body=body) + super().__init__(status_code=401, body=body) diff --git a/skyvern/client/types/__init__.py b/skyvern/client/types/__init__.py index 3239bf68..73daa766 100644 --- a/skyvern/client/types/__init__.py +++ b/skyvern/client/types/__init__.py @@ -180,7 +180,6 @@ from .text_prompt_block_parameters_item import ( TextPromptBlockParametersItem_Output, TextPromptBlockParametersItem_Workflow, ) -from .totp_code import TotpCode from .upload_to_s3block import UploadToS3Block from .url_block import UrlBlock from .url_block_data_schema import UrlBlockDataSchema @@ -424,7 +423,6 @@ __all__ = [ "TextPromptBlockParametersItem_Credential", "TextPromptBlockParametersItem_Output", "TextPromptBlockParametersItem_Workflow", - "TotpCode", "UploadToS3Block", "UrlBlock", "UrlBlockDataSchema", diff --git a/skyvern/client/types/action_block.py b/skyvern/client/types/action_block.py index 9eff2723..12dcabc0 100644 --- a/skyvern/client/types/action_block.py +++ b/skyvern/client/types/action_block.py @@ -34,7 +34,6 @@ class ActionBlock(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/skyvern/client/types/browser_session_response.py b/skyvern/client/types/browser_session_response.py index 36e6fccc..710459ea 100644 --- a/skyvern/client/types/browser_session_response.py +++ b/skyvern/client/types/browser_session_response.py @@ -32,24 +32,9 @@ class BrowserSessionResponse(UniversalBaseModel): ID of the associated runnable """ - timeout: typing.Optional[int] = pydantic.Field(default=None) - """ - Timeout in minutes for the session. Timeout is applied after the session is started. - """ - - started_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) - """ - Timestamp when the session was started - """ - - completed_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) - """ - Timestamp when the session was completed - """ - created_at: dt.datetime = pydantic.Field() """ - Timestamp when the session was created (the timestamp for the initial request) + Timestamp when the session was created """ modified_at: dt.datetime = pydantic.Field() diff --git a/skyvern/client/types/extraction_block.py b/skyvern/client/types/extraction_block.py index 2de9d8bb..be41d975 100644 --- a/skyvern/client/types/extraction_block.py +++ b/skyvern/client/types/extraction_block.py @@ -34,7 +34,6 @@ class ExtractionBlock(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/skyvern/client/types/file_download_block.py b/skyvern/client/types/file_download_block.py index d67fece6..e17de0cc 100644 --- a/skyvern/client/types/file_download_block.py +++ b/skyvern/client/types/file_download_block.py @@ -34,7 +34,6 @@ class FileDownloadBlock(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/skyvern/client/types/for_loop_block_loop_blocks_item.py b/skyvern/client/types/for_loop_block_loop_blocks_item.py index b4599a81..106c624d 100644 --- a/skyvern/client/types/for_loop_block_loop_blocks_item.py +++ b/skyvern/client/types/for_loop_block_loop_blocks_item.py @@ -60,7 +60,6 @@ class ForLoopBlockLoopBlocksItem_Action(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -131,7 +130,6 @@ class ForLoopBlockLoopBlocksItem_Extraction(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -167,7 +165,6 @@ class ForLoopBlockLoopBlocksItem_FileDownload(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -266,7 +263,6 @@ class ForLoopBlockLoopBlocksItem_GotoUrl(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -302,7 +298,6 @@ class ForLoopBlockLoopBlocksItem_Login(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -338,7 +333,6 @@ class ForLoopBlockLoopBlocksItem_Navigation(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -417,7 +411,6 @@ class ForLoopBlockLoopBlocksItem_Task(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -512,7 +505,6 @@ class ForLoopBlockLoopBlocksItem_Validation(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/skyvern/client/types/login_block.py b/skyvern/client/types/login_block.py index 0c043e2a..b281fc4f 100644 --- a/skyvern/client/types/login_block.py +++ b/skyvern/client/types/login_block.py @@ -34,7 +34,6 @@ class LoginBlock(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/skyvern/client/types/navigation_block.py b/skyvern/client/types/navigation_block.py index 0bcc96a3..bec5d1cf 100644 --- a/skyvern/client/types/navigation_block.py +++ b/skyvern/client/types/navigation_block.py @@ -34,7 +34,6 @@ class NavigationBlock(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/skyvern/client/types/task_block.py b/skyvern/client/types/task_block.py index c914e2ce..3c7050b4 100644 --- a/skyvern/client/types/task_block.py +++ b/skyvern/client/types/task_block.py @@ -34,7 +34,6 @@ class TaskBlock(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/skyvern/client/types/task_run_request.py b/skyvern/client/types/task_run_request.py index 74b89c80..fade92ff 100644 --- a/skyvern/client/types/task_run_request.py +++ b/skyvern/client/types/task_run_request.py @@ -20,14 +20,14 @@ class TaskRunRequest(UniversalBaseModel): The starting URL for the task. If not provided, Skyvern will attempt to determine an appropriate URL """ - engine: typing.Optional[RunEngine] = pydantic.Field(default=None) - """ - The Skyvern engine version to use for this task. The default value is skyvern-2.0. - """ - title: typing.Optional[str] = pydantic.Field(default=None) """ - The title for the task + Optional title for the task + """ + + engine: typing.Optional[RunEngine] = pydantic.Field(default=None) + """ + The Skyvern engine version to use for this task """ proxy_location: typing.Optional[ProxyLocation] = pydantic.Field(default=None) @@ -72,12 +72,7 @@ class TaskRunRequest(UniversalBaseModel): publish_workflow: typing.Optional[bool] = pydantic.Field(default=None) """ - Whether to publish this task as a reusable workflow. Only available for skyvern-2.0. - """ - - include_action_history_in_verification: typing.Optional[bool] = pydantic.Field(default=None) - """ - Whether to include action history when verifying that the task is complete + Whether to publish this task as a reusable workflow. """ if IS_PYDANTIC_V2: diff --git a/skyvern/client/types/task_run_response.py b/skyvern/client/types/task_run_response.py index 684a041b..c05c07f3 100644 --- a/skyvern/client/types/task_run_response.py +++ b/skyvern/client/types/task_run_response.py @@ -14,7 +14,7 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2 class TaskRunResponse(UniversalBaseModel): run_id: str = pydantic.Field() """ - Unique identifier for this run. Run ID starts with `tsk_` for task runs and `wr_` for workflow runs. + Unique identifier for this run """ status: RunStatus = pydantic.Field() @@ -24,7 +24,7 @@ class TaskRunResponse(UniversalBaseModel): output: typing.Optional[TaskRunResponseOutput] = pydantic.Field(default=None) """ - Output data from the run, if any. Format/schema depends on the data extracted by the run. + Output data from the run, if any. Format depends on the schema in the input """ downloaded_files: typing.Optional[typing.List[FileInfo]] = pydantic.Field(default=None) @@ -39,7 +39,7 @@ class TaskRunResponse(UniversalBaseModel): failure_reason: typing.Optional[str] = pydantic.Field(default=None) """ - Reason for failure if the run failed or terminated + Reason for failure if the run failed """ created_at: dt.datetime = pydantic.Field() diff --git a/skyvern/client/types/totp_code.py b/skyvern/client/types/totp_code.py deleted file mode 100644 index b09d2dda..00000000 --- a/skyvern/client/types/totp_code.py +++ /dev/null @@ -1,78 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ..core.pydantic_utilities import UniversalBaseModel -import pydantic -import typing -import datetime as dt -from ..core.pydantic_utilities import IS_PYDANTIC_V2 - - -class TotpCode(UniversalBaseModel): - totp_identifier: str = pydantic.Field() - """ - The identifier of the TOTP code. It can be the email address, phone number, or the identifier of the user. - """ - - task_id: typing.Optional[str] = pydantic.Field(default=None) - """ - The task_id the totp code is for. It can be the task_id of the task that the TOTP code is for. - """ - - workflow_id: typing.Optional[str] = pydantic.Field(default=None) - """ - The workflow ID the TOTP code is for. It can be the workflow ID of the workflow that the TOTP code is for. - """ - - workflow_run_id: typing.Optional[str] = pydantic.Field(default=None) - """ - The workflow run id that the TOTP code is for. It can be the workflow run id of the workflow run that the TOTP code is for. - """ - - source: typing.Optional[str] = pydantic.Field(default=None) - """ - An optional field. The source of the TOTP code. e.g. email, sms, etc. - """ - - content: str = pydantic.Field() - """ - The content of the TOTP code. It can be the email content that contains the TOTP code, or the sms message that contains the TOTP code. Skyvern will automatically extract the TOTP code from the content. - """ - - expired_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) - """ - The timestamp when the TOTP code expires - """ - - totp_code_id: str = pydantic.Field() - """ - The skyvern ID of the TOTP code. - """ - - code: str = pydantic.Field() - """ - The TOTP code extracted from the content. - """ - - organization_id: str = pydantic.Field() - """ - The ID of the organization that the TOTP code is for. - """ - - created_at: dt.datetime = pydantic.Field() - """ - The timestamp when the TOTP code was created. - """ - - modified_at: dt.datetime = pydantic.Field() - """ - The timestamp when the TOTP code was modified. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/skyvern/client/types/url_block.py b/skyvern/client/types/url_block.py index e13f8bae..3fe55c77 100644 --- a/skyvern/client/types/url_block.py +++ b/skyvern/client/types/url_block.py @@ -34,7 +34,6 @@ class UrlBlock(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/skyvern/client/types/validation_block.py b/skyvern/client/types/validation_block.py index 4b53e379..b3a097f8 100644 --- a/skyvern/client/types/validation_block.py +++ b/skyvern/client/types/validation_block.py @@ -34,7 +34,6 @@ class ValidationBlock(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/skyvern/client/types/workflow_definition_blocks_item.py b/skyvern/client/types/workflow_definition_blocks_item.py index 6ee19e0a..a31b2347 100644 --- a/skyvern/client/types/workflow_definition_blocks_item.py +++ b/skyvern/client/types/workflow_definition_blocks_item.py @@ -60,7 +60,6 @@ class WorkflowDefinitionBlocksItem_Action(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -131,7 +130,6 @@ class WorkflowDefinitionBlocksItem_Extraction(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -167,7 +165,6 @@ class WorkflowDefinitionBlocksItem_FileDownload(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -267,7 +264,6 @@ class WorkflowDefinitionBlocksItem_GotoUrl(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -303,7 +299,6 @@ class WorkflowDefinitionBlocksItem_Login(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -339,7 +334,6 @@ class WorkflowDefinitionBlocksItem_Navigation(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -418,7 +412,6 @@ class WorkflowDefinitionBlocksItem_Task(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 @@ -513,7 +506,6 @@ class WorkflowDefinitionBlocksItem_Validation(UniversalBaseModel): totp_identifier: typing.Optional[str] = None cache_actions: typing.Optional[bool] = None complete_verification: typing.Optional[bool] = None - include_action_history_in_verification: typing.Optional[bool] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/skyvern/client/types/workflow_run_request.py b/skyvern/client/types/workflow_run_request.py index 7f9833ac..09be2c8e 100644 --- a/skyvern/client/types/workflow_run_request.py +++ b/skyvern/client/types/workflow_run_request.py @@ -10,7 +10,12 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2 class WorkflowRunRequest(UniversalBaseModel): workflow_id: str = pydantic.Field() """ - ID of the workflow to run. Workflow ID starts with `wpid_`. + ID of the workflow to run + """ + + title: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional title for this workflow run """ parameters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) @@ -18,11 +23,6 @@ class WorkflowRunRequest(UniversalBaseModel): Parameters to pass to the workflow """ - title: typing.Optional[str] = pydantic.Field(default=None) - """ - The title for this workflow run - """ - proxy_location: typing.Optional[ProxyLocation] = pydantic.Field(default=None) """ Location of proxy to use for this workflow run @@ -30,22 +30,22 @@ class WorkflowRunRequest(UniversalBaseModel): webhook_url: typing.Optional[str] = pydantic.Field(default=None) """ - URL to send workflow status updates to after a run is finished. Refer to https://docs.skyvern.com/running-tasks/webhooks-faq for webhook questions. + URL to send workflow status updates to after a run is finished """ totp_url: typing.Optional[str] = pydantic.Field(default=None) """ - URL that serves TOTP/2FA/MFA codes for Skyvern to use during the workflow run. Refer to https://docs.skyvern.com/running-tasks/advanced-features#get-code-from-your-endpoint + URL for TOTP authentication setup if Skyvern should be polling endpoint for 2FA codes """ totp_identifier: typing.Optional[str] = pydantic.Field(default=None) """ - Identifier for the TOTP/2FA/MFA code when the code is pushed to Skyvern. Refer to https://docs.skyvern.com/running-tasks/advanced-features#time-based-one-time-password-totp + Identifier for TOTP (Time-based One-Time Password) authentication if codes are being pushed to Skyvern """ browser_session_id: typing.Optional[str] = pydantic.Field(default=None) """ - ID of a Skyvern browser session to reuse, having it continue from the current screen state + ID of an existing browser session to reuse, having it continue from the current screen state """ if IS_PYDANTIC_V2: diff --git a/skyvern/client/types/workflow_run_response.py b/skyvern/client/types/workflow_run_response.py index 0024e121..ee46501e 100644 --- a/skyvern/client/types/workflow_run_response.py +++ b/skyvern/client/types/workflow_run_response.py @@ -14,7 +14,7 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2 class WorkflowRunResponse(UniversalBaseModel): run_id: str = pydantic.Field() """ - Unique identifier for this run. Run ID starts with `tsk_` for task runs and `wr_` for workflow runs. + Unique identifier for this run """ status: RunStatus = pydantic.Field() @@ -24,7 +24,7 @@ class WorkflowRunResponse(UniversalBaseModel): output: typing.Optional[WorkflowRunResponseOutput] = pydantic.Field(default=None) """ - Output data from the run, if any. Format/schema depends on the data extracted by the run. + Output data from the run, if any. Format depends on the schema in the input """ downloaded_files: typing.Optional[typing.List[FileInfo]] = pydantic.Field(default=None) @@ -39,7 +39,7 @@ class WorkflowRunResponse(UniversalBaseModel): failure_reason: typing.Optional[str] = pydantic.Field(default=None) """ - Reason for failure if the run failed or terminated + Reason for failure if the run failed """ created_at: dt.datetime = pydantic.Field()