Fleet Python SDK

raw JSON →
0.2.126 verified Sat May 09 auth: no python

Python SDK for interacting with Fleet environments. Currently at version 0.2.126, actively maintained. Provides client for task execution, file management, and environment metadata. Releases are frequent (multiple per week). Requires Python >=3.9.

pip install fleet-python
error ModuleNotFoundError: No module named 'fleet_python'
cause Package is imported as 'fleet', not 'fleet_python'. The PyPI name fleet-python does not match the import name.
fix
Use 'import fleet' or 'from fleet import FleetClient'.
error AttributeError: 'FleetClient' object has no attribute 'list_tasks'
cause Method may have been renamed or moved to a submodule in newer versions. Check the current API documentation.
fix
Use 'client.tasks.list()' or refer to the official docs for the correct method.
error TypeError: __init__() missing 1 required positional argument: 'api_key'
cause api_key is a required parameter since version 0.2.100.
fix
Pass api_key='your_key' to FleetClient constructor.
breaking In version 0.2.106, metadata fields were consolidated. Code relying on deprecated field names (e.g., 'task_type') may break. Use the new unified 'metadata' dictionary.
fix Update attribute access to use metadata dict: task.metadata.get('field_name') instead of task.field_name.
deprecated The old pattern of instantiating FleetClient without an explicit base_url may stop working in future releases.
fix Always pass base_url parameter. Use the default only if you are targeting Fleet Cloud.
gotcha The SDK uses httpx for async by default. Using blocking calls in an async event loop can lead to performance issues.
fix Use await client.some_async_method() inside async functions, or ensure you are using the synchronous client correctly.

Initialize FleetClient and list tasks. Ensure FLEET_API_KEY and optionally FLEET_BASE_URL are set as environment variables.

import os
from fleet import FleetClient

client = FleetClient(
    api_key=os.environ.get('FLEET_API_KEY', ''),
    base_url=os.environ.get('FLEET_BASE_URL', 'https://api.fleet.com')
)
try:
    tasks = client.list_tasks()
    print(tasks)
except Exception as e:
    print(f'Error: {e}')