-
Notifications
You must be signed in to change notification settings - Fork 327
Workflow executor example workflow API #1102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JoshuaL3000
merged 40 commits into
opea-project:main
from
JoshuaL3000:workflow-executor-example
Jul 2, 2025
Merged
Changes from 33 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
727e9f3
Add workflow executor example
JoshuaL3000 87ed7db
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] bc5cc12
Update workflow executor example
JoshuaL3000 03f0d01
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 11344a6
Update workflow executor example
JoshuaL3000 00de5a8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 7f8f957
Rename CI script to 'test_compose_on_xeon.sh'
JoshuaL3000 14944f9
Update test files and add custom prompt
JoshuaL3000 891324f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] f8f3afd
Rename test script
JoshuaL3000 62fd863
Fix start_vllm_service.sh and handle convert dict to str in tools.py
JoshuaL3000 d251aa5
Update workflow id and retest pydantic version
JoshuaL3000 bfb0522
Add docstring for multiple files
JoshuaL3000 b784a68
Update workflow executor example for example workflow API
JoshuaL3000 77675ce
Update readme for example workflow
JoshuaL3000 3745142
Update test scripts and readme
JoshuaL3000 9b14045
Update workflow executor example for example workflow API
JoshuaL3000 07d4ed4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 683654b
Update workflow id
JoshuaL3000 0098bf1
Merge branch 'main' into workflow-executor-example
xiguiw 256dfbd
Merge branch 'main' into workflow-executor-example
chensuyue e4e8a70
Merge branch 'main' into workflow-executor-example
ZePan110 0523b68
Update docker compose path for agent comps change
JoshuaL3000 cbc87e7
Merge branch 'main' into workflow-executor-example
JoshuaL3000 8bb3f30
Enable test for workflow example API after package upgrades
JoshuaL3000 219cab2
Update wf_api_port
JoshuaL3000 b32ffe6
Minor fixes
JoshuaL3000 1502a83
Minor updates
JoshuaL3000 5398db5
Add debug vllm for test
JoshuaL3000 59d2046
Add list tags for debug
JoshuaL3000 1fbbc12
Merge branch 'main' into workflow-executor-example
JoshuaL3000 5318038
Merge branch 'main' into workflow-executor-example
JoshuaL3000 a4c1ec1
Merge branch 'main' into workflow-executor-example
JoshuaL3000 6bf69c0
Fix for Issue#1978: Update README for missing instructions
JoshuaL3000 57f880d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 3979b23
Update README syntax
JoshuaL3000 77edb21
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] f35eff8
Add Quick start section in README.md for better clarity on using vari…
JoshuaL3000 c85f1d2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] ea160ca
Merge branch 'main' into workflow-executor-example
JoshuaL3000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/bin/bash | ||
| # Copyright (C) 2024 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -e | ||
|
|
||
| WORKPATH=$(dirname "$PWD") | ||
| vllm_port=${vllm_port} | ||
| [[ -z "$vllm_port" ]] && vllm_port=8084 | ||
| export WORKDIR=$WORKPATH/../../ | ||
| echo "WORKDIR=${WORKDIR}" | ||
| export SDK_BASE_URL=$1 | ||
| echo "SDK_BASE_URL=$1" | ||
| export SERVING_TOKEN=${SERVING_TOKEN} | ||
| export HF_TOKEN=${HUGGINGFACEHUB_API_TOKEN} | ||
| export llm_engine=vllm | ||
| export ip_address=$(hostname -I | awk '{print $1}') | ||
| export llm_endpoint_url=http://${ip_address}:${vllm_port} | ||
| export model=mistralai/Mistral-7B-Instruct-v0.3 | ||
| export recursion_limit=25 | ||
| export temperature=0 | ||
| export max_new_tokens=1000 | ||
| export TOOLSET_PATH=$WORKDIR/GenAIExamples/WorkflowExecAgent/tools/ | ||
|
|
||
| function start_agent() { | ||
| echo "Starting Agent services" | ||
| cd $WORKDIR/GenAIExamples/WorkflowExecAgent/docker_compose/intel/cpu/xeon | ||
| WORKDIR=$WORKPATH/docker_image_build/ docker compose -f compose_vllm.yaml up -d | ||
| echo "Waiting agent service ready" | ||
| sleep 10s | ||
| } | ||
|
|
||
| function main() { | ||
| echo "==================== Start agent service ====================" | ||
| start_agent | ||
| echo "==================== Agent service started ====================" | ||
| } | ||
|
|
||
| main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/bin/bash | ||
| # Copyright (C) 2024 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -e | ||
|
|
||
| wf_api_port=${wf_api_port} | ||
| [[ -z "$wf_api_port" ]] && wf_api_port=5005 | ||
| WORKPATH=$(dirname "$PWD") | ||
| LOG_PATH="$WORKPATH/tests/example_workflow" | ||
| export WORKDIR=$WORKPATH/../../ | ||
| echo "WORKDIR=${WORKDIR}" | ||
|
|
||
| function start_example_workflow_api() { | ||
| echo "Starting example workflow API" | ||
| cd $WORKDIR/GenAIExamples/WorkflowExecAgent/tests/example_workflow | ||
| docker build -f Dockerfile.example_workflow_api -t example-workflow-service . | ||
| docker run -d -p ${wf_api_port}:${wf_api_port} --rm --network=host --name example-workflow-service -it example-workflow-service | ||
| echo "Waiting example workflow API ready" | ||
| until [[ "$n" -ge 100 ]] || [[ $ready == true ]]; do | ||
| docker logs example-workflow-service &> ${LOG_PATH}/example-workflow-service.log | ||
| n=$((n+1)) | ||
| if grep -q "Uvicorn running on" ${LOG_PATH}/example-workflow-service.log; then | ||
| break | ||
| fi | ||
| if grep -q "No such container" ${LOG_PATH}/example-workflow-service.log; then | ||
| echo "container example-workflow-service not found" | ||
| exit 1 | ||
| fi | ||
| sleep 5s | ||
| done | ||
| } | ||
|
|
||
| function main() { | ||
| echo "==================== Start example workflow API ====================" | ||
| start_example_workflow_api | ||
| echo "==================== Example workflow API started ====================" | ||
| } | ||
|
|
||
| main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #!/bin/bash | ||
| # Copyright (C) 2024 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -e | ||
|
|
||
| WORKPATH=$(dirname "$PWD") | ||
| export WORKDIR=$WORKPATH/../../ | ||
| echo "WORKDIR=${WORKDIR}" | ||
| export ip_address=$(hostname -I | awk '{print $1}') | ||
| query=$1 | ||
| validate_result=$2 | ||
|
|
||
| function validate() { | ||
| local CONTENT="$1" | ||
| local EXPECTED_RESULT="$2" | ||
| local SERVICE_NAME="$3" | ||
|
|
||
| if echo "$CONTENT" | grep -q "$EXPECTED_RESULT"; then | ||
| echo "[ $SERVICE_NAME ] Content is as expected: $CONTENT" | ||
| echo "[TEST INFO]: Workflow Executor agent service PASSED" | ||
| else | ||
| echo "[ $SERVICE_NAME ] Content does not match the expected result: $CONTENT" | ||
| echo "[TEST INFO]: Workflow Executor agent service FAILED" | ||
| fi | ||
| } | ||
|
|
||
| function validate_agent_service() { | ||
| echo "----------------Test agent ----------------" | ||
| local CONTENT=$(curl http://${ip_address}:9091/v1/chat/completions -X POST -H "Content-Type: application/json" -d '{ | ||
| "messages": "'"${query}"'" | ||
| }') | ||
| validate "$CONTENT" "$validate_result" "workflowexec-agent-endpoint" | ||
| docker logs workflowexec-agent-endpoint | ||
| } | ||
|
|
||
| function main() { | ||
| echo "==================== Validate agent service ====================" | ||
| validate_agent_service | ||
| echo "==================== Agent service validated ====================" | ||
| } | ||
|
|
||
| main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
WorkflowExecAgent/tests/example_workflow/Dockerfile.example_workflow_api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| FROM ubuntu:22.04 | ||
JoshuaL3000 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| RUN apt-get -qq update | ||
|
|
||
| WORKDIR /home/ubuntu | ||
|
|
||
| COPY launch_workflow_service.sh requirements.txt main.py workflow.py ./ | ||
|
|
||
| RUN chmod +x ./launch_workflow_service.sh | ||
|
|
||
| CMD ["./launch_workflow_service.sh"] | ||
18 changes: 18 additions & 0 deletions
18
WorkflowExecAgent/tests/example_workflow/launch_workflow_service.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Copyright (C) 2024 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| apt-get -qq -y install --no-install-recommends unzip curl ca-certificates | ||
| apt-get -qq -y install --no-install-recommends python3 python3-pip | ||
|
|
||
| curl -L -o ./archive.zip https://www.kaggle.com/api/v1/datasets/download/blastchar/telco-customer-churn | ||
| unzip ./archive.zip -d ./ | ||
| rm ./archive.zip | ||
|
|
||
| pip install virtualenv && \ | ||
| virtualenv venv && \ | ||
| source venv/bin/activate && \ | ||
| pip install -r requirements.txt | ||
|
|
||
| uvicorn main:app --reload --port=5005 --host=0.0.0.0 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.