Deploying Spurs as APIs
Turn your Spur workflows into production-ready APIs with one click
One-Click Deployment
PySpur makes it incredibly easy to deploy your workflows as production-ready APIs with a single click.
Open your workflow
Navigate to any workflow you’ve created and want to deploy.
Click Deploy
Click the “Deploy” button in the top navigation bar to open the deployment modal.
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:
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:
Blocking (Synchronous)
Blocking (Synchronous)
Use blocking calls when:
- You need immediate results
- The workflow completes quickly
- You want to process the response in the same request
The API will wait for the workflow to complete before returning a response.
Non-Blocking (Asynchronous)
Non-Blocking (Asynchronous)
Use non-blocking calls when:
- Workflows may take longer to complete
- You want to decouple request and response
- You need better scalability for long-running tasks
The API will immediately return a run ID, and you can check the status later.
Code Examples
The deployment modal provides ready-to-use code examples in various programming languages:
For non-blocking calls:
For non-blocking calls:
Advanced Deployment Options
Batch Processing
Run your workflow over a dataset with the batch processing API
Provide a dataset ID and mini-batch size to process large datasets efficiently.
Cancellation
Cancel in-progress workflows when needed
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:
- API Authentication: Add appropriate authentication to your PySpur instance
- Input Validation: Ensure workflows validate inputs properly
- Error Handling: Implement robust error handling in your client code