Skip to main content

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

Metadata

Release files for workstudio 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for workstudio 0.1.0
File Size Uploaded Provenance
workstudio-0.1.0.tar.gz 12.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for workstudio 0.1.0
File Interpreter ABI Platform
workstudio-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.5 kB

Release files / workstudio-0.1.0.tar.gz

Download URL workstudio-0.1.0.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0d21aa5a08691383c023206b909d15b5aad4f7447d7216274ea1ca2857aed3a7
BLAKE2b-256 checksum
How to use checksums
2e56f9b19da5f84cc4cfd23d3fb13f9efa092635f47c35cfafcd3ac990b31bdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.

Transparency log

Release files / workstudio-0.1.0-py3-none-any.whl

Download URL workstudio-0.1.0-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01da55a3ad415f258480349a94edae412b27f0b4a63c3344d6031ac6bbf8ee58
BLAKE2b-256 checksum
How to use checksums
972361e98d5fd48cca66f15fc1e2c324ac6d679d5e14488a4b67870bb2757fcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.

Transparency log

Security for workstudio 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for workstudio-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page