workstudio
Python SDK for work.studio - AI-powered workflow automation platform.
Installation
pip install workstudio
Quick Start
from workstudio import Client
# Initialize with API key
client = Client(api_key="svx_ck_prod_...")
# Or use environment variable
# export WORKSTUDIO_API_KEY=svx_ck_prod_...
client = Client()
Workflows
List workflows
workflows, page_info = client.workflows.list()
for wf in workflows:
print(f"{wf.name}: {wf.id}")
# With pagination
workflows, page_info = client.workflows.list(page=0, size=10)
print(f"Total: {page_info.total_elements}")
Run a workflow
# By ID
result = client.workflows.run(
"550e8400-e29b-41d4-a716-446655440000",
inputs={"file_url": "https://example.com/invoice.pdf"}
)
# By endpoint name
result = client.workflows.run(
"invoice-processor",
inputs={"file_url": "https://example.com/invoice.pdf"}
)
# Check result
print(f"Status: {result.status}")
print(f"Outputs: {result.outputs}")
Async workflow execution
# Start workflow without waiting
run = client.workflows.run("invoice-processor", sync=False)
print(f"Started run: {run.id}")
# Poll for status later
run = client.workflows.get_run(run.id)
print(f"Status: {run.status}")
Agents
List agents
agents, _ = client.agents.list(status="PUBLISHED")
for agent in agents:
print(f"{agent.name}: {agent.description}")
Simple chat (one-shot)
response = client.agents.chat(
"sales-assistant",
"What are our top 3 deals this quarter?"
)
print(response.message)
print(f"Tokens used: {response.total_tokens}")
print(f"Cost: ${response.estimated_cost_usd:.4f}")
Multi-turn conversation
# Create a session for multi-turn conversation
with client.agents.create_session("sales-assistant") as session:
# First message
r1 = session.send_message("What are our top deals?")
print(f"Assistant: {r1.message}")
# Follow-up (maintains context)
r2 = session.send_message("Tell me more about the first one")
print(f"Assistant: {r2.message}")
# Check session metrics
state = session.get_state()
print(f"Total tokens: {state.total_tokens}")
Async Usage
For async applications (FastAPI, etc.):
from workstudio import AsyncClient
import asyncio
async def main():
async with AsyncClient(api_key="svx_ck_prod_...") as client:
# Workflows
workflows, _ = await client.workflows.list()
result = await client.workflows.run("invoice-processor")
# Agents
async with await client.agents.create_session("assistant") as session:
response = await session.send_message("Hello!")
print(response.message)
asyncio.run(main())
Configuration
Environment Variables
| Variable | Description |
|---|---|
WORKSTUDIO_API_KEY |
Your API key (required if not passed to Client) |
WORKSTUDIO_BASE_URL |
API base URL (default: https://api.work.studio) |
WORKSTUDIO_SCOPE_ID |
Default scope for customer-scoped operations |
Custom Configuration
client = Client(
api_key="svx_ck_prod_...",
base_url="https://custom.api.endpoint",
timeout=60.0, # Request timeout in seconds
scope_id="my-scope-id", # For customer API keys
)
Error Handling
from workstudio import Client
from workstudio.exceptions import (
AuthenticationError,
NotFoundError,
ValidationError,
RateLimitError,
APIError,
)
client = Client()
try:
result = client.workflows.run("my-workflow")
except AuthenticationError:
print("Invalid API key")
except NotFoundError:
print("Workflow not found")
except ValidationError as e:
print(f"Invalid input: {e.errors}")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after} seconds")
except APIError as e:
print(f"API error: {e.message} (status: {e.status_code})")
API Key Types
| Type | Format | Use Case |
|---|---|---|
| Customer Key | svx_ck_... |
External integrations, scoped to a specific context |
| Tenant Key | svx_tk_... |
Backend services, full tenant access |
Get your API key from the Designer → API Keys page.
Development
# Clone and install dev dependencies
git clone https://github.com/workstudio-inc/workstudio-python
cd workstudio-python
pip install -e ".[dev]"
# Run tests
pytest
# Type checking
mypy workstudio
# Linting
ruff check workstudio
License
MIT License - see LICENSE for details.
Links
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file workstudio-0.1.0.tar.gz.
File metadata
- Download URL: workstudio-0.1.0.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d21aa5a08691383c023206b909d15b5aad4f7447d7216274ea1ca2857aed3a7
|
|
| MD5 |
efee3d7298dd4aca1be8f01a95a783a4
|
|
| BLAKE2b-256 |
2e56f9b19da5f84cc4cfd23d3fb13f9efa092635f47c35cfafcd3ac990b31bdb
|
Provenance
The following attestation bundles were made for workstudio-0.1.0.tar.gz:
Publisher:
publish.yml on workstudio-inc/workstudio-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
workstudio-0.1.0.tar.gz -
Subject digest:
0d21aa5a08691383c023206b909d15b5aad4f7447d7216274ea1ca2857aed3a7 - Sigstore transparency entry: 2491310063
- Sigstore integration time:
-
Permalink:
workstudio-inc/workstudio-python@16445ab5b8e18b98a0dc1cab23523e2a763fc971 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/workstudio-inc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@16445ab5b8e18b98a0dc1cab23523e2a763fc971 -
Trigger Event:
push
-
Statement type:
File details
Details for the file workstudio-0.1.0-py3-none-any.whl.
File metadata
- Download URL: workstudio-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01da55a3ad415f258480349a94edae412b27f0b4a63c3344d6031ac6bbf8ee58
|
|
| MD5 |
e246f603f49ee799e7647a8f5389b09a
|
|
| BLAKE2b-256 |
972361e98d5fd48cca66f15fc1e2c324ac6d679d5e14488a4b67870bb2757fcd
|
Provenance
The following attestation bundles were made for workstudio-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on workstudio-inc/workstudio-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
workstudio-0.1.0-py3-none-any.whl -
Subject digest:
01da55a3ad415f258480349a94edae412b27f0b4a63c3344d6031ac6bbf8ee58 - Sigstore transparency entry: 2491310690
- Sigstore integration time:
-
Permalink:
workstudio-inc/workstudio-python@16445ab5b8e18b98a0dc1cab23523e2a763fc971 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/workstudio-inc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@16445ab5b8e18b98a0dc1cab23523e2a763fc971 -
Trigger Event:
push
-
Statement type: