{"id":7001,"library":"argo-workflows","title":"Argo Workflows Python Client","description":"The `argo-workflows` Python client provides programmatic access to the Argo Workflows API, enabling users to create, manage, and monitor workflows and other resources. It is an OpenAPI-generated client, meaning its version (currently 6.6.19) is closely tied to the Argo Workflows server's API specification. The library is actively maintained, with frequent updates to keep pace with new server features and API changes.","status":"active","version":"6.6.19","language":"en","source_language":"en","source_url":"https://github.com/argoproj/argo-workflows/tree/master/sdks/python","tags":["workflow orchestration","kubernetes","api client"],"install":[{"cmd":"pip install argo-workflows","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"Configuration","correct":"from argo_workflows import Configuration"},{"symbol":"ApiClient","correct":"from argo_workflows import ApiClient"},{"symbol":"WorkflowServiceApi","correct":"from argo_workflows.api import workflow_service_api"},{"note":"Commonly imported for constructing workflow definitions, along with other 'io_argoproj_workflow_v1alpha1_*' models.","symbol":"IoArgoprojWorkflowV1alpha1Workflow","correct":"from argo_workflows.model import io_argoproj_workflow_v1alpha1_workflow"},{"note":"The base exception class for API errors.","symbol":"ApiException","correct":"from argo_workflows import ApiException"}],"quickstart":{"code":"import argo_workflows\nfrom argo_workflows.api import workflow_service_api\nimport os\n\n# Configure API client\nconfiguration = argo_workflows.Configuration(\n    host=os.environ.get(\"ARGO_WORKFLOWS_HOST\", \"http://localhost:2746\"),\n    verify_ssl=os.environ.get(\"ARGO_WORKFLOWS_VERIFY_SSL\", \"false\").lower() == \"true\",\n)\n\n# Bearer Token Authentication (common for Argo Workflows)\ntoken = os.environ.get(\"ARGO_WORKFLOWS_TOKEN\")\nif token:\n    configuration.api_key[\"Authorization\"] = token\n    configuration.api_key_prefix[\"Authorization\"] = \"Bearer\"\nelse:\n    print(\"Warning: ARGO_WORKFLOWS_TOKEN not set. API calls might fail without authentication.\")\n\n# Enter a context with an instance of the API client\nwith argo_workflows.ApiClient(configuration) as api_client:\n    # Create an instance of the API class\n    api_instance = workflow_service_api.WorkflowServiceApi(api_client)\n    namespace = os.environ.get(\"ARGO_WORKFLOWS_NAMESPACE\", \"argo\") # Example namespace\n\n    try:\n        # Example: List workflows in a given namespace\n        api_response = api_instance.list_workflows(namespace=namespace)\n        print(f\"Successfully listed {len(api_response.items)} workflows in namespace '{namespace}'.\")\n        if api_response.items:\n            print(f\"First workflow: {api_response.items[0].metadata.name}\")\n    except argo_workflows.ApiException as e:\n        print(f\"Exception when calling WorkflowServiceApi->list_workflows: {e}\\n\")\n","lang":"python","description":"This quickstart demonstrates how to configure the `argo-workflows` client for authentication (using a bearer token from an environment variable), instantiate the `WorkflowServiceApi`, and list workflows in a specified namespace. Ensure `ARGO_WORKFLOWS_HOST` and `ARGO_WORKFLOWS_TOKEN` (if using auth) are set."},"warnings":[{"fix":"Always use a client version that is recent and intended for your Argo Workflows server version. Consult the official Argo Workflows GitHub for recommendations or regenerate the client if you are tracking custom API changes.","message":"The `argo-workflows` Python client is auto-generated and its version needs to be compatible with the Argo Workflows server it connects to. Significant version mismatches can lead to API errors or `AttributeError` for missing/changed fields in models.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Verify `ARGO_WORKFLOWS_HOST` (e.g., `http://localhost:2746` or `https://argo.example.com`). Ensure `ARGO_WORKFLOWS_TOKEN` (for bearer token auth) or other credentials are correct. For SSL issues, either configure `verify_ssl=True` with `ssl_ca_cert` pointing to your CA certificate or, for development, set `verify_ssl=False` (not recommended for production).","message":"Incorrect host URL or authentication details are common causes of connection failures. SSL certificate verification can also be an issue in non-standard environments.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Refer to the Argo Workflows API documentation for the exact schema of workflow objects. Check error messages carefully for missing fields. For advanced use cases or custom resource definitions, consider setting `client_side_validation=False` on the Configuration object if you understand the implications.","message":"When constructing workflow objects, it's easy to miss required fields or provide incorrect types, leading to validation errors (either client-side or server-side). The client-side validation is enabled by default.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Check that the `ARGO_WORKFLOWS_TOKEN` environment variable is set and contains a valid bearer token for the Argo Workflows API. Ensure the token has the necessary permissions. If using other authentication methods, verify those credentials.","cause":"The API client failed to authenticate with the Argo Workflows server.","error":"argo_workflows.ApiException: (401) Reason: Unauthorized"},{"fix":"Set `verify_ssl=True` in your `Configuration` and provide the path to your CA certificate via `ssl_ca_cert`. Alternatively, if you understand the security risks and for development purposes, set `verify_ssl=False`.","cause":"SSL certificate verification failed, often due to a mismatch between the hostname in the certificate and the host URL or an untrusted certificate.","error":"urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(...) Read timed out. (Caused by SSLError(CertificateError(\"hostname '...' doesn't match '...'\",)))"},{"fix":"Verify that your `argo-workflows` client version is compatible with your Argo Workflows server version. Update or downgrade the client as necessary. Double-check the attribute name against the official Argo Workflows API documentation.","cause":"The client version used has a different API specification (e.g., a newer or older Argo Workflows server version) than expected, or there's a typo in the attribute name.","error":"AttributeError: module 'argo_workflows.model.io_argoproj_workflow_v1alpha1_workflow_spec' has no attribute 'entrypoint'"},{"fix":"Ensure all required nested objects (e.g., `metadata`, `spec`, `templates`) are properly initialized when constructing workflow requests. For API responses, add checks for `None` before accessing attributes or dict keys.","cause":"Attempting to access an item (e.g., `workflow.metadata['name']`) on an object that is `None`, often because a required nested object was not initialized or returned `None` from an API call.","error":"TypeError: 'NoneType' object is not subscriptable"}]}