{"id":2557,"library":"kfp-server-api","title":"Kubeflow Pipelines Server API","description":"The `kfp-server-api` library provides a Python client for interacting directly with the Kubeflow Pipelines (KFP) v2 server API. It offers low-level access to KFP resources like pipelines, runs, and experiments, suitable for advanced integrations or custom automation. It is part of the KFP SDK v2 ecosystem, currently at version 2.16.0, and typically released in lockstep with the main `kfp` SDK.","status":"active","version":"2.16.0","language":"en","source_language":"en","source_url":"https://github.com/kubeflow/pipelines","tags":["kubeflow","pipelines","mlops","api-client","machine-learning"],"install":[{"cmd":"pip install kfp-server-api==2.16.0","lang":"bash","label":"Install specific version"},{"cmd":"pip install kfp # This will pull in kfp-server-api as a dependency","lang":"bash","label":"Install KFP SDK (recommended for most users)"}],"dependencies":[],"imports":[{"note":"Top-level import for Configuration is preferred for v2 client.","wrong":"from kfp_server_api.swagger_client.configuration import Configuration","symbol":"Configuration","correct":"from kfp_server_api import Configuration"},{"symbol":"ApiClient","correct":"from kfp_server_api import ApiClient"},{"symbol":"PipelineServiceApi","correct":"from kfp_server_api.api.pipeline_service_api import PipelineServiceApi"},{"symbol":"RunServiceApi","correct":"from kfp_server_api.api.run_service_api import RunServiceApi"},{"symbol":"ExperimentServiceApi","correct":"from kfp_server_api.api.experiment_service_api import ExperimentServiceApi"},{"symbol":"V2beta1Pipeline","correct":"from kfp_server_api.models import V2beta1Pipeline"}],"quickstart":{"code":"import os\nfrom kfp_server_api import Configuration, ApiClient\nfrom kfp_server_api.api.pipeline_service_api import PipelineServiceApi\n\n# Replace with your KFP API endpoint. E.g., 'http://localhost:8080/pipeline'\n# or 'https://<your-kfp-host>/pipeline'\nKFP_HOST = os.environ.get('KFP_SERVER_API_HOST', 'http://localhost:8080')\n\n# Configure API key authorization: Bearer\n# For most KFP deployments, you might need a service account token or session cookie.\n# Example for no auth or basic local setup:\nconfiguration = Configuration(host=KFP_HOST)\n\n# For token-based auth (e.g., from a service account or user session):\n# KFP_API_TOKEN = os.environ.get('KFP_SERVER_API_TOKEN')\n# if KFP_API_TOKEN:\n#     configuration.access_token = KFP_API_TOKEN\n\n# Create an API client\nwith ApiClient(configuration) as api_client:\n    # Create an instance of the PipelineServiceApi\n    pipeline_api = PipelineServiceApi(api_client)\n\n    try:\n        # List pipelines (requires appropriate authentication and permissions)\n        list_response = pipeline_api.list_pipelines()\n        print(f\"Successfully connected to KFP API host: {KFP_HOST}\")\n        print(f\"Found {len(list_response.pipelines or [])} pipelines.\")\n        for p in (list_response.pipelines or []):\n            print(f\"  - {p.display_name} (ID: {p.pipeline_id})\")\n    except Exception as e:\n        print(f\"Error connecting to KFP API or listing pipelines: {e}\")\n        print(\"Make sure KFP_SERVER_API_HOST is correctly set and you have necessary authentication.\")\n","lang":"python","description":"This quickstart demonstrates how to initialize the `kfp-server-api` client, configure its host, and make a basic call to list pipelines. It assumes KFP is running and accessible at the specified host. For production deployments, robust authentication (e.g., OAuth2, Bearer tokens from service accounts) would be required, which needs to be configured in the `Configuration` object."},"warnings":[{"fix":"Rewrite client code to use the KFP v2 API patterns and models. Refer to the KFP v2 SDK documentation for updated API specifications and client usage.","message":"The `kfp-server-api` library is built for Kubeflow Pipelines v2. Code written for KFP v1 client libraries (e.g., `kubeflow-pipelines` or older `kfp` versions) will likely be incompatible due to significant changes in API contracts, models, and service endpoints.","severity":"breaking","affected_versions":"All versions 2.x.x (compared to v1.x.x)"},{"fix":"Set `Configuration.host` to the KFP API endpoint and populate `Configuration.access_token` or other credential fields. For GCP, consider `google-auth` mechanisms. Ensure proper network access to the KFP backend.","message":"Direct usage of `kfp-server-api` requires explicit management of authentication and API endpoints. Unlike the higher-level `kfp` SDK, which often infers these from the environment or provides simpler `Client` objects, you must manually configure bearer tokens, cookies, or other authentication methods.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always install `kfp-server-api` at the exact same version as your `kfp` SDK package (e.g., `pip install kfp-server-api==2.16.0 kfp==2.16.0`). Regularly update both together to match your KFP server deployment.","message":"For stability, it is crucial to ensure that the `kfp-server-api` version aligns with the version of the `kfp` SDK and the KFP backend server you are interacting with. Mismatched versions can lead to deserialization errors, unexpected API behavior, or missing features.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}