fern python sdk setup (#1938)

Co-authored-by: eden <eyw520@gmail.com>
This commit is contained in:
Shuchang Zheng
2025-03-21 09:21:24 -07:00
committed by GitHub
parent 71e5242970
commit 9ffcb00951
6 changed files with 15559 additions and 9800 deletions

View File

@@ -1,4 +1,4 @@
{ {
"organization": "skyverndocs", "organization": "skyverndocs",
"version": "0.51.36" "version": "0.56.20"
} }

View File

@@ -1,18 +1,21 @@
# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json
api: api:
path: openapi/skyvern_openapi.yml specs:
overrides: openapi/openapi-overrides.yml - openapi: openapi/skyvern_openapi.json
settings: #origin: https://api.skyvern.com/openapi.json
use-title: false # settings:
# use-title: false
groups: groups:
python-sdk: python-sdk:
generators: generators:
- name: fernapi/fern-python-sdk - name: fernapi/fern-python-sdk
smart-casing: true smart-casing: true
version: 4.3.11 version: 4.3.17
output: output:
location: pypi location: pypi
package-name: skyvern package-name: skyvern
github: github:
repository: fern-demo/skyvern-python-sdk repository: Skyvern-AI/skyvern-python
config: config:
client_class_name: Skyvern client_class_name: Skyvern

View File

@@ -1,280 +0,0 @@
servers:
- url: https://api.skyvern.com
x-fern-server-name: Production
paths:
/api/v1/webhook:
post:
x-fern-sdk-group-name:
- server
x-fern-sdk-method-name: webhook
/api/v1/heartbeat:
get:
x-fern-sdk-group-name:
- server
x-fern-sdk-method-name: checkStatus
/api/v1/tasks:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getTasks
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: createTask
/api/v1/tasks/{task_id}/steps:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getTaskSteps
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: executeTaskSteps
/api/v1/tasks/{task_id}/steps/{step_id}:
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: executeTaskStep
/api/v1/tasks/{task_id}:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getTask
/api/v1/tasks/{task_id}/cancel:
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: cancelTask
/api/v1/workflows/runs/{workflow_run_id}/cancel:
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: cancelWorkflowRun
/api/v1/tasks/{task_id}/retry_webhook:
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: retryWebhook
/api/v1/internal/tasks/{task_id}:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getTaskInternal
/api/v1/internal/tasks:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getTasksInternal
/api/v1/{entity_type}/{entity_id}/artifacts:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getEntityArtifacts
/api/v1/tasks/{task_id}/steps/{step_id}/artifacts:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getTaskStepArtifacts
/api/v1/tasks/{task_id}/actions:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getTaskActions
/api/v1/workflows/{workflow_id}/run:
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: executeWorkflow
/api/v1/workflows/runs:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getWorkflowRuns
/api/v1/workflows/{workflow_permanent_id}/runs:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getWorkflowRunsForWorkflowPermanentId
/api/v1/workflows/{workflow_id}/runs/{workflow_run_id}:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getWorkflowRun
/api/v1/workflows/{workflow_id}/runs/{workflow_run_id}/timeline:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getWorkflowRunTimeline
/api/v1/workflows/runs/{workflow_run_id}:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getWorkflowRunByRunId
/api/v1/workflows:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getWorkflows
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: createWorkflow
/api/v1/workflows/{workflow_permanent_id}:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getWorkflow
put:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: updateWorkflow
delete:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: deleteWorkflow
/api/v1/workflows/:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: listWorkflows
/api/v1/workflows/{workflow_permanent_id}/:
get:
x-fern-ignore: true
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getWorkflowByPermanentId
/api/v1/suggest/{ai_suggestion_type}/:
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: makeAiSuggestion
/api/v1/generate/task/:
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: generateTask
/api/v1/organizations:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getOrganizations
put:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: updateOrganization
/api/v1/organizations/{organization_id}/apikeys:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getOrgApiKeys
/api/v1/upload_file:
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: uploadFile
/api/v1/browser_sessions/{browser_session_id}:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getBrowserSessionById
/api/v1/browser_sessions:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getBrowserSessions
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: createBrowserSession
/api/v1/browser_sessions/close:
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: closeBrowserSessions
/api/v1/browser_sessions/{session_id}/close:
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: closeBrowserSession
/api/v2/tasks:
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: observerTaskV2
/api/v2/tasks/{task_id}:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getObserverTaskV2
/api/v1/totp:
post:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: saveTotpCode
/api/v1/eval/workflows/runs:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getEvalWorkflowRuns
/api/v1/eval/workflows/{workflow_id}/runs/{workflow_run_id}:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getEvalWorkflowRun
/api/v1/eval/workflows/{workflow_id}/runs/{workflow_run_id}/timeline/:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getEvalWorkflowRunTimeline
/api/v1/eval/workflows/{workflow_id}/runs/{workflow_run_id}/timeline:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: listWorkflowRunTimeline
/api/v1/eval/workflows/runs/{workflow_run_id}:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getEvalWorkflowRunByRunId
/api/v1/eval/workflows/{workflow_permanent_id}/:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getEvalWorkflow
/api/v1/eval/workflows/{workflow_permanent_id}:
get:
x-fern-ignore: true
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getEvalWorkflowByPermanentId
/api/v1/eval/workflows/{workflow_permanent_id}/runs:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getEvalWorkflowRunsForWorkflowPermanentId
/api/v1/eval/{entity_type}/{entity_id}/artifacts:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getEvalEntityArtifacts
/api/v1/eval/tasks/{task_id}/actions:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getEvalTaskActions
/api/v1/eval/tasks/{task_id}/steps/{step_id}/artifacts:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getEvalTaskStepArtifacts
/api/v1/eval/tasks/{task_id}/steps:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getEvalTaskSteps
/api/v1/eval/tasks:
get:
x-fern-sdk-group-name:
- agent
x-fern-sdk-method-name: getAgentTasks

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -5,6 +5,7 @@ from typing import Awaitable, Callable
import structlog import structlog
from fastapi import FastAPI, Response, status from fastapi import FastAPI, Response, status
from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.cors import CORSMiddleware
from fastapi.openapi.utils import get_openapi
from fastapi.responses import JSONResponse from fastapi.responses import JSONResponse
from pydantic import ValidationError from pydantic import ValidationError
from starlette.requests import HTTPConnection, Request from starlette.requests import HTTPConnection, Request
@@ -31,6 +32,20 @@ class ExecutionDatePlugin(Plugin):
return datetime.now() return datetime.now()
def custom_openapi() -> dict:
if app.openapi_schema:
return app.openapi_schema
openapi_schema = get_openapi(
title="Skyvern API",
version="1.0.0",
description="API for Skyvern",
routes=app.routes,
)
openapi_schema["servers"] = [{"url": "https://api.skyvern.com", "x-fern-server-name": "Production"}]
app.openapi_schema = openapi_schema
return app.openapi_schema
def get_agent_app() -> FastAPI: def get_agent_app() -> FastAPI:
""" """
Start the agent server. Start the agent server.
@@ -51,6 +66,7 @@ def get_agent_app() -> FastAPI:
app.include_router(v2_router, prefix="/api/v2") app.include_router(v2_router, prefix="/api/v2")
app.include_router(websocket_router, prefix="/api/v1/stream") app.include_router(websocket_router, prefix="/api/v1/stream")
app.include_router(totp_router, prefix="/api/v1/totp") app.include_router(totp_router, prefix="/api/v1/totp")
app.openapi = custom_openapi
app.add_middleware( app.add_middleware(
RawContextMiddleware, RawContextMiddleware,
@@ -72,7 +88,10 @@ def get_agent_app() -> FastAPI:
@app.exception_handler(ValidationError) @app.exception_handler(ValidationError)
async def handle_pydantic_validation_error(request: Request, exc: ValidationError) -> JSONResponse: async def handle_pydantic_validation_error(request: Request, exc: ValidationError) -> JSONResponse:
return JSONResponse(status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, content={"detail": str(exc)}) return JSONResponse(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
content={"detail": str(exc)},
)
@app.exception_handler(Exception) @app.exception_handler(Exception)
async def unexpected_exception(request: Request, exc: Exception) -> JSONResponse: async def unexpected_exception(request: Request, exc: Exception) -> JSONResponse: