{"id":4816,"library":"truefoundry-sdk","title":"TrueFoundry SDK","description":"The TrueFoundry Python SDK provides convenient access to the TrueFoundry API, enabling users to programmatically interact with the platform. It supports managing applications, deployments, workspaces, and offers capabilities for ML experiment tracking and interacting with ML repositories. The SDK is currently at version 0.2.0 and has an active release cadence, with frequent updates. It is designed to work with the TrueFoundry MLOps platform, which includes an AI Gateway, deployment tools, and observability features.","status":"active","version":"0.2.0","language":"en","source_language":"en","source_url":"https://github.com/truefoundry/truefoundry-python-sdk","tags":["MLOps","AI","SDK","API client","cloud platform","machine learning","deployments"],"install":[{"cmd":"pip install truefoundry-sdk","lang":"bash","label":"Install core SDK"}],"dependencies":[{"reason":"Required Python version.","package":"python","version":">=3.8, <3.15"},{"reason":"Used internally for HTTP requests and advanced client customization.","package":"httpx","optional":false}],"imports":[{"note":"Main client for interacting with TrueFoundry platform services like applications, users, etc.","symbol":"TrueFoundry","correct":"from truefoundry_sdk import TrueFoundry"},{"note":"Used for ML-specific functionalities like experiment tracking and ML repositories.","symbol":"get_client","correct":"from truefoundry.ml import get_client"}],"quickstart":{"code":"import os\nfrom truefoundry_sdk import TrueFoundry\n\n# It's recommended to store API keys securely, e.g., via environment variables.\nAPI_KEY = os.environ.get('TRUEFOUNDRY_API_KEY', 'YOUR_TRUEFOUNDRY_API_KEY')\n# The base_url should point to your TrueFoundry instance or Gateway.\nBASE_URL = os.environ.get('TRUEFOUNDRY_BASE_URL', 'https://api.truefoundry.com')\n\nif API_KEY == 'YOUR_TRUEFOUNDRY_API_KEY':\n    print(\"Warning: Please replace 'YOUR_TRUEFOUNDRY_API_KEY' with your actual API key or set the TRUEFOUNDRY_API_KEY environment variable.\")\nif BASE_URL == 'https://api.truefoundry.com':\n    print(\"Note: Using default TrueFoundry API base URL. Adjust TRUEFOUNDRY_BASE_URL if needed.\")\n\nclient = TrueFoundry(\n    api_key=API_KEY,\n    base_url=BASE_URL,\n)\n\ntry:\n    # Example: List applications in a workspace\n    # Replace 'your-workspace-fqn' with an actual workspace FQN from your TrueFoundry setup\n    applications_page = client.applications.list(workspace_fqn='your-workspace-fqn', limit=1)\n    print(f\"Found {len(applications_page.items)} application(s) in workspace 'your-workspace-fqn'.\")\n    if applications_page.items:\n        print(f\"First application name: {applications_page.items[0].name}\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure 'your-workspace-fqn' is a valid workspace and your API key and base URL are correct.\")","lang":"python","description":"Initializes the TrueFoundry client using an API key and base URL. It then demonstrates how to list applications within a specified workspace. Remember to replace placeholder values with your actual TrueFoundry API key and workspace FQN, preferably by using environment variables."},"warnings":[{"fix":"Remove the `include_virtual_accounts` argument from calls to `client.users.list()`.","message":"The `include_virtual_accounts` parameter has been removed from `client.users.list()`. Calling this method with the removed parameter will result in a `TypeError`.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Review your code for usage of TrueFoundry SDK type fields and update according to the latest SDK documentation or by inspecting the new data structures if your code relies on them.","message":"Some type fields have been removed in version 0.2.0. Specific details on which fields are affected are not provided in the release notes snippet, but this indicates potential changes in data structures returned by the API.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"For contributions, it is recommended to open an issue first to discuss changes. Contributions to the README are generally welcome and do not face this issue.","message":"The TrueFoundry Python SDK is programmatically generated. Direct contributions or modifications to the library's source code will likely be overwritten in subsequent releases.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be mindful of which client (`TrueFoundry` from `truefoundry_sdk` or `get_client()` from `truefoundry.ml`) is appropriate for your desired interaction (e.g., platform management vs. ML experiment tracking).","message":"There are two main ways to interact: the `truefoundry_sdk.TrueFoundry` client for general platform interactions (applications, users) and `truefoundry.ml.get_client()` for ML-specific functionalities (experiment tracking, ML repositories). Using the wrong client for a specific task can lead to errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always ensure your `api_key` is valid and your `base_url` correctly points to the intended TrueFoundry endpoint or Gateway. Use environment variables for sensitive credentials.","message":"Proper configuration of `api_key` and `base_url` is crucial. The `base_url` might vary depending on whether you are interacting with your TrueFoundry instance directly or through the TrueFoundry AI Gateway, especially when integrating with other SDKs like OpenAI or Anthropic.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}