One-Click Deployment

PySpur makes it incredibly easy to deploy your workflows as production-ready APIs with a single click.

1

Open your workflow

Navigate to any workflow you’ve created and want to deploy.

2

Click Deploy

Click the “Deploy” button in the top navigation bar to open the deployment modal.

3

Choose deployment options

In the modal that appears, you can configure:

  • API call type: Choose between blocking (synchronous) or non-blocking (asynchronous) calls
  • Programming language: Select your preferred language for the code example

For example, in Python:

Or in TypeScript:

4

Copy the code

Copy the generated code example to integrate with your application.

API Call Types

PySpur supports two types of API calls when deploying your workflows:

Code Examples

The deployment modal provides ready-to-use code examples in various programming languages:

import requests

# For blocking calls
url = 'https://your-pyspur-instance.com/api/wf/{workflow_id}/run/?run_type=blocking'
data = {
    "initial_inputs": {
        "InputNode_1": {
            "input_field_1": "example_value",
            "input_field_2": 123
        }
    }
}

response = requests.post(url, json=data)
print(response.status_code)
print(response.json())

For non-blocking calls:

# Step 1: Start the workflow
url = 'https://your-pyspur-instance.com/api/wf/{workflow_id}/start_run/?run_type=non_blocking'
response = requests.post(url, json=data)
run_id = response.json()['id']

# Step 2: Check status later
status_url = f'https://your-pyspur-instance.com/api/runs/{run_id}/status/'
status_response = requests.get(status_url)
print(status_response.json())

Advanced Deployment Options

Batch Processing

Run your workflow over a dataset with the batch processing API

POST /api/wf/{workflow_id}/start_batch_run/

Provide a dataset ID and mini-batch size to process large datasets efficiently.

Cancellation

Cancel in-progress workflows when needed

POST /api/cancel_workflow/{run_id}/

This is useful for stopping long-running or paused workflows.

Run Control

PySpur provides full control over your deployed workflows with APIs for:

  • Listing all runs of a workflow
  • Retrieving run status
  • Handling human-in-the-loop interventions

Security Considerations

When deploying workflows as APIs, consider:

  1. API Authentication: Add appropriate authentication to your PySpur instance
  2. Input Validation: Ensure workflows validate inputs properly
  3. Error Handling: Implement robust error handling in your client code

Next Steps