{"id":5065,"library":"spotinst-agent","title":"Spotinst Agent","description":"The `spotinst-agent` is a Python-based executor designed as a spectrum instance agent. Its primary function is to run remote scripts, collect data, and deploy applications on machines using a polling architecture. It's an active project, with version 1.1.260 released in June 2024, and appears to follow a regular release cadence.","status":"active","version":"1.1.260","language":"en","source_language":"en","source_url":"https://github.com/spotinst/spotinst-spectrum-agent","tags":["cloud management","agent","spot instances","automation","remote execution","devops","monitoring"],"install":[{"cmd":"pip install spotinst-agent","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"note":"This package is designed as a deployed agent, configured via YAML files, rather than a library for direct programmatic import and use within other Python applications. For API interaction with Spotinst services, consider `spotinst-sdk` or `spotinst-sdk2`.","symbol":"spotinst-agent","correct":"The `spotinst-agent` package is primarily an executable agent/service, not typically imported directly as a Python library for programmatic interaction. Its functionality is exposed via deployment and configuration rather than a Python API."}],"quickstart":{"code":"# Install the agent\npip install spotinst-agent\n\n# The Spotinst agent is typically run as a service or within a container.\n# Its configuration is handled via YAML files (e.g., 'agent.yml') and worker configurations.\n# Direct Python code interaction for 'spotinst-agent' itself is uncommon.\n#\n# Example of how you might *start* the agent process (conceptual, actual command depends on deployment):\n# This usually involves running a command-line utility or daemonizing a script provided by the package.\n# For example, if it had a main entry point:\n# python -m spotinst_agent.main --config /path/to/agent.yml\n#\n# For interacting with Spotinst APIs programmatically, use the Spotinst SDK:\n# import os\n# from spotinst_sdk import SpotinstClient\n# \n# # Authenticate using environment variables (recommended for quickstart)\n# # export SPOTINST_TOKEN='YOUR_SPOTINST_API_TOKEN'\n# # export SPOTINST_ACCOUNT='YOUR_SPOTINST_ACCOUNT_ID'\n# \n# client = SpotinstClient(\n#     auth_token=os.environ.get('SPOTINST_TOKEN', 'YOUR_SPOTINST_API_TOKEN'),\n#     account_id=os.environ.get('SPOTINST_ACCOUNT', 'YOUR_SPOTINST_ACCOUNT_ID')\n# )\n# # Example: fetch all Elastigroups (this requires spotinst-sdk, not spotinst-agent)\n# # elastigroups = client.get_all_elastigroups()\n# # print(elastigroups)","lang":"python","description":"The `spotinst-agent` is primarily installed and deployed as a service, with its behavior configured through YAML files rather than direct Python API calls. The quickstart focuses on installation and a conceptual understanding of its operation. For programmatic interaction with Spotinst services, users should refer to the `spotinst-sdk` or `spotinst-sdk2` libraries."},"warnings":[{"fix":"Ensure your environment's Python version is compatible. Consider using a dedicated virtual environment. For new projects, evaluate if `spotinst-sdk` or `spotinst-sdk2` (which are Python 3-native) better suit your needs for API interaction.","message":"The `spotinst-agent` PyPI package was uploaded using `CPython/2.7.18` and does not explicitly declare a `requires_python` version. This suggests it might have been developed for or is compatible with Python 2.7, which is end-of-life. Users on modern Python 3 environments should test compatibility carefully, as other Spotinst Python libraries (like `spotinst-sdk2`) require Python 3.7+.","severity":"gotcha","affected_versions":"<=1.1.260"},{"fix":"Thoroughly review the agent's documentation for correct YAML configuration syntax and best practices. Use version control for configuration files and validate them before deployment.","message":"The `spotinst-agent` is a configuration-driven service, relying on YAML files like `agent.yml` for global settings and specific worker configurations. Misconfigurations in these files are a common source of operational issues, rather than code-level errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Clearly define your use case: if you need to manage Spotinst resources programmatically, use `spotinst-sdk` or `spotinst-sdk2`. If you need an agent running on an instance to perform tasks, `spotinst-agent` is the correct package.","message":"Users often confuse `spotinst-agent` with the `spotinst-sdk` or `spotinst-sdk2` Python libraries. `spotinst-agent` is a deployed service for executing scripts, while the SDKs provide programmatic access to Spotinst (now Spot) APIs for managing cloud resources.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Follow the documented credential precedence. For quick setups, use environment variables (`export SPOTINST_TOKEN=...`, `export SPOTINST_ACCOUNT=...`). For production, consider using a shared credentials file or IAM roles where applicable.","message":"Authentication for Spotinst services (including potentially the agent's internal operations or related tools like `spotctl`) often relies on a specific precedence for credentials: parameters in a client object, environment variables (`SPOTINST_TOKEN`, `SPOTINST_ACCOUNT`), or a shared credentials file (`~/.spotinst/credentials`). Incorrectly set or conflicting credentials can lead to authentication failures.","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"}