From 4dd0bd0085d802f17df9a89a713616dfbbbd2c98 Mon Sep 17 00:00:00 2001 From: nikki everett Date: Thu, 1 Feb 2024 16:23:15 -0600 Subject: [PATCH 01/25] small update to start PR Signed-off-by: nikki everett --- docs/deployment/agents/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deployment/agents/index.md b/docs/deployment/agents/index.md index e27644570a..8bd171d349 100644 --- a/docs/deployment/agents/index.md +++ b/docs/deployment/agents/index.md @@ -4,7 +4,7 @@ .. tags:: Agent, Integration, Data, Advanced -Discover the process of setting up Agents for Flyte. +To set configure your Flyte deployment for agents, see the documentation below. ```{list-table} :header-rows: 0 From d3171134cb99c95f9cbdbe46db2e72e927a985bc Mon Sep 17 00:00:00 2001 From: nikki everett Date: Fri, 2 Feb 2024 11:29:12 -0600 Subject: [PATCH 02/25] add airflow and snowflake agent pages and update existing agents docs Signed-off-by: nikki everett --- docs/deployment/agents/airflow.rst | 6 ++++++ docs/deployment/agents/bigquery.rst | 2 +- docs/deployment/agents/databricks.rst | 2 +- docs/deployment/agents/index.md | 19 ++++++++++++------- docs/deployment/agents/sensor.rst | 10 +++++----- docs/deployment/agents/snowflake.rst | 6 ++++++ 6 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 docs/deployment/agents/airflow.rst create mode 100644 docs/deployment/agents/snowflake.rst diff --git a/docs/deployment/agents/airflow.rst b/docs/deployment/agents/airflow.rst new file mode 100644 index 0000000000..c5a146894f --- /dev/null +++ b/docs/deployment/agents/airflow.rst @@ -0,0 +1,6 @@ +.. _deployment-agent-setup-airflow: + +Airflow agent +================= + +This guide provides an overview of how to set up the Airflow agent in your Flyte deployment. diff --git a/docs/deployment/agents/bigquery.rst b/docs/deployment/agents/bigquery.rst index 9835c3d47a..a548538d66 100644 --- a/docs/deployment/agents/bigquery.rst +++ b/docs/deployment/agents/bigquery.rst @@ -1,6 +1,6 @@ .. _deployment-agent-setup-bigquery: -Google BigQuery Agent +Google BigQuery agent ====================== This guide provides an overview of setting up BigQuery agent in your Flyte deployment. diff --git a/docs/deployment/agents/databricks.rst b/docs/deployment/agents/databricks.rst index 00a5e97a47..4a3ce6dbeb 100644 --- a/docs/deployment/agents/databricks.rst +++ b/docs/deployment/agents/databricks.rst @@ -1,6 +1,6 @@ .. _deployment-agent-setup-databricks: -Databricks Agent +Databricks agent ================= This guide provides an overview of how to set up Databricks agent in your Flyte deployment. diff --git a/docs/deployment/agents/index.md b/docs/deployment/agents/index.md index 8bd171d349..45b14394da 100644 --- a/docs/deployment/agents/index.md +++ b/docs/deployment/agents/index.md @@ -2,7 +2,8 @@ # Agent Setup -.. tags:: Agent, Integration, Data, Advanced +```{tags} Agent, Integration, Data, Advanced +``` To set configure your Flyte deployment for agents, see the documentation below. @@ -10,14 +11,16 @@ To set configure your Flyte deployment for agents, see the documentation below. :header-rows: 0 :widths: 20 30 +* - {ref}`Airflow Agent ` + - Configuring your Flyte deployment for the Airflow agent * - {ref}`Bigquery Agent ` - - Guide to setting up the Bigquery agent. + - Configuring your Flyte deployment for the Bigquery agent. +* - {ref}`Databricks Agent ` + - Configuring your Flyte deployment for the Databricks agent. * - {ref}`MMCloud Agent ` - - Guide to setting up the MMCloud agent. + - Configuring your Flyte deployment for the MMCloud agent. * - {ref}`Sensor Agent ` - - Guide to setting up the Sensor agent. -* - {ref}`Databricks Agent ` - - Guide to setting up the Databricks agent. + - Configuring your Flyte deployment for the sensor agent. ``` ```{toctree} @@ -25,8 +28,10 @@ To set configure your Flyte deployment for agents, see the documentation below. :name: Agent setup :hidden: +airflow bigquery -mmcloud databricks +mmcloud sensor +snowflake ``` diff --git a/docs/deployment/agents/sensor.rst b/docs/deployment/agents/sensor.rst index ecb45e426f..ccd6a09db0 100644 --- a/docs/deployment/agents/sensor.rst +++ b/docs/deployment/agents/sensor.rst @@ -1,13 +1,13 @@ .. _deployment-agent-setup-sensor: -Sensor Agent +Sensor agent ================= -Sensor enables users to continuously check for a file or a condition to be met periodically. +The sensor agent enables users to continuously check for a file or a condition to be met periodically. When the condition is met, the sensor will complete. -This guide provides an overview of how to set up Sensor in your Flyte deployment. +This guide provides an overview of how to set up the sensor agent in your Flyte deployment. Spin up a cluster ----------------- @@ -43,7 +43,7 @@ Spin up a cluster Specify agent configuration ---------------------------- -Enable the Sensor agent by adding the following config to the relevant YAML file(s): +Enable the sensor agent by adding the following config to the relevant YAML file(s): .. tabs:: @@ -77,7 +77,7 @@ Enable the Sensor agent by adding the following config to the relevant YAML file .. group-tab:: Flyte core - Create a file named ``values-override.yaml`` and add the following configuration to it. + Create a file named ``values-override.yaml`` and add the following configuration to it: .. code-block:: yaml diff --git a/docs/deployment/agents/snowflake.rst b/docs/deployment/agents/snowflake.rst new file mode 100644 index 0000000000..48818ac4dc --- /dev/null +++ b/docs/deployment/agents/snowflake.rst @@ -0,0 +1,6 @@ +.. _deployment-agent-setup-snowflake: + +Snowflake agent +================= + +This guide provides an overview of how to set up the Snowflake agent in your Flyte deployment. \ No newline at end of file From dd90f6b692ba947a56ddb1d7db88ef9023daf3d7 Mon Sep 17 00:00:00 2001 From: nikki everett Date: Fri, 2 Feb 2024 14:39:11 -0600 Subject: [PATCH 03/25] small updates Signed-off-by: nikki everett --- docs/deployment/agents/airflow.rst | 5 +++++ docs/deployment/agents/index.md | 10 +++++++--- docs/deployment/agents/snowflake.rst | 7 ++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/docs/deployment/agents/airflow.rst b/docs/deployment/agents/airflow.rst index c5a146894f..9db7554cd6 100644 --- a/docs/deployment/agents/airflow.rst +++ b/docs/deployment/agents/airflow.rst @@ -4,3 +4,8 @@ Airflow agent ================= This guide provides an overview of how to set up the Airflow agent in your Flyte deployment. + +Specify agent configuration +---------------------------- + +TK diff --git a/docs/deployment/agents/index.md b/docs/deployment/agents/index.md index 45b14394da..0e114c8d06 100644 --- a/docs/deployment/agents/index.md +++ b/docs/deployment/agents/index.md @@ -7,16 +7,20 @@ To set configure your Flyte deployment for agents, see the documentation below. +:::{note} +If you are using a managed deployment of Flyte, you will need to contact your deployment administrator to configure agents in your deployment. +::: + ```{list-table} :header-rows: 0 :widths: 20 30 * - {ref}`Airflow Agent ` - Configuring your Flyte deployment for the Airflow agent -* - {ref}`Bigquery Agent ` - - Configuring your Flyte deployment for the Bigquery agent. * - {ref}`Databricks Agent ` - Configuring your Flyte deployment for the Databricks agent. +* - {ref}`Google BigQuery Agent ` + - Configuring your Flyte deployment for the BigQuery agent. * - {ref}`MMCloud Agent ` - Configuring your Flyte deployment for the MMCloud agent. * - {ref}`Sensor Agent ` @@ -29,8 +33,8 @@ To set configure your Flyte deployment for agents, see the documentation below. :hidden: airflow -bigquery databricks +bigquery mmcloud sensor snowflake diff --git a/docs/deployment/agents/snowflake.rst b/docs/deployment/agents/snowflake.rst index 48818ac4dc..7b527469c6 100644 --- a/docs/deployment/agents/snowflake.rst +++ b/docs/deployment/agents/snowflake.rst @@ -3,4 +3,9 @@ Snowflake agent ================= -This guide provides an overview of how to set up the Snowflake agent in your Flyte deployment. \ No newline at end of file +This guide provides an overview of how to set up the Snowflake agent in your Flyte deployment. + +Specify agent configuration +---------------------------- + +TK \ No newline at end of file From 9aac0e86fcc4f344a6e093ee8fec96857be014da Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Mon, 5 Feb 2024 12:06:19 -0800 Subject: [PATCH 04/25] [Doc] Airflow agent deployment (#4831) Signed-off-by: Kevin Su --- docs/deployment/agents/airflow.rst | 88 +++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/docs/deployment/agents/airflow.rst b/docs/deployment/agents/airflow.rst index 9db7554cd6..5da009ef0c 100644 --- a/docs/deployment/agents/airflow.rst +++ b/docs/deployment/agents/airflow.rst @@ -4,8 +4,94 @@ Airflow agent ================= This guide provides an overview of how to set up the Airflow agent in your Flyte deployment. +Please note that the you don't need an Airflow cluster to run the airflow tasks. Flytekit will +automatically compile it to a Flyte task and execute it on the Flyte cluster. Specify agent configuration ---------------------------- -TK +.. tabs:: + + .. group-tab:: Flyte binary + + Edit the relevant YAML file to specify the agent. + + .. code-block:: bash + + kubectl edit configmap flyte-sandbox-config -n flyte + + .. code-block:: yaml + :emphasize-lines: 7,11,16 + + tasks: + task-plugins: + enabled-plugins: + - container + - sidecar + - k8s-array + - agent-service + default-for-task-types: + - container: container + - container_array: k8s-array + - airflow: agent-service + + plugins: + agent-service: + supportedTaskTypes: + - airflow + + .. group-tab:: Flyte core + + Create a file named ``values-override.yaml`` and add the following configuration to it. + + .. code-block:: yaml + + configmap: + enabled_plugins: + # -- Tasks specific configuration [structure](https://pkg.go.dev/github.com/flyteorg/flytepropeller/pkg/controller/nodes/task/config#GetConfig) + tasks: + # -- Plugins configuration, [structure](https://pkg.go.dev/github.com/flyteorg/flytepropeller/pkg/controller/nodes/task/config#TaskPluginConfig) + task-plugins: + # -- [Enabled Plugins](https://pkg.go.dev/github.com/flyteorg/flyteplugins/go/tasks/config#Config). Enable sagemaker*, athena if you install the backend + enabled-plugins: + - container + - sidecar + - k8s-array + - agent-service + default-for-task-types: + container: container + sidecar: sidecar + container_array: k8s-array + airflow: agent-service + plugins: + agent-service: + supportedTaskTypes: + - airflow + + +Upgrade the Flyte Helm release +------------------------------ + +.. tabs:: + + .. group-tab:: Flyte binary + + .. code-block:: bash + + helm upgrade flyteorg/flyte-binary -n --values + + Replace ```` with the name of your release (e.g., ``flyte-backend``), + ```` with the name of your namespace (e.g., ``flyte``), + and ```` with the name of your YAML file. + + .. group-tab:: Flyte core + + .. code-block:: bash + + helm upgrade flyte/flyte-core -n --values values-override.yaml + + Replace ```` with the name of your release (e.g., ``flyte``) + + and ```` with the name of your namespace (e.g., ``flyte``). + +For Airflow plugin on the Flyte cluster, please refer to `Airflow Plugin Example `_ From b1ea659632fead780619effc9f344e5438085a9e Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Mon, 5 Feb 2024 12:06:41 -0800 Subject: [PATCH 05/25] [Doc] Snowflake agent deployment (#4832) Signed-off-by: Kevin Su --- docs/deployment/agents/snowflake.rst | 93 +++++++++++++++++++++++++++- 1 file changed, 92 insertions(+), 1 deletion(-) diff --git a/docs/deployment/agents/snowflake.rst b/docs/deployment/agents/snowflake.rst index 7b527469c6..0b9348383f 100644 --- a/docs/deployment/agents/snowflake.rst +++ b/docs/deployment/agents/snowflake.rst @@ -5,7 +5,98 @@ Snowflake agent This guide provides an overview of how to set up the Snowflake agent in your Flyte deployment. +1. Setup the key pair authentication in snowflake. For more details, you can refer to `here `__. +2. Create a secret with the group "snowflake" and the key "private_key". For more details, you can refer to `here `__. + +.. code-block:: bash + kubectl create secret generic snowflake-private-key --namespace=flytesnacks-development --from-file=your_private_key_above + Specify agent configuration ---------------------------- -TK \ No newline at end of file +.. tabs:: + + .. group-tab:: Flyte binary + + Edit the relevant YAML file to specify the agent. + + .. code-block:: bash + + kubectl edit configmap flyte-sandbox-config -n flyte + + .. code-block:: yaml + :emphasize-lines: 7,11,16 + + tasks: + task-plugins: + enabled-plugins: + - container + - sidecar + - k8s-array + - agent-service + default-for-task-types: + - container: container + - container_array: k8s-array + - snowflake: agent-service + + plugins: + agent-service: + supportedTaskTypes: + - snowflake + + .. group-tab:: Flyte core + + Create a file named ``values-override.yaml`` and add the following configuration to it. + + .. code-block:: yaml + + configmap: + enabled_plugins: + # -- Tasks specific configuration [structure](https://pkg.go.dev/github.com/flyteorg/flytepropeller/pkg/controller/nodes/task/config#GetConfig) + tasks: + # -- Plugins configuration, [structure](https://pkg.go.dev/github.com/flyteorg/flytepropeller/pkg/controller/nodes/task/config#TaskPluginConfig) + task-plugins: + # -- [Enabled Plugins](https://pkg.go.dev/github.com/flyteorg/flyteplugins/go/tasks/config#Config). Enable sagemaker*, athena if you install the backend + enabled-plugins: + - container + - sidecar + - k8s-array + - agent-service + default-for-task-types: + container: container + sidecar: sidecar + container_array: k8s-array + snowflake: agent-service + plugins: + agent-service: + supportedTaskTypes: + - snowflake + +Ensure that the propeller has the correct service account for BigQuery. + +Upgrade the Flyte Helm release +------------------------------ + +.. tabs:: + + .. group-tab:: Flyte binary + + .. code-block:: bash + + helm upgrade flyteorg/flyte-binary -n --values + + Replace ```` with the name of your release (e.g., ``flyte-backend``), + ```` with the name of your namespace (e.g., ``flyte``), + and ```` with the name of your YAML file. + + .. group-tab:: Flyte core + + .. code-block:: bash + + helm upgrade flyte/flyte-core -n --values values-override.yaml + + Replace ```` with the name of your release (e.g., ``flyte``) + + and ```` with the name of your namespace (e.g., ``flyte``). + +For Snowflake plugin on the Flyte cluster, please refer to `Snowflake Plugin Example `_ From eda8951928ecb1f1a4eceeee28a108128be83820 Mon Sep 17 00:00:00 2001 From: nikki everett Date: Mon, 5 Feb 2024 14:32:45 -0600 Subject: [PATCH 06/25] copyedits Signed-off-by: nikki everett --- docs/deployment/agents/airflow.rst | 6 +++--- docs/deployment/agents/bigquery.rst | 2 +- docs/deployment/agents/databricks.rst | 2 +- docs/deployment/agents/mmcloud.rst | 2 +- docs/deployment/agents/snowflake.rst | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/deployment/agents/airflow.rst b/docs/deployment/agents/airflow.rst index 5da009ef0c..fe80efeb01 100644 --- a/docs/deployment/agents/airflow.rst +++ b/docs/deployment/agents/airflow.rst @@ -4,8 +4,8 @@ Airflow agent ================= This guide provides an overview of how to set up the Airflow agent in your Flyte deployment. -Please note that the you don't need an Airflow cluster to run the airflow tasks. Flytekit will -automatically compile it to a Flyte task and execute it on the Flyte cluster. +Please note that the you don't need an Airflow cluster to run the Airflow tasks, since Flytekit will +automatically compile Airflow tasks to Flyte tasks and execute them on the Flyte cluster. Specify agent configuration ---------------------------- @@ -94,4 +94,4 @@ Upgrade the Flyte Helm release and ```` with the name of your namespace (e.g., ``flyte``). -For Airflow plugin on the Flyte cluster, please refer to `Airflow Plugin Example `_ +For Airflow plugin on the Flyte cluster, see `Airflow Plugin Example `_ diff --git a/docs/deployment/agents/bigquery.rst b/docs/deployment/agents/bigquery.rst index a548538d66..a217352945 100644 --- a/docs/deployment/agents/bigquery.rst +++ b/docs/deployment/agents/bigquery.rst @@ -103,4 +103,4 @@ Upgrade the Flyte Helm release and ```` with the name of your namespace (e.g., ``flyte``). -For BigQuery plugin on the Flyte cluster, please refer to `BigQuery Plugin Example `_ +For BigQuery plugin on the Flyte cluster, see `BigQuery Plugin Example `_ diff --git a/docs/deployment/agents/databricks.rst b/docs/deployment/agents/databricks.rst index 4a3ce6dbeb..a803b40526 100644 --- a/docs/deployment/agents/databricks.rst +++ b/docs/deployment/agents/databricks.rst @@ -291,4 +291,4 @@ Wait for the upgrade to complete. You can check the status of the deployment pod kubectl get pods -n flyte -For databricks plugin on the Flyte cluster, please refer to `Databricks Plugin Example `_ +For databricks plugin on the Flyte cluster, see `Databricks Plugin Example `_ diff --git a/docs/deployment/agents/mmcloud.rst b/docs/deployment/agents/mmcloud.rst index 217beab8ed..304f4bef23 100644 --- a/docs/deployment/agents/mmcloud.rst +++ b/docs/deployment/agents/mmcloud.rst @@ -118,4 +118,4 @@ Wait for the upgrade to complete. You can check the status of the deployment pod kubectl get pods -n flyte -For MMCloud plugin on the Flyte cluster, please refer to `Memory Machine Cloud Plugin Example `_ +For MMCloud plugin on the Flyte cluster, see `Memory Machine Cloud Plugin Example `_ diff --git a/docs/deployment/agents/snowflake.rst b/docs/deployment/agents/snowflake.rst index 0b9348383f..9005756051 100644 --- a/docs/deployment/agents/snowflake.rst +++ b/docs/deployment/agents/snowflake.rst @@ -5,8 +5,8 @@ Snowflake agent This guide provides an overview of how to set up the Snowflake agent in your Flyte deployment. -1. Setup the key pair authentication in snowflake. For more details, you can refer to `here `__. -2. Create a secret with the group "snowflake" and the key "private_key". For more details, you can refer to `here `__. +1. Set up the key pair authentication in Snowflake. For more details, see the `Snowflake key-pair authentication and key-pair rotation guide `__. +2. Create a secret with the group "snowflake" and the key "private_key". For more details, see `"Using Secrets in a Task" `__. .. code-block:: bash kubectl create secret generic snowflake-private-key --namespace=flytesnacks-development --from-file=your_private_key_above @@ -99,4 +99,4 @@ Upgrade the Flyte Helm release and ```` with the name of your namespace (e.g., ``flyte``). -For Snowflake plugin on the Flyte cluster, please refer to `Snowflake Plugin Example `_ +For Snowflake plugin on the Flyte cluster, see `Snowflake Plugin Example `_ From 3a251a72f00c5dfa78b0ed3181afc9703b2b1d24 Mon Sep 17 00:00:00 2001 From: nikki everett Date: Tue, 6 Feb 2024 13:11:51 -0600 Subject: [PATCH 07/25] move agents guide to flyte Signed-off-by: nikki everett --- ...guring_your_flyte_deployment_for_agents.md | 16 ++++ docs/agents/creating_an_agent.md | 89 +++++++++++++++++++ docs/agents/index.md | 26 ++++++ docs/agents/testing_agents_locally.md | 39 ++++++++ docs/agents/using_agents_in_tasks.md | 14 +++ 5 files changed, 184 insertions(+) create mode 100644 docs/agents/configuring_your_flyte_deployment_for_agents.md create mode 100644 docs/agents/creating_an_agent.md create mode 100644 docs/agents/index.md create mode 100644 docs/agents/testing_agents_locally.md create mode 100644 docs/agents/using_agents_in_tasks.md diff --git a/docs/agents/configuring_your_flyte_deployment_for_agents.md b/docs/agents/configuring_your_flyte_deployment_for_agents.md new file mode 100644 index 0000000000..2d34fc36bd --- /dev/null +++ b/docs/agents/configuring_your_flyte_deployment_for_agents.md @@ -0,0 +1,16 @@ +--- +jupytext: + formats: md:myst + text_representation: + extension: .md + format_name: myst +--- + +(configuring_deployment_for_agents)= +# Configuring your Flyte deployment for agents + +To configure your Flyte deployment for a particular agent, see the [Agent Setup](https://docs.flyte.org/en/latest/deployment/agents/index.html) documentation. + +:::{note} +If you are using a managed deployment of Flyte, you will need to contact your deployment administrator to configure agents in your deployment. +::: diff --git a/docs/agents/creating_an_agent.md b/docs/agents/creating_an_agent.md new file mode 100644 index 0000000000..92ce88c447 --- /dev/null +++ b/docs/agents/creating_an_agent.md @@ -0,0 +1,89 @@ +--- +jupytext: + formats: md:myst + text_representation: + extension: .md + format_name: myst +--- + +(creating_agent)= +# Creating an agent + +The Flyte agent framework enables rapid agent development, since agents are decoupled from the core FlytePropeller engine. Agents can be written in Python, easing development for data scientists. Agents can be tested independently and deployed privately, making maintenance easier and giving you more flexibility and control over development. + +If you need to create a new type of task, we recommend creating a new agent to run it rather than running the task in a pod. After testing the new agent, you can update your FlytePropeller configMap to specify the type of task that the agent should run. + +:::{note} + +While agents can be written in any programming language, we currently only support Python agents. We may support other languages in the future. + +::: + +## Flytekit interface specification + +To create a new agent, extend the `AgentBase` class in the `flytekit.backend` module and implement `create`, `get`, and `delete` methods. All calls must be idempotent. + +- `create`: This method is used to initiate a new task. Users have the flexibility to use gRPC, REST, or an SDK to create a task. +- `get`: This method allows retrieving the job Resource (jobID or output literal) associated with the task, such as a BigQuery Job ID or Databricks task ID. +- `delete`: Invoking this method will send a request to delete the corresponding job. + +```python +from flytekit.extend.backend.base_agent import AgentBase, AgentRegistry +from dataclasses import dataclass +import requests + +@dataclass +class Metadata: + # FlytePropeller will pass the metadata specified in this class to the agent. + # For example, if you add job_id to the metadata, the agent will use the job_id to get the job status. + # If you add s3 file path, the agent will check if the file exists. + job_id: str + +class CustomAgent(AgentBase): + def __init__(self, task_type: str): + # Each agent should have a unique task type. + # The Flyte agent service will use the task type + # to find the corresponding agent. + self._task_type = task_type + + def create( + self, + context: grpc.ServicerContext, + output_prefix: str, + task_template: TaskTemplate, + inputs: typing.Optional[LiteralMap] = None, + ) -> TaskCreateResponse: + # 1. Submit the task to the external service (BigQuery, DataBricks, etc.) + # 2. Create metadata for the task, such as jobID. + # 3. Return the metadata, serialized to bytes. + res = requests.post(url, json=data) + return CreateTaskResponse(resource_meta=json.dumps(asdict(Metadata(job_id=str(res.job_id)))).encode("utf-8")) + + def get(self, context: grpc.ServicerContext, resource_meta: bytes) -> TaskGetResponse: + # 1. Deserialize the metadata. + # 2. Use the metadata to get the job status. + # 3. Return the job status. + metadata = Metadata(**json.loads(resource_meta.decode("utf-8"))) + res = requests.get(url, json={"job_id": metadata.job_id}) + return GetTaskResponse(resource=Resource(state=res.state) + + def delete(self, context: grpc.ServicerContext, resource_meta: bytes) -> TaskDeleteResponse: + # 1. Deserialize the metadata. + # 2. Use the metadata to delete the job. + # 3. If failed to delete the job, add the error message to the grpc context. + # context.set_code(grpc.StatusCode.INTERNAL) + # context.set_details(f"failed to create task with error {e}") + try: + metadata = Metadata(**json.loads(resource_meta.decode("utf-8"))) + requests.delete(url, json={"job_id": metadata.job_id}) + except Exception as e: + logger.error(f"failed to delete task with error {e}") + context.set_code(grpc.StatusCode.INTERNAL) + context.set_details(f"failed to delete task with error {e}") + return DeleteTaskResponse() + +# To register the custom agent +AgentRegistry.register(CustomAgent()) +``` + +For an example implementation, see the [BigQuery Agent](https://github.com/flyteorg/flytekit/blob/9977aac26242ebbede8e00d476c2fbc59ac5487a/plugins/flytekit-bigquery/flytekitplugins/bigquery/agent.py#L35). diff --git a/docs/agents/index.md b/docs/agents/index.md new file mode 100644 index 0000000000..2217711561 --- /dev/null +++ b/docs/agents/index.md @@ -0,0 +1,26 @@ +--- +# override the toc-determined page navigation order +prev-page: getting_started/extending_flyte +prev-page-title: Extending Flyte +--- + +(flyte_agents)= +# Flyte agents + +In Flyte, an agent is a long-running, stateless service powered by a gRPC server. Each agent service is a Kubernetes deployment that receives gRPC requests from FlytePropeller when users trigger a particular type of task (for example, the BigQuery agent handles BigQuery tasks). The agent service then initiates a job with the appropriate external service. You can create different agent services that host different agents, e.g., a production and a development agent service. + +:::{figure} https://i.ibb.co/vXhBDjP/Screen-Shot-2023-05-29-at-2-54-14-PM.png +:alt: Agent Service +:class: with-shadow +::: + + +```{toctree} +:maxdepth: -1 +:hidden: + +using_agents_in_tasks +creating_an_agent +testing_agents_locally +configuring_your_flyte_deployment_for_agents +``` \ No newline at end of file diff --git a/docs/agents/testing_agents_locally.md b/docs/agents/testing_agents_locally.md new file mode 100644 index 0000000000..680dc6d23a --- /dev/null +++ b/docs/agents/testing_agents_locally.md @@ -0,0 +1,39 @@ +--- +jupytext: + formats: md:myst + text_representation: + extension: .md + format_name: myst +--- + +(testing_agents_locally)= +# Testing agents locally + +Agents can be tested locally without running the backend server, which makes agent development easier. + +The task inherited from `AsyncAgentExecutorMixin` can be executed locally, allowing flytekit to mimic FlytePropeller's behavior to call the agent. + +:::{note} + +In some cases, you will need to store credentials in your local environment when testing locally. +For example, you need to set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable when running BigQuery tasks to test the BigQuery agent. + +::: + +Flytekit will automatically call the agent to `create`, `get`, or `delete` the task. + +```python +bigquery_doge_coin = BigQueryTask( + name=f"bigquery.doge_coin", + inputs=kwtypes(version=int), + query_template="SELECT * FROM `bigquery-public-data.crypto_dogecoin.transactions` WHERE version = @version LIMIT 10;", + output_structured_dataset_type=StructuredDataset, + task_config=BigQueryConfig(ProjectID="flyte-test-340607") +) +``` + +You can run the above example task locally and test the agent with the following command: + +```bash +pyflyte run wf.py bigquery_doge_coin --version 10 +``` diff --git a/docs/agents/using_agents_in_tasks.md b/docs/agents/using_agents_in_tasks.md new file mode 100644 index 0000000000..8a3a743507 --- /dev/null +++ b/docs/agents/using_agents_in_tasks.md @@ -0,0 +1,14 @@ +--- +jupytext: + formats: md:myst + text_representation: + extension: .md + format_name: myst +--- + +(using_agents_in_tasks)= +# Using agents in tasks + +If you need to connect to an external service in your workflow, we recommend using the corresponding agent rather than a web API plugin. Agents are designed to be scalable and can handle large workloads efficiently, and decrease load on FlytePropeller, since they run outside of it. You can also test agents locally without having to change the Flyte backend configuration, streamlining development. + +TK - example From f2de03e5449d1b03d2dd9306f668476649c9f759 Mon Sep 17 00:00:00 2001 From: nikki everett Date: Tue, 6 Feb 2024 13:18:08 -0600 Subject: [PATCH 08/25] rename directory and add guide to toctree Signed-off-by: nikki everett --- .../configuring_your_flyte_deployment_for_agents.md | 0 docs/{agents => flyte_agents}/creating_an_agent.md | 0 docs/{agents => flyte_agents}/index.md | 0 docs/{agents => flyte_agents}/testing_agents_locally.md | 0 docs/{agents => flyte_agents}/using_agents_in_tasks.md | 0 docs/index.md | 1 + 6 files changed, 1 insertion(+) rename docs/{agents => flyte_agents}/configuring_your_flyte_deployment_for_agents.md (100%) rename docs/{agents => flyte_agents}/creating_an_agent.md (100%) rename docs/{agents => flyte_agents}/index.md (100%) rename docs/{agents => flyte_agents}/testing_agents_locally.md (100%) rename docs/{agents => flyte_agents}/using_agents_in_tasks.md (100%) diff --git a/docs/agents/configuring_your_flyte_deployment_for_agents.md b/docs/flyte_agents/configuring_your_flyte_deployment_for_agents.md similarity index 100% rename from docs/agents/configuring_your_flyte_deployment_for_agents.md rename to docs/flyte_agents/configuring_your_flyte_deployment_for_agents.md diff --git a/docs/agents/creating_an_agent.md b/docs/flyte_agents/creating_an_agent.md similarity index 100% rename from docs/agents/creating_an_agent.md rename to docs/flyte_agents/creating_an_agent.md diff --git a/docs/agents/index.md b/docs/flyte_agents/index.md similarity index 100% rename from docs/agents/index.md rename to docs/flyte_agents/index.md diff --git a/docs/agents/testing_agents_locally.md b/docs/flyte_agents/testing_agents_locally.md similarity index 100% rename from docs/agents/testing_agents_locally.md rename to docs/flyte_agents/testing_agents_locally.md diff --git a/docs/agents/using_agents_in_tasks.md b/docs/flyte_agents/using_agents_in_tasks.md similarity index 100% rename from docs/agents/using_agents_in_tasks.md rename to docs/flyte_agents/using_agents_in_tasks.md diff --git a/docs/index.md b/docs/index.md index 3a8d38e6ba..f4bb847096 100644 --- a/docs/index.md +++ b/docs/index.md @@ -138,6 +138,7 @@ Introduction Quickstart guide Getting started with workflow development Flyte fundamentals +Flyte agents Core use cases ``` From 543a44eb618b12d749437808317e483b3eee19dd Mon Sep 17 00:00:00 2001 From: nikki everett Date: Fri, 9 Feb 2024 16:01:34 -0600 Subject: [PATCH 09/25] stub out async vs sync agents content Signed-off-by: nikki everett --- docs/flyte_agents/creating_an_agent.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/flyte_agents/creating_an_agent.md b/docs/flyte_agents/creating_an_agent.md index 92ce88c447..4f9f270bdf 100644 --- a/docs/flyte_agents/creating_an_agent.md +++ b/docs/flyte_agents/creating_an_agent.md @@ -11,6 +11,8 @@ jupytext: The Flyte agent framework enables rapid agent development, since agents are decoupled from the core FlytePropeller engine. Agents can be written in Python, easing development for data scientists. Agents can be tested independently and deployed privately, making maintenance easier and giving you more flexibility and control over development. +TK - may need to add content about async vs sync agents here (and possibly in index.md) + If you need to create a new type of task, we recommend creating a new agent to run it rather than running the task in a pod. After testing the new agent, you can update your FlytePropeller configMap to specify the type of task that the agent should run. :::{note} @@ -21,7 +23,9 @@ While agents can be written in any programming language, we currently only suppo ## Flytekit interface specification -To create a new agent, extend the `AgentBase` class in the `flytekit.backend` module and implement `create`, `get`, and `delete` methods. All calls must be idempotent. +### Async agent interface + +To create a new async agent, extend the `AgentBase` class in the `flytekit.backend` module and implement `create`, `get`, and `delete` methods. All calls must be idempotent. - `create`: This method is used to initiate a new task. Users have the flexibility to use gRPC, REST, or an SDK to create a task. - `get`: This method allows retrieving the job Resource (jobID or output literal) associated with the task, such as a BigQuery Job ID or Databricks task ID. @@ -87,3 +91,7 @@ AgentRegistry.register(CustomAgent()) ``` For an example implementation, see the [BigQuery Agent](https://github.com/flyteorg/flytekit/blob/9977aac26242ebbede8e00d476c2fbc59ac5487a/plugins/flytekit-bigquery/flytekitplugins/bigquery/agent.py#L35). + +### Sync agent interface + +TK - just need to implement `execute()` method \ No newline at end of file From 785491f1c6459edd78e1dea3bda10b61e476c620 Mon Sep 17 00:00:00 2001 From: nikki everett Date: Tue, 13 Feb 2024 16:52:33 -0600 Subject: [PATCH 10/25] link to list of agents Signed-off-by: nikki everett --- docs/flyte_agents/using_agents_in_tasks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/flyte_agents/using_agents_in_tasks.md b/docs/flyte_agents/using_agents_in_tasks.md index 8a3a743507..c3dafcacb4 100644 --- a/docs/flyte_agents/using_agents_in_tasks.md +++ b/docs/flyte_agents/using_agents_in_tasks.md @@ -11,4 +11,4 @@ jupytext: If you need to connect to an external service in your workflow, we recommend using the corresponding agent rather than a web API plugin. Agents are designed to be scalable and can handle large workloads efficiently, and decrease load on FlytePropeller, since they run outside of it. You can also test agents locally without having to change the Flyte backend configuration, streamlining development. -TK - example +For a list of agents you can use in your tasks, see the [Agent Setup](https://docs.flyte.org/en/latest/deployment/agents/index.html) documentation. From 64c9dcd805d5b5edabc4d217798b21696b285c21 Mon Sep 17 00:00:00 2001 From: nikki everett Date: Tue, 13 Feb 2024 16:54:51 -0600 Subject: [PATCH 11/25] edits for sync vs async agents Signed-off-by: nikki everett --- docs/flyte_agents/creating_an_agent.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/flyte_agents/creating_an_agent.md b/docs/flyte_agents/creating_an_agent.md index 4f9f270bdf..3ff803fe7c 100644 --- a/docs/flyte_agents/creating_an_agent.md +++ b/docs/flyte_agents/creating_an_agent.md @@ -11,7 +11,7 @@ jupytext: The Flyte agent framework enables rapid agent development, since agents are decoupled from the core FlytePropeller engine. Agents can be written in Python, easing development for data scientists. Agents can be tested independently and deployed privately, making maintenance easier and giving you more flexibility and control over development. -TK - may need to add content about async vs sync agents here (and possibly in index.md) +TK - need to add content about async vs sync agents here (and possibly in index.md) If you need to create a new type of task, we recommend creating a new agent to run it rather than running the task in a pod. After testing the new agent, you can update your FlytePropeller configMap to specify the type of task that the agent should run. @@ -94,4 +94,8 @@ For an example implementation, see the [BigQuery Agent](https://github.com/flyte ### Sync agent interface -TK - just need to implement `execute()` method \ No newline at end of file +TK - just need to implement `execute()` method + +To create a new async agent, extend the `AgentBase` class in the `flytekit.backend` module and implement the `execute` methods. All calls must be idempotent. + +- `execute`: TK \ No newline at end of file From 658e5cec9e733de407cdcb70fc8bda27271f898a Mon Sep 17 00:00:00 2001 From: nikki everett Date: Wed, 14 Feb 2024 15:59:51 -0600 Subject: [PATCH 12/25] add visible TOC table to index page Signed-off-by: nikki everett --- docs/flyte_agents/index.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/flyte_agents/index.md b/docs/flyte_agents/index.md index 2217711561..3b46a51f82 100644 --- a/docs/flyte_agents/index.md +++ b/docs/flyte_agents/index.md @@ -14,6 +14,19 @@ In Flyte, an agent is a long-running, stateless service powered by a gRPC server :class: with-shadow ::: +```{list-table} +:header-rows: 0 +:widths: 20 30 + +* - {doc}`Using agents in tasks ` + - Learn how to use agents to efficiently communicate with external services in your tasks. +* - {doc}`Creating an agent ` + - If the agent you need doesn't exist, follow these steps to create it. +* - {doc}`Testing agents locally ` + - Whether using an existing agent or creating a new one, you can test it locally without needing to configure or run the backend server. +* - {doc}`Configuring your Flyte deployment for agents ` + - Once you have tested an agent locally and want to use it in production, you must configure your Flyte deployment for the agent. +``` ```{toctree} :maxdepth: -1 From e5cd1180dca06ef5a2404d7a18d28483dfa54e52 Mon Sep 17 00:00:00 2001 From: nikki everett Date: Wed, 14 Feb 2024 16:38:07 -0600 Subject: [PATCH 13/25] update for async vs sync tasks Signed-off-by: nikki everett --- docs/flyte_agents/creating_an_agent.md | 24 +++++++++---------- docs/flyte_agents/testing_agents_locally.md | 2 +- docs/flyte_agents/using_agents_in_tasks.md | 2 +- .../index.md | 2 ++ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/flyte_agents/creating_an_agent.md b/docs/flyte_agents/creating_an_agent.md index 3ff803fe7c..d4aa953aeb 100644 --- a/docs/flyte_agents/creating_an_agent.md +++ b/docs/flyte_agents/creating_an_agent.md @@ -6,29 +6,29 @@ jupytext: format_name: myst --- -(creating_agent)= +(creating_an_agent)= # Creating an agent The Flyte agent framework enables rapid agent development, since agents are decoupled from the core FlytePropeller engine. Agents can be written in Python, easing development for data scientists. Agents can be tested independently and deployed privately, making maintenance easier and giving you more flexibility and control over development. -TK - need to add content about async vs sync agents here (and possibly in index.md) - If you need to create a new type of task, we recommend creating a new agent to run it rather than running the task in a pod. After testing the new agent, you can update your FlytePropeller configMap to specify the type of task that the agent should run. +There are two types of agents: **async** and **sync**. +* **Async agents** communicate with external services that have asynchronous APIs that support `create`, `get`, and `delete` operations. The vast majority of agents are async agents. +* **Sync agents** communicate with external services, such as the OpenAI API, that return an immediate response after a job is created. + :::{note} While agents can be written in any programming language, we currently only support Python agents. We may support other languages in the future. ::: -## Flytekit interface specification - -### Async agent interface +## Async agent interface specification To create a new async agent, extend the `AgentBase` class in the `flytekit.backend` module and implement `create`, `get`, and `delete` methods. All calls must be idempotent. -- `create`: This method is used to initiate a new task. Users have the flexibility to use gRPC, REST, or an SDK to create a task. -- `get`: This method allows retrieving the job Resource (jobID or output literal) associated with the task, such as a BigQuery Job ID or Databricks task ID. +- `create`: This method is used to initiate a new job. Users have the flexibility to use gRPC, REST, or an SDK to create a job. +- `get`: This method retrieves the job resource (jobID or output literal) associated with the task, such as a BigQuery job ID or Databricks task ID. - `delete`: Invoking this method will send a request to delete the corresponding job. ```python @@ -92,10 +92,8 @@ AgentRegistry.register(CustomAgent()) For an example implementation, see the [BigQuery Agent](https://github.com/flyteorg/flytekit/blob/9977aac26242ebbede8e00d476c2fbc59ac5487a/plugins/flytekit-bigquery/flytekitplugins/bigquery/agent.py#L35). -### Sync agent interface - -TK - just need to implement `execute()` method +## Sync agent interface specification -To create a new async agent, extend the `AgentBase` class in the `flytekit.backend` module and implement the `execute` methods. All calls must be idempotent. +To create a new async agent, extend the `AgentBase` class in the `flytekit.backend` module and implement the `execute` method. -- `execute`: TK \ No newline at end of file +- `execute`: This method is used to initiate a new job and return the response. \ No newline at end of file diff --git a/docs/flyte_agents/testing_agents_locally.md b/docs/flyte_agents/testing_agents_locally.md index 680dc6d23a..3bc0bfa82f 100644 --- a/docs/flyte_agents/testing_agents_locally.md +++ b/docs/flyte_agents/testing_agents_locally.md @@ -9,7 +9,7 @@ jupytext: (testing_agents_locally)= # Testing agents locally -Agents can be tested locally without running the backend server, which makes agent development easier. +Agents can be tested locally without configuring or running the backend server, which makes agent development easier. The task inherited from `AsyncAgentExecutorMixin` can be executed locally, allowing flytekit to mimic FlytePropeller's behavior to call the agent. diff --git a/docs/flyte_agents/using_agents_in_tasks.md b/docs/flyte_agents/using_agents_in_tasks.md index c3dafcacb4..6147a6ed06 100644 --- a/docs/flyte_agents/using_agents_in_tasks.md +++ b/docs/flyte_agents/using_agents_in_tasks.md @@ -11,4 +11,4 @@ jupytext: If you need to connect to an external service in your workflow, we recommend using the corresponding agent rather than a web API plugin. Agents are designed to be scalable and can handle large workloads efficiently, and decrease load on FlytePropeller, since they run outside of it. You can also test agents locally without having to change the Flyte backend configuration, streamlining development. -For a list of agents you can use in your tasks, see the [Agent Setup](https://docs.flyte.org/en/latest/deployment/agents/index.html) documentation. +For a list of agents you can use in your tasks, see the [Integrations](https://docs.flyte.org/en/latest/flytesnacks/integrations.html#agents) documentation. diff --git a/docs/getting_started_with_workflow_development/index.md b/docs/getting_started_with_workflow_development/index.md index d7b39d7cee..eced8fc68e 100644 --- a/docs/getting_started_with_workflow_development/index.md +++ b/docs/getting_started_with_workflow_development/index.md @@ -3,6 +3,8 @@ Machine learning engineers, data engineers, and data analysts often represent the processes that consume, transform, and output data with directed acyclic graphs (DAGs). In this section, you will learn how to create a Flyte project to contain the workflow code that implements your DAG, as well as the configuration files needed to package the code to run on a local or remote Flyte cluster. + + ```{list-table} :header-rows: 0 :widths: 20 30 From 30e035460322582299469ff7a959e73a19c64401 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Fri, 16 Feb 2024 08:25:22 -0800 Subject: [PATCH 14/25] Update async agent example (#4906) * Add sync agent example Signed-off-by: Kevin Su * nit Signed-off-by: Kevin Su --------- Signed-off-by: Kevin Su --- docs/flyte_agents/creating_an_agent.md | 28 ++++++--------------- docs/flyte_agents/testing_agents_locally.md | 6 +++++ 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/docs/flyte_agents/creating_an_agent.md b/docs/flyte_agents/creating_an_agent.md index d4aa953aeb..64f9d6c634 100644 --- a/docs/flyte_agents/creating_an_agent.md +++ b/docs/flyte_agents/creating_an_agent.md @@ -43,7 +43,7 @@ class Metadata: # If you add s3 file path, the agent will check if the file exists. job_id: str -class CustomAgent(AgentBase): +class CustomAsyncAgent(AsyncAgentBase): def __init__(self, task_type: str): # Each agent should have a unique task type. # The Flyte agent service will use the task type @@ -52,10 +52,10 @@ class CustomAgent(AgentBase): def create( self, - context: grpc.ServicerContext, output_prefix: str, task_template: TaskTemplate, inputs: typing.Optional[LiteralMap] = None, + **kwargs, ) -> TaskCreateResponse: # 1. Submit the task to the external service (BigQuery, DataBricks, etc.) # 2. Create metadata for the task, such as jobID. @@ -63,7 +63,7 @@ class CustomAgent(AgentBase): res = requests.post(url, json=data) return CreateTaskResponse(resource_meta=json.dumps(asdict(Metadata(job_id=str(res.job_id)))).encode("utf-8")) - def get(self, context: grpc.ServicerContext, resource_meta: bytes) -> TaskGetResponse: + def get(self, resource_meta: bytes, **kwargs) -> TaskGetResponse: # 1. Deserialize the metadata. # 2. Use the metadata to get the job status. # 3. Return the job status. @@ -71,29 +71,15 @@ class CustomAgent(AgentBase): res = requests.get(url, json={"job_id": metadata.job_id}) return GetTaskResponse(resource=Resource(state=res.state) - def delete(self, context: grpc.ServicerContext, resource_meta: bytes) -> TaskDeleteResponse: + def delete(self, resource_meta: bytes, **kwargs) -> TaskDeleteResponse: # 1. Deserialize the metadata. # 2. Use the metadata to delete the job. - # 3. If failed to delete the job, add the error message to the grpc context. - # context.set_code(grpc.StatusCode.INTERNAL) - # context.set_details(f"failed to create task with error {e}") - try: - metadata = Metadata(**json.loads(resource_meta.decode("utf-8"))) - requests.delete(url, json={"job_id": metadata.job_id}) - except Exception as e: - logger.error(f"failed to delete task with error {e}") - context.set_code(grpc.StatusCode.INTERNAL) - context.set_details(f"failed to delete task with error {e}") + metadata = Metadata(**json.loads(resource_meta.decode("utf-8"))) + requests.delete(url, json={"job_id": metadata.job_id}) return DeleteTaskResponse() # To register the custom agent -AgentRegistry.register(CustomAgent()) +AgentRegistry.register(CustomAsyncAgent()) ``` For an example implementation, see the [BigQuery Agent](https://github.com/flyteorg/flytekit/blob/9977aac26242ebbede8e00d476c2fbc59ac5487a/plugins/flytekit-bigquery/flytekitplugins/bigquery/agent.py#L35). - -## Sync agent interface specification - -To create a new async agent, extend the `AgentBase` class in the `flytekit.backend` module and implement the `execute` method. - -- `execute`: This method is used to initiate a new job and return the response. \ No newline at end of file diff --git a/docs/flyte_agents/testing_agents_locally.md b/docs/flyte_agents/testing_agents_locally.md index 3bc0bfa82f..d96da05d0a 100644 --- a/docs/flyte_agents/testing_agents_locally.md +++ b/docs/flyte_agents/testing_agents_locally.md @@ -13,6 +13,12 @@ Agents can be tested locally without configuring or running the backend server, The task inherited from `AsyncAgentExecutorMixin` can be executed locally, allowing flytekit to mimic FlytePropeller's behavior to call the agent. +```python +class BigQueryTask(AsyncAgentExecutorMixin, SQLTask[BigQueryConfig]): + def __init__(self, name: str, **kwargs): + ... +``` + :::{note} In some cases, you will need to store credentials in your local environment when testing locally. From 0f2a0d1aa123dff9a0b0e21df00317838c80442e Mon Sep 17 00:00:00 2001 From: nikki everett Date: Fri, 16 Feb 2024 15:20:28 -0600 Subject: [PATCH 15/25] formatting and copy updates Signed-off-by: nikki everett --- docs/flyte_agents/creating_an_agent.md | 6 ++--- docs/flyte_agents/index.md | 6 ++--- docs/flyte_agents/testing_agents_locally.md | 25 ++++++++++++--------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/docs/flyte_agents/creating_an_agent.md b/docs/flyte_agents/creating_an_agent.md index 64f9d6c634..b6fd931f39 100644 --- a/docs/flyte_agents/creating_an_agent.md +++ b/docs/flyte_agents/creating_an_agent.md @@ -17,11 +17,11 @@ There are two types of agents: **async** and **sync**. * **Async agents** communicate with external services that have asynchronous APIs that support `create`, `get`, and `delete` operations. The vast majority of agents are async agents. * **Sync agents** communicate with external services, such as the OpenAI API, that return an immediate response after a job is created. -:::{note} +```{note} While agents can be written in any programming language, we currently only support Python agents. We may support other languages in the future. -::: +``` ## Async agent interface specification @@ -82,4 +82,4 @@ class CustomAsyncAgent(AsyncAgentBase): AgentRegistry.register(CustomAsyncAgent()) ``` -For an example implementation, see the [BigQuery Agent](https://github.com/flyteorg/flytekit/blob/9977aac26242ebbede8e00d476c2fbc59ac5487a/plugins/flytekit-bigquery/flytekitplugins/bigquery/agent.py#L35). +For an example implementation, see the [BigQuery Agent](https://github.com/flyteorg/flytekit/blob/master/plugins/flytekit-bigquery/flytekitplugins/bigquery/agent.py#L43). diff --git a/docs/flyte_agents/index.md b/docs/flyte_agents/index.md index 3b46a51f82..49ac36b433 100644 --- a/docs/flyte_agents/index.md +++ b/docs/flyte_agents/index.md @@ -4,10 +4,10 @@ prev-page: getting_started/extending_flyte prev-page-title: Extending Flyte --- -(flyte_agents)= +(flyte_agents_guide)= # Flyte agents -In Flyte, an agent is a long-running, stateless service powered by a gRPC server. Each agent service is a Kubernetes deployment that receives gRPC requests from FlytePropeller when users trigger a particular type of task (for example, the BigQuery agent handles BigQuery tasks). The agent service then initiates a job with the appropriate external service. You can create different agent services that host different agents, e.g., a production and a development agent service. +In Flyte, an agent is a long-running, stateless service powered by a gRPC server that communicates with an external service. Each agent service is a Kubernetes deployment that receives gRPC requests from FlytePropeller when users trigger a particular type of task (for example, the BigQuery agent handles BigQuery tasks). The agent service then initiates a job with the appropriate external service. You can create different agent services that host different agents, e.g., a production and a development agent service. :::{figure} https://i.ibb.co/vXhBDjP/Screen-Shot-2023-05-29-at-2-54-14-PM.png :alt: Agent Service @@ -36,4 +36,4 @@ using_agents_in_tasks creating_an_agent testing_agents_locally configuring_your_flyte_deployment_for_agents -``` \ No newline at end of file +``` diff --git a/docs/flyte_agents/testing_agents_locally.md b/docs/flyte_agents/testing_agents_locally.md index d96da05d0a..eb8cd961ed 100644 --- a/docs/flyte_agents/testing_agents_locally.md +++ b/docs/flyte_agents/testing_agents_locally.md @@ -9,26 +9,29 @@ jupytext: (testing_agents_locally)= # Testing agents locally -Agents can be tested locally without configuring or running the backend server, which makes agent development easier. +You can test agents locally without running the backend server, making agent development easier. -The task inherited from `AsyncAgentExecutorMixin` can be executed locally, allowing flytekit to mimic FlytePropeller's behavior to call the agent. +To test an agent locally, create a class for the agent task that inherits from `[AsyncAgentExecutorMixin](https://github.com/flyteorg/flytekit/blob/master/flytekit/extend/backend/base_agent.py#L155)`. This mixin can handle both asynchronous tasks and synchronous tasks and allows flytekit to mimic FlytePropeller's behavior in calling the agent. -```python -class BigQueryTask(AsyncAgentExecutorMixin, SQLTask[BigQueryConfig]): - def __init__(self, name: str, **kwargs): - ... -``` +## BigQuery example + +To test the BigQuery example, copy the following code to a file called `wf.py`, modifying as needed. -:::{note} +```{note} In some cases, you will need to store credentials in your local environment when testing locally. For example, you need to set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable when running BigQuery tasks to test the BigQuery agent. -::: - -Flytekit will automatically call the agent to `create`, `get`, or `delete` the task. +``` ```python +class BigQueryTask(AsyncAgentExecutorMixin, SQLTask[BigQueryConfig]): + def __init__(self, name: str, **kwargs): + ... + + +# Instantiate the task class. Flytekit will automatically call the agent +# to `create`, `get`, or `delete` the job. bigquery_doge_coin = BigQueryTask( name=f"bigquery.doge_coin", inputs=kwtypes(version=int), From 330979ac15f503fe8adb92cb68a413d2bb167619 Mon Sep 17 00:00:00 2001 From: nikki everett Date: Fri, 16 Feb 2024 16:42:06 -0600 Subject: [PATCH 16/25] fix formatting in snowflake doc, small fixes in agents procedural docs Signed-off-by: nikki everett --- docs/deployment/agents/snowflake.rst | 1 + ...nfiguring_your_flyte_deployment_for_agents.md | 16 ---------------- docs/flyte_agents/creating_an_agent.md | 2 +- .../enabling_agents_in_your_flyte_deployment.md | 16 ++++++++++++++++ docs/flyte_agents/index.md | 13 +++++++++---- docs/flyte_agents/using_agents_in_tasks.md | 14 -------------- 6 files changed, 27 insertions(+), 35 deletions(-) delete mode 100644 docs/flyte_agents/configuring_your_flyte_deployment_for_agents.md create mode 100644 docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md delete mode 100644 docs/flyte_agents/using_agents_in_tasks.md diff --git a/docs/deployment/agents/snowflake.rst b/docs/deployment/agents/snowflake.rst index 9005756051..e9c691ceed 100644 --- a/docs/deployment/agents/snowflake.rst +++ b/docs/deployment/agents/snowflake.rst @@ -9,6 +9,7 @@ This guide provides an overview of how to set up the Snowflake agent in your Fly 2. Create a secret with the group "snowflake" and the key "private_key". For more details, see `"Using Secrets in a Task" `__. .. code-block:: bash + kubectl create secret generic snowflake-private-key --namespace=flytesnacks-development --from-file=your_private_key_above Specify agent configuration diff --git a/docs/flyte_agents/configuring_your_flyte_deployment_for_agents.md b/docs/flyte_agents/configuring_your_flyte_deployment_for_agents.md deleted file mode 100644 index 2d34fc36bd..0000000000 --- a/docs/flyte_agents/configuring_your_flyte_deployment_for_agents.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -jupytext: - formats: md:myst - text_representation: - extension: .md - format_name: myst ---- - -(configuring_deployment_for_agents)= -# Configuring your Flyte deployment for agents - -To configure your Flyte deployment for a particular agent, see the [Agent Setup](https://docs.flyte.org/en/latest/deployment/agents/index.html) documentation. - -:::{note} -If you are using a managed deployment of Flyte, you will need to contact your deployment administrator to configure agents in your deployment. -::: diff --git a/docs/flyte_agents/creating_an_agent.md b/docs/flyte_agents/creating_an_agent.md index b6fd931f39..641f23d26f 100644 --- a/docs/flyte_agents/creating_an_agent.md +++ b/docs/flyte_agents/creating_an_agent.md @@ -82,4 +82,4 @@ class CustomAsyncAgent(AsyncAgentBase): AgentRegistry.register(CustomAsyncAgent()) ``` -For an example implementation, see the [BigQuery Agent](https://github.com/flyteorg/flytekit/blob/master/plugins/flytekit-bigquery/flytekitplugins/bigquery/agent.py#L43). +For an example implementation, see the [BigQuery agent](https://github.com/flyteorg/flytekit/blob/master/plugins/flytekit-bigquery/flytekitplugins/bigquery/agent.py#L43). diff --git a/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md b/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md new file mode 100644 index 0000000000..0f0c8072aa --- /dev/null +++ b/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md @@ -0,0 +1,16 @@ +--- +jupytext: + formats: md:myst + text_representation: + extension: .md + format_name: myst +--- + +(enabling_agents_in_your_flyte_deploymen)= +# Enabling agents in your Flyte deployment + +After you have finished testing an agent locally, you can enable the agent in your Flyte deployment to use it in production. To enable a particular agent in your Flyte deployment, see the [Agent setup](https://docs.flyte.org/en/latest/deployment/agents/index.html) documentation for the agent. + +:::{note} +If you are using a managed deployment of Flyte, you will need to contact your deployment administrator to enable agents in your deployment. +::: diff --git a/docs/flyte_agents/index.md b/docs/flyte_agents/index.md index 49ac36b433..753505bc23 100644 --- a/docs/flyte_agents/index.md +++ b/docs/flyte_agents/index.md @@ -14,17 +14,23 @@ In Flyte, an agent is a long-running, stateless service powered by a gRPC server :class: with-shadow ::: +## Using agents in tasks + +If you need to connect to an external service in your workflow, we recommend using the corresponding agent rather than a web API plugin. Agents are designed to be scalable and can handle large workloads efficiently, and decrease load on FlytePropeller, since they run outside of it. You can also test agents locally without having to change the Flyte backend configuration, streamlining development. + +For a list of agents you can use in your tasks and example usage for each, see the [Integrations](https://docs.flyte.org/en/latest/flytesnacks/integrations.html#agents) documentation. + +## Table of contents + ```{list-table} :header-rows: 0 :widths: 20 30 -* - {doc}`Using agents in tasks ` - - Learn how to use agents to efficiently communicate with external services in your tasks. * - {doc}`Creating an agent ` - If the agent you need doesn't exist, follow these steps to create it. * - {doc}`Testing agents locally ` - Whether using an existing agent or creating a new one, you can test it locally without needing to configure or run the backend server. -* - {doc}`Configuring your Flyte deployment for agents ` +* - {doc}`Configuring your Flyte deployment for agents ` - Once you have tested an agent locally and want to use it in production, you must configure your Flyte deployment for the agent. ``` @@ -32,7 +38,6 @@ In Flyte, an agent is a long-running, stateless service powered by a gRPC server :maxdepth: -1 :hidden: -using_agents_in_tasks creating_an_agent testing_agents_locally configuring_your_flyte_deployment_for_agents diff --git a/docs/flyte_agents/using_agents_in_tasks.md b/docs/flyte_agents/using_agents_in_tasks.md deleted file mode 100644 index 6147a6ed06..0000000000 --- a/docs/flyte_agents/using_agents_in_tasks.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -jupytext: - formats: md:myst - text_representation: - extension: .md - format_name: myst ---- - -(using_agents_in_tasks)= -# Using agents in tasks - -If you need to connect to an external service in your workflow, we recommend using the corresponding agent rather than a web API plugin. Agents are designed to be scalable and can handle large workloads efficiently, and decrease load on FlytePropeller, since they run outside of it. You can also test agents locally without having to change the Flyte backend configuration, streamlining development. - -For a list of agents you can use in your tasks, see the [Integrations](https://docs.flyte.org/en/latest/flytesnacks/integrations.html#agents) documentation. From d4c4e8b85963679948bd2e20b10786562ce1699f Mon Sep 17 00:00:00 2001 From: nikki everett Date: Fri, 16 Feb 2024 16:56:02 -0600 Subject: [PATCH 17/25] fix toctree Signed-off-by: nikki everett --- docs/flyte_agents/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/flyte_agents/index.md b/docs/flyte_agents/index.md index 753505bc23..7660a3988f 100644 --- a/docs/flyte_agents/index.md +++ b/docs/flyte_agents/index.md @@ -30,7 +30,7 @@ For a list of agents you can use in your tasks and example usage for each, see t - If the agent you need doesn't exist, follow these steps to create it. * - {doc}`Testing agents locally ` - Whether using an existing agent or creating a new one, you can test it locally without needing to configure or run the backend server. -* - {doc}`Configuring your Flyte deployment for agents ` +* - {doc}`Enabling agents in your Flyte deployment ` - Once you have tested an agent locally and want to use it in production, you must configure your Flyte deployment for the agent. ``` @@ -40,5 +40,5 @@ For a list of agents you can use in your tasks and example usage for each, see t creating_an_agent testing_agents_locally -configuring_your_flyte_deployment_for_agents +enabling_agents_in_your_flyte_deployment ``` From 20931b8442020dfd51ea6a6b5fc875c553068af7 Mon Sep 17 00:00:00 2001 From: nikki everett Date: Sat, 17 Feb 2024 21:14:36 -0600 Subject: [PATCH 18/25] add link Signed-off-by: nikki everett --- docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md b/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md index 0f0c8072aa..72940ef223 100644 --- a/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md +++ b/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md @@ -9,7 +9,7 @@ jupytext: (enabling_agents_in_your_flyte_deploymen)= # Enabling agents in your Flyte deployment -After you have finished testing an agent locally, you can enable the agent in your Flyte deployment to use it in production. To enable a particular agent in your Flyte deployment, see the [Agent setup](https://docs.flyte.org/en/latest/deployment/agents/index.html) documentation for the agent. +After you have finished {ref}`testing an agent locally `, you can enable the agent in your Flyte deployment to use it in production. To enable a particular agent in your Flyte deployment, see the [Agent setup](https://docs.flyte.org/en/latest/deployment/agents/index.html) documentation for the agent. :::{note} If you are using a managed deployment of Flyte, you will need to contact your deployment administrator to enable agents in your deployment. From 95b6eaa1d03c01d3c557c430b59990fa3942313b Mon Sep 17 00:00:00 2001 From: nikki everett Date: Mon, 19 Feb 2024 15:07:21 -0600 Subject: [PATCH 19/25] fix links Signed-off-by: nikki everett --- docs/deployment/agents/airflow.rst | 2 +- docs/deployment/agents/bigquery.rst | 2 +- docs/deployment/agents/databricks.rst | 2 +- docs/deployment/agents/mmcloud.rst | 2 +- docs/deployment/agents/sensor.rst | 2 +- docs/deployment/agents/snowflake.rst | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/deployment/agents/airflow.rst b/docs/deployment/agents/airflow.rst index fe80efeb01..ad6a6dab36 100644 --- a/docs/deployment/agents/airflow.rst +++ b/docs/deployment/agents/airflow.rst @@ -94,4 +94,4 @@ Upgrade the Flyte Helm release and ```` with the name of your namespace (e.g., ``flyte``). -For Airflow plugin on the Flyte cluster, see `Airflow Plugin Example `_ +For Airflow agent on the Flyte cluster, see `Airflow agent `_. diff --git a/docs/deployment/agents/bigquery.rst b/docs/deployment/agents/bigquery.rst index a217352945..d706ac7c37 100644 --- a/docs/deployment/agents/bigquery.rst +++ b/docs/deployment/agents/bigquery.rst @@ -103,4 +103,4 @@ Upgrade the Flyte Helm release and ```` with the name of your namespace (e.g., ``flyte``). -For BigQuery plugin on the Flyte cluster, see `BigQuery Plugin Example `_ +For BigQuery agent on the Flyte cluster, see `BigQuery agent `_. diff --git a/docs/deployment/agents/databricks.rst b/docs/deployment/agents/databricks.rst index a803b40526..3dbf7731c5 100644 --- a/docs/deployment/agents/databricks.rst +++ b/docs/deployment/agents/databricks.rst @@ -291,4 +291,4 @@ Wait for the upgrade to complete. You can check the status of the deployment pod kubectl get pods -n flyte -For databricks plugin on the Flyte cluster, see `Databricks Plugin Example `_ +For Databricks agent on the Flyte cluster, see `Databricks agent `_. diff --git a/docs/deployment/agents/mmcloud.rst b/docs/deployment/agents/mmcloud.rst index 304f4bef23..ac08f4fcdf 100644 --- a/docs/deployment/agents/mmcloud.rst +++ b/docs/deployment/agents/mmcloud.rst @@ -118,4 +118,4 @@ Wait for the upgrade to complete. You can check the status of the deployment pod kubectl get pods -n flyte -For MMCloud plugin on the Flyte cluster, see `Memory Machine Cloud Plugin Example `_ +For MMCloud agent on the Flyte cluster, see `MMCloud agent `_. diff --git a/docs/deployment/agents/sensor.rst b/docs/deployment/agents/sensor.rst index ccd6a09db0..958e5d896a 100644 --- a/docs/deployment/agents/sensor.rst +++ b/docs/deployment/agents/sensor.rst @@ -3,7 +3,7 @@ Sensor agent ================= -The sensor agent enables users to continuously check for a file or a condition to be met periodically. +The `sensor agent `_ enables users to continuously check for a file or a condition to be met periodically. When the condition is met, the sensor will complete. diff --git a/docs/deployment/agents/snowflake.rst b/docs/deployment/agents/snowflake.rst index e9c691ceed..f4d82c0eb2 100644 --- a/docs/deployment/agents/snowflake.rst +++ b/docs/deployment/agents/snowflake.rst @@ -100,4 +100,4 @@ Upgrade the Flyte Helm release and ```` with the name of your namespace (e.g., ``flyte``). -For Snowflake plugin on the Flyte cluster, see `Snowflake Plugin Example `_ +For Snowflake agent on the Flyte cluster, see `Snowflake agent `_. From 25cb747fceb3540da1eff4799e422e15bbe2332c Mon Sep 17 00:00:00 2001 From: nikki everett Date: Tue, 20 Feb 2024 09:56:15 -0600 Subject: [PATCH 20/25] update link Signed-off-by: nikki everett --- docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md b/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md index 72940ef223..85e0635918 100644 --- a/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md +++ b/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md @@ -9,7 +9,7 @@ jupytext: (enabling_agents_in_your_flyte_deploymen)= # Enabling agents in your Flyte deployment -After you have finished {ref}`testing an agent locally `, you can enable the agent in your Flyte deployment to use it in production. To enable a particular agent in your Flyte deployment, see the [Agent setup](https://docs.flyte.org/en/latest/deployment/agents/index.html) documentation for the agent. +After you have finished {ref}`testing an agent locally `, you can enable the agent in your Flyte deployment to use it in production. To enable a particular agent in your Flyte deployment, see the [Agent setup guide]((https://docs.flyte.org/en/latest/deployment/agents/index.html)) for the agent. :::{note} If you are using a managed deployment of Flyte, you will need to contact your deployment administrator to enable agents in your deployment. From 443df5e71e2fbf3f918ecab1152de81bae20e5ed Mon Sep 17 00:00:00 2001 From: nikki everett Date: Tue, 20 Feb 2024 10:06:08 -0600 Subject: [PATCH 21/25] import blog content Signed-off-by: nikki everett --- docs/flyte_agents/creating_an_agent.md | 6 +++--- docs/flyte_agents/index.md | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/flyte_agents/creating_an_agent.md b/docs/flyte_agents/creating_an_agent.md index 641f23d26f..417c4b5337 100644 --- a/docs/flyte_agents/creating_an_agent.md +++ b/docs/flyte_agents/creating_an_agent.md @@ -9,13 +9,13 @@ jupytext: (creating_an_agent)= # Creating an agent -The Flyte agent framework enables rapid agent development, since agents are decoupled from the core FlytePropeller engine. Agents can be written in Python, easing development for data scientists. Agents can be tested independently and deployed privately, making maintenance easier and giving you more flexibility and control over development. +The Flyte agent framework enables rapid agent development, since agents are decoupled from the core FlytePropeller engine. Rather than building a complete gRPC service from scratch, you can implement an agent as a Python class, easing development. Agents can be tested independently and deployed privately, making maintenance easier and giving you more flexibility and control over development. If you need to create a new type of task, we recommend creating a new agent to run it rather than running the task in a pod. After testing the new agent, you can update your FlytePropeller configMap to specify the type of task that the agent should run. There are two types of agents: **async** and **sync**. -* **Async agents** communicate with external services that have asynchronous APIs that support `create`, `get`, and `delete` operations. The vast majority of agents are async agents. -* **Sync agents** communicate with external services, such as the OpenAI API, that return an immediate response after a job is created. +* **Async agents** enable long-running jobs that execute on an external platform over time. They communicate with external services that have asynchronous APIs that support `create`, `get`, and `delete` operations. The vast majority of agents are async agents. +* **Sync agents** enable request/response services that return immediate outputs (e.g. calling an internal API to fetch data or communicating with the OpenAI API). ```{note} diff --git a/docs/flyte_agents/index.md b/docs/flyte_agents/index.md index 7660a3988f..e0cb3f9352 100644 --- a/docs/flyte_agents/index.md +++ b/docs/flyte_agents/index.md @@ -7,7 +7,11 @@ prev-page-title: Extending Flyte (flyte_agents_guide)= # Flyte agents -In Flyte, an agent is a long-running, stateless service powered by a gRPC server that communicates with an external service. Each agent service is a Kubernetes deployment that receives gRPC requests from FlytePropeller when users trigger a particular type of task (for example, the BigQuery agent handles BigQuery tasks). The agent service then initiates a job with the appropriate external service. You can create different agent services that host different agents, e.g., a production and a development agent service. +Flyte agents are long-running, stateless services that receive execution requests via gRPC and initiate jobs with appropriate external or internal services. They enable two key workflows: asynchronously launching jobs on hosted platforms (e.g. Databbricks or Snowflake) and calling external synchronous services, such as access control, data retrieval, and model inferencing. + +Each agent service is a Kubernetes deployment that receives gRPC requests from FlytePropeller when users trigger a particular type of task (for example, the BigQuery agent handles BigQuery tasks). The agent service then initiates a job with the appropriate service. Since Agents can be spawned in process, they allow for running all services locally as long as the connection secrets are available. Moreover, Agents use a protobuf interface, thus can be implemented in any language, providing a lot of opportunity for flexibility and reuse of existing libraries, as well as simpler testing. + +You can create different agent services that host different agents, e.g., a production and a development agent service. :::{figure} https://i.ibb.co/vXhBDjP/Screen-Shot-2023-05-29-at-2-54-14-PM.png :alt: Agent Service From 5b373aa396375b796193de47d16b3ea86d152443 Mon Sep 17 00:00:00 2001 From: nikki everett Date: Tue, 20 Feb 2024 10:20:01 -0600 Subject: [PATCH 22/25] rename agent creation doc, small content updates Signed-off-by: nikki everett --- .../{creating_an_agent.md => developing_agents.md} | 0 docs/flyte_agents/index.md | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename docs/flyte_agents/{creating_an_agent.md => developing_agents.md} (100%) diff --git a/docs/flyte_agents/creating_an_agent.md b/docs/flyte_agents/developing_agents.md similarity index 100% rename from docs/flyte_agents/creating_an_agent.md rename to docs/flyte_agents/developing_agents.md diff --git a/docs/flyte_agents/index.md b/docs/flyte_agents/index.md index e0cb3f9352..d56c7fed4b 100644 --- a/docs/flyte_agents/index.md +++ b/docs/flyte_agents/index.md @@ -30,10 +30,10 @@ For a list of agents you can use in your tasks and example usage for each, see t :header-rows: 0 :widths: 20 30 -* - {doc}`Creating an agent ` +* - {doc}`Developing agents ` - If the agent you need doesn't exist, follow these steps to create it. * - {doc}`Testing agents locally ` - - Whether using an existing agent or creating a new one, you can test it locally without needing to configure or run the backend server. + - Whether using an existing agent or developing a new one, you can test the agent locally without needing to configure your Flyte deployment. * - {doc}`Enabling agents in your Flyte deployment ` - Once you have tested an agent locally and want to use it in production, you must configure your Flyte deployment for the agent. ``` @@ -42,7 +42,7 @@ For a list of agents you can use in your tasks and example usage for each, see t :maxdepth: -1 :hidden: -creating_an_agent +developing_agents testing_agents_locally enabling_agents_in_your_flyte_deployment ``` From 048b7a6478daa7fe1e7740f702dbf2e31fe7943d Mon Sep 17 00:00:00 2001 From: nikki everett Date: Tue, 20 Feb 2024 10:32:45 -0600 Subject: [PATCH 23/25] fix article title Signed-off-by: nikki everett --- docs/flyte_agents/developing_agents.md | 4 ++-- docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/flyte_agents/developing_agents.md b/docs/flyte_agents/developing_agents.md index 417c4b5337..bd7d1c7610 100644 --- a/docs/flyte_agents/developing_agents.md +++ b/docs/flyte_agents/developing_agents.md @@ -6,8 +6,8 @@ jupytext: format_name: myst --- -(creating_an_agent)= -# Creating an agent +(developing_agents)= +# Developing agents The Flyte agent framework enables rapid agent development, since agents are decoupled from the core FlytePropeller engine. Rather than building a complete gRPC service from scratch, you can implement an agent as a Python class, easing development. Agents can be tested independently and deployed privately, making maintenance easier and giving you more flexibility and control over development. diff --git a/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md b/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md index 85e0635918..f50b740a21 100644 --- a/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md +++ b/docs/flyte_agents/enabling_agents_in_your_flyte_deployment.md @@ -9,7 +9,7 @@ jupytext: (enabling_agents_in_your_flyte_deploymen)= # Enabling agents in your Flyte deployment -After you have finished {ref}`testing an agent locally `, you can enable the agent in your Flyte deployment to use it in production. To enable a particular agent in your Flyte deployment, see the [Agent setup guide]((https://docs.flyte.org/en/latest/deployment/agents/index.html)) for the agent. +After you have finished {ref}`testing an agent locally `, you can enable the agent in your Flyte deployment to use it in production. To enable a particular agent in your Flyte deployment, see the [Agent setup guide](https://docs.flyte.org/en/latest/deployment/agents/index.html) for the agent. :::{note} If you are using a managed deployment of Flyte, you will need to contact your deployment administrator to enable agents in your deployment. From dff3f9f800c102ff72c01b63bdbeb5e6774a66f5 Mon Sep 17 00:00:00 2001 From: nikki everett Date: Tue, 20 Feb 2024 11:35:54 -0600 Subject: [PATCH 24/25] fix link Signed-off-by: nikki everett --- docs/flyte_agents/testing_agents_locally.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/flyte_agents/testing_agents_locally.md b/docs/flyte_agents/testing_agents_locally.md index eb8cd961ed..7874d0bca1 100644 --- a/docs/flyte_agents/testing_agents_locally.md +++ b/docs/flyte_agents/testing_agents_locally.md @@ -11,7 +11,7 @@ jupytext: You can test agents locally without running the backend server, making agent development easier. -To test an agent locally, create a class for the agent task that inherits from `[AsyncAgentExecutorMixin](https://github.com/flyteorg/flytekit/blob/master/flytekit/extend/backend/base_agent.py#L155)`. This mixin can handle both asynchronous tasks and synchronous tasks and allows flytekit to mimic FlytePropeller's behavior in calling the agent. +To test an agent locally, create a class for the agent task that inherits from [AsyncAgentExecutorMixin](https://github.com/flyteorg/flytekit/blob/master/flytekit/extend/backend/base_agent.py#L155). This mixin can handle both asynchronous tasks and synchronous tasks and allows flytekit to mimic FlytePropeller's behavior in calling the agent. ## BigQuery example From 3e05037835e1e3051a706589c3a158c760cd5c63 Mon Sep 17 00:00:00 2001 From: nikki everett Date: Tue, 20 Feb 2024 12:42:12 -0600 Subject: [PATCH 25/25] undo unnecessary formatting change in unrelated file Signed-off-by: nikki everett --- docs/getting_started_with_workflow_development/index.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/getting_started_with_workflow_development/index.md b/docs/getting_started_with_workflow_development/index.md index eced8fc68e..d7b39d7cee 100644 --- a/docs/getting_started_with_workflow_development/index.md +++ b/docs/getting_started_with_workflow_development/index.md @@ -3,8 +3,6 @@ Machine learning engineers, data engineers, and data analysts often represent the processes that consume, transform, and output data with directed acyclic graphs (DAGs). In this section, you will learn how to create a Flyte project to contain the workflow code that implements your DAG, as well as the configuration files needed to package the code to run on a local or remote Flyte cluster. - - ```{list-table} :header-rows: 0 :widths: 20 30