Skip to content

Commit 5a40d47

Browse files
Merge pull request #118 from restackio/quickstartEndpoints
Quickstart with endpoint
2 parents cef3c5d + 5d9f36d commit 5a40d47

File tree

17 files changed

+121
-118
lines changed

17 files changed

+121
-118
lines changed

get_started/README.md

Lines changed: 0 additions & 87 deletions
This file was deleted.

get_started/src/client.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

get_started/src/workflows/workflow.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

quickstart/README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Restack AI - Quickstart
2+
3+
This repository contains a quickstart for Restack.
4+
It demonstrates how to set up a basic workflow and functions.
5+
6+
## Prerequisites
7+
8+
- Docker (for running Restack)
9+
- Python 3.10 or higher
10+
11+
## Start Restack
12+
13+
To start the Restack, use the following Docker command:
14+
15+
```bash
16+
docker run -d --pull always --name restack -p 5233:5233 -p 6233:6233 -p 7233:7233 ghcr.io/restackio/restack:main
17+
```
18+
19+
## Install dependencies and start services
20+
21+
```bash
22+
poetry env use 3.10
23+
```
24+
25+
```bash
26+
poetry shell
27+
```
28+
29+
```bash
30+
poetry install
31+
```
32+
33+
```bash
34+
poetry env info # Optional: copy the interpreter path to use in your IDE (e.g. Cursor, VSCode, etc.)
35+
```
36+
37+
```bash
38+
poetry run dev
39+
```
40+
41+
## Run workflows
42+
43+
### from UI
44+
45+
You can run workflows from the UI by clicking the "Run" button.
46+
47+
![Run workflows from UI](./screenshot-quickstart.png)
48+
49+
### from API
50+
51+
You can run workflows from the API by using the generated endpoint:
52+
53+
`POST http://localhost:6233/api/workflows/GreetingWorkflow`
54+
55+
### from any client
56+
57+
You can run workflows with any client connected to Restack, for example:
58+
59+
```bash
60+
poetry run schedule
61+
```
62+
63+
executes `schedule_workflow.py` which will connect to Restack and execute the `GreetingWorkflow` workflow.
64+
65+
## Deploy on Restack Cloud
66+
67+
To deploy the application on Restack, you can create an account at [https://console.restack.io](https://console.restack.io)
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Project metadata
22
[tool.poetry]
3-
name = "get_started"
3+
name = "quickstart"
44
version = "0.0.1"
5-
description = "A simple example to get started with the restack-ai SDK"
5+
description = "A quickstart for Restack"
66
authors = [
77
"Restack Team <[email protected]>",
88
]
@@ -11,13 +11,11 @@ packages = [{include = "src"}]
1111

1212
[tool.poetry.dependencies]
1313
python = ">=3.10,<4.0"
14-
restack-ai = "^0.0.48"
1514
watchfiles = "^1.0.0"
16-
17-
[tool.poetry.dev-dependencies]
18-
pytest = "6.2" # Optional: Add if you want to include tests in your example
15+
pydantic = "^2.10.4"
1916

2017
# Build system configuration
18+
restack-ai = "^0.0.52"
2119
[build-system]
2220
requires = ["poetry-core"]
2321
build-backend = "poetry.core.masonry.api"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import time
33
from restack_ai import Restack
44
from restack_ai.restack import ScheduleSpec, ScheduleCalendarSpec, ScheduleRange
5-
5+
from src.workflows.workflow import GreetingWorkflowInput
66
async def main():
77

88
client = Restack()
@@ -11,6 +11,7 @@ async def main():
1111
await client.schedule_workflow(
1212
workflow_name="GreetingWorkflow",
1313
workflow_id=workflow_id,
14+
input=GreetingWorkflowInput(name="Bob"),
1415
schedule=ScheduleSpec(
1516
calendars=[ScheduleCalendarSpec(
1617
day_of_week=[ScheduleRange(start=1)],
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from restack_ai import Restack
44
from restack_ai.restack import ScheduleSpec, ScheduleIntervalSpec
55
from datetime import timedelta
6-
6+
from src.workflows.workflow import GreetingWorkflowInput
77
async def main():
88

99
client = Restack()
@@ -12,6 +12,7 @@ async def main():
1212
await client.schedule_workflow(
1313
workflow_name="GreetingWorkflow",
1414
workflow_id=workflow_id,
15+
input=GreetingWorkflowInput(name="Bob"),
1516
schedule=ScheduleSpec(
1617
intervals=[ScheduleIntervalSpec(
1718
every=timedelta(minutes=10)
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import asyncio
22
import time
33
from restack_ai import Restack
4-
4+
from src.workflows.workflow import GreetingWorkflowInput
55
async def main():
66

77
client = Restack()
88

99
workflow_id = f"{int(time.time() * 1000)}-GreetingWorkflow"
1010
run_id = await client.schedule_workflow(
1111
workflow_name="GreetingWorkflow",
12-
workflow_id=workflow_id
12+
workflow_id=workflow_id,
13+
input=GreetingWorkflowInput(name="Bob")
1314
)
1415

1516
await client.get_workflow_result(

0 commit comments

Comments
 (0)