fix: use self-hosted Skyvern API paths and LiteLLM key
Self-hosted API uses /api/v1/tasks (not /v1/run/tasks), returns task_id (not run_id). Pass LITELLM_API_KEY as OPENAI_API_KEY. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,7 @@ async def _create_task(url: str, goal: str, extraction_schema: dict | None = Non
|
|||||||
|
|
||||||
async with httpx.AsyncClient(timeout=30.0) as client:
|
async with httpx.AsyncClient(timeout=30.0) as client:
|
||||||
resp = await client.post(
|
resp = await client.post(
|
||||||
f"{SKYVERN_BASE_URL}/v1/run/tasks",
|
f"{SKYVERN_BASE_URL}/api/v1/tasks",
|
||||||
headers={
|
headers={
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"x-api-key": SKYVERN_API_KEY,
|
"x-api-key": SKYVERN_API_KEY,
|
||||||
@@ -42,7 +42,7 @@ async def _create_task(url: str, goal: str, extraction_schema: dict | None = Non
|
|||||||
)
|
)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
data = resp.json()
|
data = resp.json()
|
||||||
return data["run_id"]
|
return data["task_id"]
|
||||||
|
|
||||||
|
|
||||||
async def _poll_task(run_id: str) -> dict:
|
async def _poll_task(run_id: str) -> dict:
|
||||||
@@ -51,7 +51,7 @@ async def _poll_task(run_id: str) -> dict:
|
|||||||
async with httpx.AsyncClient(timeout=15.0) as client:
|
async with httpx.AsyncClient(timeout=15.0) as client:
|
||||||
while elapsed < MAX_POLL_TIME:
|
while elapsed < MAX_POLL_TIME:
|
||||||
resp = await client.get(
|
resp = await client.get(
|
||||||
f"{SKYVERN_BASE_URL}/v1/runs/{run_id}",
|
f"{SKYVERN_BASE_URL}/api/v1/tasks/{run_id}",
|
||||||
headers={"x-api-key": SKYVERN_API_KEY},
|
headers={"x-api-key": SKYVERN_API_KEY},
|
||||||
)
|
)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
DATABASE_STRING: postgresql+psycopg://skyvern:${SKYVERN_DB_PASSWORD:-skyvern}@skyvern-db:5432/skyvern
|
DATABASE_STRING: postgresql+psycopg://skyvern:${SKYVERN_DB_PASSWORD:-skyvern}@skyvern-db:5432/skyvern
|
||||||
OPENAI_API_KEY: placeholder
|
OPENAI_API_KEY: ${LITELLM_API_KEY}
|
||||||
OPENAI_API_BASE: ${LITELLM_BASE_URL}
|
OPENAI_API_BASE: ${LITELLM_BASE_URL}/v1
|
||||||
LLM_KEY: OPENAI_GPT4O
|
LLM_KEY: OPENAI_GPT4O
|
||||||
SECONDARY_LLM_KEY: OPENAI_GPT4O_MINI
|
SECONDARY_LLM_KEY: OPENAI_GPT4O_MINI
|
||||||
BROWSER_TYPE: chromium-headful
|
BROWSER_TYPE: chromium-headful
|
||||||
@@ -96,7 +96,7 @@ services:
|
|||||||
skyvern-db:
|
skyvern-db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://127.0.0.1:8000/api/v1/health"]
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/v1/heartbeat')"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|||||||
@@ -68,12 +68,12 @@ async def execute_skyvern(config: dict, send_text=None, target_room: str = "", *
|
|||||||
|
|
||||||
async with httpx.AsyncClient(timeout=30.0) as client:
|
async with httpx.AsyncClient(timeout=30.0) as client:
|
||||||
resp = await client.post(
|
resp = await client.post(
|
||||||
f"{SKYVERN_BASE_URL}/v1/run/tasks",
|
f"{SKYVERN_BASE_URL}/api/v1/tasks",
|
||||||
headers=headers,
|
headers=headers,
|
||||||
json=payload,
|
json=payload,
|
||||||
)
|
)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
run_id = resp.json()["run_id"]
|
run_id = resp.json()["task_id"]
|
||||||
|
|
||||||
logger.info("Skyvern pipeline task created: %s", run_id)
|
logger.info("Skyvern pipeline task created: %s", run_id)
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ async def execute_skyvern(config: dict, send_text=None, target_room: str = "", *
|
|||||||
async with httpx.AsyncClient(timeout=15.0) as client:
|
async with httpx.AsyncClient(timeout=15.0) as client:
|
||||||
while elapsed < max_poll:
|
while elapsed < max_poll:
|
||||||
resp = await client.get(
|
resp = await client.get(
|
||||||
f"{SKYVERN_BASE_URL}/v1/runs/{run_id}",
|
f"{SKYVERN_BASE_URL}/api/v1/tasks/{run_id}",
|
||||||
headers={"x-api-key": SKYVERN_API_KEY},
|
headers={"x-api-key": SKYVERN_API_KEY},
|
||||||
)
|
)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
|
|||||||
Reference in New Issue
Block a user