doc update - add run tasks page (#2425)

This commit is contained in:
Shuchang Zheng
2025-05-24 23:46:31 -07:00
committed by GitHub
parent 601cd099f7
commit 6f83978937
27 changed files with 1168 additions and 48 deletions

View File

@@ -13,6 +13,8 @@ from .types import (
ActionBlockParametersItem_Output,
ActionBlockParametersItem_Workflow,
ActionBlockYaml,
Artifact,
ArtifactType,
AwsSecretParameter,
AwsSecretParameterYaml,
BitwardenCreditCardDataParameter,
@@ -317,7 +319,7 @@ from .types import (
WorkflowStatus,
)
from .errors import BadRequestError, ForbiddenError, NotFoundError, UnprocessableEntityError
from . import agent, browser_session, credentials, workflows
from . import agent, artifacts, browser_session, credentials, workflows
from .agent import (
AgentGetRunResponse,
AgentGetRunResponse_AnthropicCua,
@@ -350,6 +352,8 @@ __all__ = [
"AgentGetRunResponse_TaskV1",
"AgentGetRunResponse_TaskV2",
"AgentGetRunResponse_WorkflowRun",
"Artifact",
"ArtifactType",
"AsyncSkyvern",
"AwsSecretParameter",
"AwsSecretParameterYaml",
@@ -662,6 +666,7 @@ __all__ = [
"WorkflowStatus",
"__version__",
"agent",
"artifacts",
"browser_session",
"credentials",
"workflows",

View File

@@ -429,6 +429,65 @@ class AgentClient:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
def retry_run_webhook(
self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.Optional[typing.Any]:
"""
Retry sending the webhook for a run
Parameters
----------
run_id : str
The id of the task run or the workflow run.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.Optional[typing.Any]
Successful Response
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.agent.retry_run_webhook(
run_id="tsk_123",
)
"""
_response = self._client_wrapper.httpx_client.request(
f"v1/runs/{jsonable_encoder(run_id)}/retry_webhook",
method="POST",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
typing.Optional[typing.Any],
parse_obj_as(
type_=typing.Optional[typing.Any], # 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)
class AsyncAgentClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -869,3 +928,70 @@ class AsyncAgentClient:
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
async def retry_run_webhook(
self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.Optional[typing.Any]:
"""
Retry sending the webhook for a run
Parameters
----------
run_id : str
The id of the task run or the workflow run.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.Optional[typing.Any]
Successful Response
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.agent.retry_run_webhook(
run_id="tsk_123",
)
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
f"v1/runs/{jsonable_encoder(run_id)}/retry_webhook",
method="POST",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
typing.Optional[typing.Any],
parse_obj_as(
type_=typing.Optional[typing.Any], # 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)

View File

@@ -6,11 +6,13 @@ import httpx
from .core.client_wrapper import SyncClientWrapper
from .agent.client import AgentClient
from .workflows.client import WorkflowsClient
from .artifacts.client import ArtifactsClient
from .browser_session.client import BrowserSessionClient
from .credentials.client import CredentialsClient
from .core.client_wrapper import AsyncClientWrapper
from .agent.client import AsyncAgentClient
from .workflows.client import AsyncWorkflowsClient
from .artifacts.client import AsyncArtifactsClient
from .browser_session.client import AsyncBrowserSessionClient
from .credentials.client import AsyncCredentialsClient
@@ -75,6 +77,7 @@ class Skyvern:
)
self.agent = AgentClient(client_wrapper=self._client_wrapper)
self.workflows = WorkflowsClient(client_wrapper=self._client_wrapper)
self.artifacts = ArtifactsClient(client_wrapper=self._client_wrapper)
self.browser_session = BrowserSessionClient(client_wrapper=self._client_wrapper)
self.credentials = CredentialsClient(client_wrapper=self._client_wrapper)
@@ -139,6 +142,7 @@ class AsyncSkyvern:
)
self.agent = AsyncAgentClient(client_wrapper=self._client_wrapper)
self.workflows = AsyncWorkflowsClient(client_wrapper=self._client_wrapper)
self.artifacts = AsyncArtifactsClient(client_wrapper=self._client_wrapper)
self.browser_session = AsyncBrowserSessionClient(client_wrapper=self._client_wrapper)
self.credentials = AsyncCredentialsClient(client_wrapper=self._client_wrapper)

View File

@@ -16,7 +16,7 @@ class BaseClientWrapper:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "skyvern",
"X-Fern-SDK-Version": "0.1.85",
"X-Fern-SDK-Version": "0.1.86",
}
if self._api_key is not None:
headers["x-api-key"] = self._api_key

View File

@@ -14,6 +14,8 @@ from .action_block_parameters_item import (
ActionBlockParametersItem_Workflow,
)
from .action_block_yaml import ActionBlockYaml
from .artifact import Artifact
from .artifact_type import ArtifactType
from .aws_secret_parameter import AwsSecretParameter
from .aws_secret_parameter_yaml import AwsSecretParameterYaml
from .bitwarden_credit_card_data_parameter import BitwardenCreditCardDataParameter
@@ -366,6 +368,8 @@ __all__ = [
"ActionBlockParametersItem_Output",
"ActionBlockParametersItem_Workflow",
"ActionBlockYaml",
"Artifact",
"ArtifactType",
"AwsSecretParameter",
"AwsSecretParameterYaml",
"BitwardenCreditCardDataParameter",

View File

@@ -0,0 +1,41 @@
# This file was auto-generated by Fern from our API Definition.
from ..core.pydantic_utilities import UniversalBaseModel
import pydantic
from .artifact_type import ArtifactType
import typing
from ..core.pydantic_utilities import IS_PYDANTIC_V2
class Artifact(UniversalBaseModel):
created_at: str = pydantic.Field()
"""
The creation datetime of the task.
"""
modified_at: str = pydantic.Field()
"""
The modification datetime of the task.
"""
artifact_id: str
artifact_type: ArtifactType
uri: str
task_id: typing.Optional[str] = None
step_id: typing.Optional[str] = None
workflow_run_id: typing.Optional[str] = None
workflow_run_block_id: typing.Optional[str] = None
observer_cruise_id: typing.Optional[str] = None
observer_thought_id: typing.Optional[str] = None
ai_suggestion_id: typing.Optional[str] = None
signed_url: typing.Optional[str] = None
organization_id: typing.Optional[str] = None
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

View File

@@ -0,0 +1,34 @@
# This file was auto-generated by Fern from our API Definition.
import typing
ArtifactType = typing.Union[
typing.Literal[
"recording",
"browser_console_log",
"skyvern_log",
"skyvern_log_raw",
"screenshot",
"screenshot_llm",
"screenshot_action",
"screenshot_final",
"llm_prompt",
"llm_request",
"llm_response",
"llm_response_parsed",
"llm_response_rendered",
"visible_elements_id_css_map",
"visible_elements_id_frame_map",
"visible_elements_tree",
"visible_elements_tree_trimmed",
"visible_elements_tree_in_prompt",
"hashed_href_map",
"visible_elements_id_xpath_map",
"html",
"html_scrape",
"html_action",
"trace",
"har",
],
typing.Any,
]

View File

@@ -2,14 +2,14 @@
import typing
from ..core.client_wrapper import SyncClientWrapper
from ..types.workflow_create_yaml_request import WorkflowCreateYamlRequest
from ..core.request_options import RequestOptions
from ..types.workflow import Workflow
from ..core.serialization import convert_and_respect_annotation_metadata
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.workflow_create_yaml_request import WorkflowCreateYamlRequest
from ..core.serialization import convert_and_respect_annotation_metadata
from ..core.jsonable_encoder import jsonable_encoder
from ..core.client_wrapper import AsyncClientWrapper
@@ -21,6 +21,88 @@ class WorkflowsClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper
def get_workflows(
self,
*,
page: typing.Optional[int] = None,
page_size: typing.Optional[int] = None,
only_saved_tasks: typing.Optional[bool] = None,
only_workflows: typing.Optional[bool] = None,
title: typing.Optional[str] = None,
template: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[Workflow]:
"""
Get all workflows with the latest version for the organization.
Parameters
----------
page : typing.Optional[int]
page_size : typing.Optional[int]
only_saved_tasks : typing.Optional[bool]
only_workflows : typing.Optional[bool]
title : typing.Optional[str]
template : typing.Optional[bool]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.List[Workflow]
Successful Response
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.workflows.get_workflows()
"""
_response = self._client_wrapper.httpx_client.request(
"v1/workflows",
method="GET",
params={
"page": page,
"page_size": page_size,
"only_saved_tasks": only_saved_tasks,
"only_workflows": only_workflows,
"title": title,
"template": template,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
typing.List[Workflow],
parse_obj_as(
type_=typing.List[Workflow], # 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 create_workflow(
self,
*,
@@ -233,6 +315,96 @@ class AsyncWorkflowsClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper
async def get_workflows(
self,
*,
page: typing.Optional[int] = None,
page_size: typing.Optional[int] = None,
only_saved_tasks: typing.Optional[bool] = None,
only_workflows: typing.Optional[bool] = None,
title: typing.Optional[str] = None,
template: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[Workflow]:
"""
Get all workflows with the latest version for the organization.
Parameters
----------
page : typing.Optional[int]
page_size : typing.Optional[int]
only_saved_tasks : typing.Optional[bool]
only_workflows : typing.Optional[bool]
title : typing.Optional[str]
template : typing.Optional[bool]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.List[Workflow]
Successful Response
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.workflows.get_workflows()
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
"v1/workflows",
method="GET",
params={
"page": page,
"page_size": page_size,
"only_saved_tasks": only_saved_tasks,
"only_workflows": only_workflows,
"title": title,
"template": template,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
typing.List[Workflow],
parse_obj_as(
type_=typing.List[Workflow], # 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 create_workflow(
self,
*,