Files
wehub-resource-sync e768098d0e
tools_continuous_delivery / Private PyPI non-main branch release (push) Has been skipped
tools_continuous_delivery / Private PyPI main branch release (push) Failing after 2m42s
Publish Promptflow Doc / Build (push) Has been cancelled
Publish Promptflow Doc / Deploy (push) Has been cancelled
Flake8 Lint / flake8 (push) Has been cancelled
Spell check CI / Spell_Check (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:39:52 +08:00

3.1 KiB

Deploy a flow using development server

Once you have created and thoroughly tested a flow, you can use it as an HTTP endpoint.

::::{tab-set} :::{tab-item} CLI :sync: CLI We are going to use the web-classification as an example to show how to deploy a flow.

Please ensure you have create the connection required by flow, if not, you could refer to Setup connection for web-classification.

Note: We will use relevant environment variable ({connection_name}_{key_name}) to override connection configurations in serving mode, white space in connection name will be removed directly from environment variable name. For instance, if there is a custom connection named 'custom_connection' with a configuration key called 'chat_deployment_name,' the function will attempt to retrieve 'chat_deployment_name' from the environment variable 'CUSTOM_CONNECTION_CHAT_DEPLOYMENT_NAME' by default. If the environment variable is not set, it will use the original value as a fallback.

The following CLI commands allows you serve a flow folder as an endpoint. By running this command, a flask app will start in the environment where command is executed, please ensure all prerequisites required by flow have been installed.

# Serve the flow at localhost:8080
pf flow serve --source <path-to-your-flow-folder> --port 8080 --host localhost

The expected result is as follows if the flow served successfully, and the process will keep alive until it be killed manually.

img ::: :::{tab-item} VS Code Extension :sync: VSC In visual editor, choose: img then choose format: img then in yaml editor: img ::: ::::

Test endpoint

::::{tab-set} :::{tab-item} Bash You could open another terminal to test the endpoint with the following command:

curl http://localhost:8080/score --data '{"url":"https://play.google.com/store/apps/details?id=com.twitter.android"}' -X POST  -H "Content-Type: application/json"

::: :::{tab-item} PowerShell You could open another terminal to test the endpoint with the following command:

Invoke-WebRequest -URI http://localhost:8080/score -Body '{"url":"https://play.google.com/store/apps/details?id=com.twitter.android"}' -Method POST  -ContentType "application/json"

::: :::{tab-item} Test Page The development server has a built-in web page you can use to test the flow. Open 'http://localhost:8080' in your browser. img ::: ::::

Next steps