11# Restack AI - Production Example
22
3- This repository contains a simple example project to help you scale with the Restack AI.
3+ This repository contains a simple example project to help you scale with Restack AI.
44It demonstrates how to scale reliably to millions of workflows on a local machine with a local LLM provider.
55
66## Walkthrough video
@@ -60,85 +60,93 @@ And for each child workflow, for each step you can see how long the function sta
6060
6161## Prerequisites
6262
63- - Python 3.8 or higher
63+ - Python 3.10 or higher
6464- Poetry (for dependency management)
6565- Docker (for running the Restack services)
6666- Local LLM provider (we use LMStudio and a Meta Llama 3.1 8B Instruct 4bit model in this example)
6767
68- ## Usage
68+ ## Start LM stduio for local LLM provider
6969
70- 0 . Start LM Studio and start local server with Meta Llama 3.1 8B Instruct 4bit model
70+ Start local server with Meta Llama 3.1 8B Instruct 4bit model
7171
7272https://lmstudio.ai
7373
74- 1 . Run Restack local engine with Docker:
74+ ## Prerequisites
7575
76- ``` bash
77- docker run -d --pull always --name restack -p 5233:5233 -p 6233:6233 -p 7233:7233 ghcr.io/restackio/restack:main
78- ```
76+ - Docker (for running Restack)
77+ - Python 3.10 or higher
7978
80- 2 . Open the web UI to see the workflows:
79+ ## Start Restack
8180
82- ``` bash
83- http://localhost:5233
84- ```
81+ To start the Restack, use the following Docker command:
8582
86- 3 . Clone this repository:
83+ ``` bash
84+ docker run -d --pull always --name restack -p 5233:5233 -p 6233:6233 -p 7233:7233 ghcr.io/restackio/restack:main
85+ ```
8786
88- ``` bash
89- git clone https://github.com/restackio/examples-python
90- cd examples-python/examples/production_demo
91- ```
87+ ## Start python shell
9288
93- 4 . Install dependencies using Poetry:
89+ ``` bash
90+ poetry env use 3.10 && poetry shell
91+ ```
9492
95- ``` bash
96- poetry env use 3.12
97- ```
93+ ## Install dependencies
94+
95+ ``` bash
96+ poetry install
97+ ```
98+
99+ ``` bash
100+ poetry env info # Optional: copy the interpreter path to use in your IDE (e.g. Cursor, VSCode, etc.)
101+ ```
102+
103+ ``` bash
104+ poetry run dev
105+ ```
98106
99- ``` bash
100- poetry shell
101- ```
107+ ## Run workflows
102108
103- ``` bash
104- poetry install
105- ```
109+ ### from UI
106110
107- ``` bash
108- poetry env info # Optional: copy the interpreter path to use in your IDE (e.g. Cursor, VSCode, etc.)
109- ```
111+ You can run workflows from the UI by clicking the "Run" button.
110112
111- 5 . Run the services:
113+ ![ Run workflows from UI ] ( ./ui-endpoints.png )
112114
113- ``` bash
114- poetry run dev
115- ```
115+ ### from API
116116
117- This will start the Restack service with the defined workflows and functions.
117+ You can run one workflow from the API by using the generated endpoint:
118118
119- 6 . In a new terminal, schedule the workflow:
119+ ` POST http://localhost:6233/api/workflows/ChildWorkflow `
120120
121- ``` bash
122- poetry shell
123- ```
121+ or multiple workflows by using the generated endpoint:
124122
125- ``` bash
126- poetry run workflow
127- ```
123+ ` POST http://localhost:6233/api/workflows/ExampleWorkflow `
128124
129- This will schedule the ExampleWorkflow` and print the result.
125+ ### from any client
130126
131- 7 . Optionally, schedule the workflow to run on a interval:
127+ You can run workflows with any client connected to Restack, for example:
128+
129+ ``` bash
130+ poetry run schedule
131+ ```
132+
133+ executes ` schedule_workflow.py ` which will connect to Restack and execute the ` ChildWorkflow ` workflow.
134+
135+ ``` bash
136+ poetry run scale
137+ ```
138+
139+ executes ` schedule_scale.py ` which will connect to Restack and execute the ` ExampleWorkflow ` workflow.
140+
141+ ``` bash
142+ poetry run interval
143+ ```
132144
133- ``` bash
134- poetry run interval
135- ```
145+ executes ` schedule_interval.py ` which will connect to Restack and execute the ` ChildWorkflow ` workflow every second.
136146
137- 8 . Optionally, schedule a parent workflow to run 50 child workflows all at once:
147+ ## Deploy on Restack Cloud
138148
139- ``` bash
140- poetry run scale
141- ```
149+ To deploy the application on Restack, you can create an account at [ https://console.restack.io ] ( https://console.restack.io )
142150
143151## Project Structure
144152
@@ -149,7 +157,7 @@ https://lmstudio.ai
149157 - ` services.py ` : Sets up and runs the Restack services
150158- ` schedule_workflow.py ` : Example script to schedule and run a workflow
151159- ` schedule_interval.py ` : Example script to schedule and a workflow every second
152- - ` schedule_scale.py ` : Example script to schedule and run 100 workflows at once
160+ - ` schedule_scale.py ` : Example script to schedule and run 50 workflows at once
153161
154162# Deployment
155163
0 commit comments