SDK Reference
Python SDK
API-Triggered Workflows

Running Workflows via API

Workflows can be triggered from the API by calling run_workflow. This method is available on the hatchet.client.admin client:

run_workflow.py
from hatchet_sdk import Hatchet, ClientConfig
 
hatchet = Hatchet()
 
workflowRun = hatchet.client.admin.run_workflow(
    "ManualTriggerWorkflow",
    {"test": "test"},
    options={"additional_metadata": {"hello": "moon"}},
)

This method takes the following parameters:

  • workflow_name (required): The name of the workflow to trigger. If you have not overriden the workflow name in the hatchet.workflow decorator, this should match the name of the workflow class.
  • input (required): The input to the workflow. This should be a JSON-serializable dict.
  • options (optional): Additional options to pass to the workflow. The current options are supported:
    • additional_metadata: A dict of key-value strings to attach to the workflow run. This metadata will be shown in the Hatchet UI and will be available in API endpoints for listing/filtering.

For more information on how to interact with the return value of run_workflow, see the documentation for getting workflow run results.