# Agent


# Agent

class

prefect.agent.agent.Agent

(agent_config_id=None, name=None, labels=None, env_vars=None, max_polls=None, agent_address=None, no_cloud_logs=None)[source]

Base class for Agents. Information on using the Prefect agents can be found at https://docs.prefect.io/orchestration/agents/overview.html

This Agent class is a standard point for executing Flows through the Prefect API. It is meant to have subclasses which inherit functionality from this class. The only piece that the subclasses should implement is the deploy_flows function, which specifies how to run a Flow on the given platform. It is built in this way to keep Prefect API logic standard but allows for platform specific customizability.

Args:

  • agent_config_id (str, optional): An optional agent configuration ID that can be used to set configuration based on an agent from a backend API. If set, all configuration values will be pulled from backend agent configuration. If not set, any manual kwargs will be used.
  • name (str, optional): An optional name to give this agent. Can also be set through the environment variable PREFECT__CLOUD__AGENT__NAME. Defaults to "agent"
  • labels (List[str], optional): a list of labels, which are arbitrary string identifiers used by Prefect Agents when polling for work
  • env_vars (dict, optional): a dictionary of environment variables and values that will be set on each flow run that this agent submits for execution
  • max_polls (int, optional): maximum number of times the agent will poll the Prefect API for flow runs; defaults to infinite
  • agent_address (str, optional): Address to serve internal api at. Currently this is just health checks for use by an orchestration layer. Leave blank for no api server (default).
  • no_cloud_logs (bool, optional): Disable logging to a Prefect backend for this agent and all deployed flow runs

methods:                                                                                                                                                       

prefect.agent.agent.Agent.start

()[source]

The main entrypoint to the agent process. Sets up the agent then continuously polls for work to submit.

This is the only method that should need to be called externally.



This documentation was auto-generated from commit ffa9a6c
on February 1, 2023 at 18:44 UTC