You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: WorkflowExecAgent/README.md
+88-18Lines changed: 88 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,51 @@
1
1
# Workflow Executor Agent
2
2
3
+
## Quick Start: Key Configuration Variables
4
+
5
+
Before proceeding, here are some key configuration variables needed for the workflow executor agent.
6
+
7
+
-**SDK_BASE_URL**: The URL to your platform workflow serving API.
8
+
9
+
Example: `http://<your-server-ip>:5000/`
10
+
11
+
This is where the agent will send workflow execution requests.
12
+
13
+
-**SERVING_TOKEN**: The authentication bearer token which is used in the `RequestHandler` class as `api_key`. This is used for authenticating API requests. 3rd party platforms can design their serving workflow API this way for user authentication.
14
+
15
+
More details can be found in the code [handle_requests.py](tools/utils/handle_requests.py#L23)
16
+
17
+
> **How to get these values:**
18
+
>
19
+
> - If you are using the provided example workflow API, refer to the test [README.md](tests/README.md)
20
+
> - For your own platform, refer to your API documentation or administrator for the correct values. If you are a platform provider you may refer to [Workflow Building Platform](#workflow-building-platform) section for prerequisites on setting up a serving workflow.
21
+
22
+
For more info on using these variables, refer to the [Microservice Setup](#microservice-setup) section below on using the [Example Workflow API](tests/example_workflow/) for a working example.
23
+
24
+
Set these variables in your environment before starting the service.
25
+
3
26
## Overview
4
27
5
28
GenAI Workflow Executor Example showcases the capability to handle data/AI workflow operations via LangChain agents to execute custom-defined workflow-based tools. These workflow tools can be interfaced from any 3rd-party tools in the market (no-code/low-code/IDE) such as Alteryx, RapidMiner, Power BI, Intel Data Insight Automation which allows users to create complex data/AI workflow operations for different use-cases.
6
29
30
+
### Definitions
31
+
32
+
Before we begin, here are the definitions to some terms for clarity:
33
+
34
+
- servable/serving workflow - A workflow made ready to be executed through API. It should be able to accept parameter injection for workflow scheduling and have a way to retrieve the final output data. It should also have a unique workflow ID for referencing. For platform providers guide to create their own servable workflows compatible with this example, refer to [Workflow Building Platform](#workflow-building-platform)
35
+
36
+
- SDK Class - Performs requests to interface with a 3rd-party API to perform workflow operations on the servable workflow. Found in `tools/sdk.py`.
37
+
38
+
- workflow ID - A unique ID for the servable workflow.
39
+
40
+
- workflow instance - An instance created from the servable workflow. It is represented as a `Workflow` class created using `DataInsightAutomationSDK.create_workflow()` under `tools/sdk.py`. Contains methods to `start`, `get_status` and `get_results` from the workflow.
41
+
7
42
### Workflow Executor
8
43
9
-
This example demonstrates a single React-LangGraph with a `Workflow Executor` tool to ingest a user prompt to execute workflows and return an agent reasoning response based on the workflow output data.
44
+
Strategy - This example demonstrates a single React-LangGraph with a `Workflow Executor` tool to ingest a user prompt to execute workflows and return an agent reasoning response based on the workflow output data.
10
45
11
46
First the LLM extracts the relevant information from the user query based on the schema of the tool in `tools/tools.yaml`. Then the agent sends this `AgentState` to the `Workflow Executor` tool.
12
47
13
-
`Workflow Executor` tool uses `EasyDataSDK` class as seen under `tools/sdk.py` to interface with several high-level API's. There are 3 steps to this tool implementation:
48
+
`Workflow Executor` tool requires a SDK class to call the servable workflow API. In the code, `DataInsightAutomationSDK` is the example class as seen under `tools/sdk.py` to interface with several high-level API's. There are 3 steps to this tool implementation:
14
49
15
50
1. Starts the workflow with workflow parameters and workflow id extracted from the user query.
16
51
@@ -26,37 +61,50 @@ Below shows an illustration of this flow:
26
61
27
62
### Workflow Serving for Agent
28
63
64
+
#### Workflow Building Platform
65
+
66
+
The first step is to prepare a servable workflow using a platform with the capabilities to do so.
67
+
29
68
As an example, here we have a Churn Prediction use-case workflow as the serving workflow for the agent execution. It is created through Intel Data Insight Automation platform. The image below shows a snapshot of the Churn Prediction workflow.
The workflow contains 2 paths which can be seen in the workflow illustrated, the top path and bottom path.
72
+
The workflow contains 2 paths which can be seen in the workflow illustrated, the top and bottom paths.
34
73
35
-
1. Top path - The training path which ends at the random forest classifier node is the training path. The data is cleaned through a series of nodes and used to train a random forest model for prediction.
74
+
1. Top path (Training path) - Ends at the random forest classifier node is the training path. The data is cleaned through a series of nodes and used to train a random forest model for prediction.
36
75
37
-
2. Bottom path - The inference path where trained random forest model is used for inferencing based on input parameter.
76
+
2. Bottom path (Inference path) - where trained random forest model is used for inferencing based on input parameter.
38
77
39
78
For this agent workflow execution, the inferencing path is executed to yield the final output result of the `Model Predictor` node. The same output is returned to the `Workflow Executor` tool through the `Langchain API Serving` node.
40
79
41
-
There are `Serving Parameters` in the workflow, which are the tool input variables used to start a workflow instance obtained from `params` the LLM extracts from the user query. Below shows the parameter configuration option for the Intel Data Insight Automation workflow UI.
80
+
There are `Serving Parameters` in the workflow, which are the tool input variables used to start a workflow instance at runtime obtained from `params` the LLM extracts from the user query. Below shows the parameter configuration option for the Intel Data Insight Automation workflow UI.
In the workflow serving for agent, this output will be returned to the `Workflow Executor` tool. The LLM can then answer the user's original question based on this output.
50
89
51
-
To start prompting the agent microservice, we will use the following command for this use case:
90
+
When the workflow is configured as desired, transform this into a servable workflow. We turn this workflow into a servable workflow format so that it can be called through API to perform operations on it. Data Insight Automation has tools to do this for its own workflows.
91
+
92
+
> [!NOTE]
93
+
> Remember to create a unique workflow ID along with the servable workflow.
94
+
95
+
#### Using Servable Workflow
96
+
97
+
Once we have our servable workflow ready, the serving workflow API can be prepared to accept requests from the SDK class. Refer to [Start Agent Microservice](#start-agent-microservice) on how to do this.
98
+
99
+
To start prompting the agent microservice, we will use the following command for this churn prediction use-case:
52
100
53
101
```sh
54
102
curl http://${ip_address}:9090/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
55
103
"query": "I have a data with gender Female, tenure 55, MonthlyAvgCharges 103.7. Predict if this entry will churn. My workflow id is '${workflow_id}'."
56
104
}'
57
105
```
58
106
59
-
The user has to provide a `workflow_id` and workflow `params` in the query. `workflow_id` a unique id used for serving the workflow to the microservice. Notice that the `query` string includes all the workflow `params` which the user has defined in the workflow. The LLM will extract these parameters into a dictionary format for the workflow `Serving Parameters` as shown below:
107
+
The user has to provide a `workflow_id` and workflow `params` in the query. Notice that the `query` string includes all the workflow `params` which the user has defined in the workflow. The LLM will extract these parameters into a dictionary format for the workflow `Serving Parameters` as shown below:
@@ -72,6 +120,16 @@ And finally here are the results from the microservice logs:
72
120
73
121
### Start Agent Microservice
74
122
123
+
For an out-of-box experience there is an example workflow serving API service prepared for users under [Example Workflow API](tests/example_workflow/) to interface with the SDK. This section will guide users on setting up this service as well. Users may modify the logic, add your own database etc for your own use-case.
124
+
125
+
There are 3 services needed for the setup:
126
+
127
+
1. Agent microservice
128
+
129
+
2. LLM inference service - specified as `llm_endpoint_url`.
130
+
131
+
3. workflow serving API service - specified as `SDK_BASE_URL`
132
+
75
133
Workflow Executor will have a single docker image. First, build the agent docker image.
`launch_workflow_service.sh` will setup all the packages locally and launch the uvicorn server to host the API on port 5000. For a Dockerfile method, please refer to `Dockerfile.example_workflow_api` file.
178
+
109
179
### Validate service
110
180
111
-
The microservice logs can be viewed using:
181
+
The agent microservice logs can be viewed using:
112
182
113
183
```sh
114
184
docker logs workflowexec-agent-endpoint
@@ -120,7 +190,7 @@ You can validate the service using the following command:
120
190
121
191
```sh
122
192
curl http://${ip_address}:9090/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{
123
-
"query": "I have a data with gender Female, tenure 55, MonthlyAvgCharges 103.7. Predict if this entry will churn. My workflow id is '${workflow_id}'."
193
+
"query": "I have a data with gender Female, tenure 55, MonthlyCharges 103.7, TotalCharges 1840.75. Predict if this entry will churn. My workflow id is '${workflow_id}'."
0 commit comments