fetch-hive-sdk package when you want to invoke a workflow deployment from Python. The SDK wraps the public POST /v1/workflow/invoke endpoint, handles authentication, and supports both direct responses and callback delivery.
Installation
httpx under the hood.
Authentication
Set theFETCH_HIVE_API_KEY environment variable to your workspace API key (the SDK reads it automatically):
Basic example
Run a workflow deployment directly. The call blocks until the workflow finishes:Method reference
| Argument | Type | Required | Description |
|---|---|---|---|
deployment | str | Yes | The workflow deployment name |
variant | str | No | The deployment variant name |
inputs | dict[str, Any] | No | Key-value pairs for the variables defined on the Start step |
async_mode | bool | No | When True, return immediately and deliver the result by signed callback |
callback_url | str | No | Required when async_mode=True - the HTTPS callback URL to call when the run finishes |
user | str | No | Opaque caller identifier surfaced in User Tracking |
metadata | dict[str, str | int | float | bool | None] | No | Flat caller-defined metadata for audit and log filtering. See Invoke metadata |
invoke_workflow builds the request body for you. When you pass async_mode=True, the SDK sends:
Handling the response
Callback delivery
Passasync_mode=True to return immediately and have Fetch Hive call your callback URL when the run finishes:
webhook_secret so you can verify the signature on the incoming callback. See Callback Delivery and Webhook Triggers for the verification flow and signed payload shape.
Configuration
| Option | Default | Description |
|---|---|---|
api_key | FETCH_HIVE_API_KEY env var | Bearer token from the dashboard |
base_url | https://api.fetchhive.com/v1 | Override the API base URL |
timeout | 120 | Request timeout in seconds - increase for long-running direct workflow requests |
Errors
Non-2xx responses raise anhttpx.HTTPStatusError with the status code and response body:
Links
Next steps
- Callback Delivery and Webhook Triggers - Verify callback signatures
- Run with API - The same flow with cURL
- Run with Node.js SDK
- Run with Ruby SDK
- Run with PHP SDK
- Invoke Workflow - Full endpoint reference

