Skip to content

Commit f83a2b0

Browse files
authored
Merge pull request #159 from restackio/update-agent-examples
Update agent examples
2 parents 8dd33cc + 7b2a225 commit f83a2b0

8 files changed

+1523
-65
lines changed

agent_chat/Dockerfile

+3-8
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,14 @@ WORKDIR /app
44

55
RUN apt-get update && apt-get install -y
66

7-
RUN pip install poetry
8-
9-
COPY pyproject.toml ./
7+
COPY pyproject.toml requirements.txt ./
108

119
COPY . .
1210

13-
# Configure poetry to not create virtual environment
14-
RUN poetry config virtualenvs.create false
15-
1611
# Install dependencies
17-
RUN poetry install --no-interaction --no-ansi
12+
RUN pip install -e .
1813

1914
# Expose port 80
2015
EXPOSE 80
2116

22-
CMD poetry run python -m src.services
17+
CMD ["python", "-m", "src.services"]

agent_chat/README.md

+56-5
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,47 @@ docker run -d --pull always --name restack -p 5233:5233 -p 6233:6233 -p 7233:723
1818

1919
## Start python shell
2020

21+
If using uv:
22+
2123
```bash
22-
poetry env use 3.10 && poetry shell
24+
uv venv && source .venv/bin/activate
2325
```
2426

25-
## Install dependencies
27+
If using poetry:
2628

2729
```bash
28-
poetry install
30+
poetry env use 3.12 && poetry shell
2931
```
3032

33+
If using pip:
34+
3135
```bash
32-
poetry env info # Optional: copy the interpreter path to use in your IDE (e.g. Cursor, VSCode, etc.)
36+
python -m venv .venv && source .venv/bin/activate
3337
```
3438

39+
## Install dependencies
40+
41+
If using uv:
42+
3543
```bash
44+
uv sync
45+
uv run dev
46+
```
47+
48+
If using poetry:
49+
50+
```bash
51+
poetry install
3652
poetry run dev
3753
```
3854

55+
If using pip:
56+
57+
```bash
58+
pip install -e .
59+
python -c "from src.services import watch_services; watch_services()"
60+
```
61+
3962
## Run agent
4063

4164
### from UI
@@ -54,8 +77,22 @@ You can run workflows from the API by using the generated endpoint:
5477

5578
You can run workflows with any client connected to Restack, for example:
5679

80+
If using uv:
81+
5782
```bash
58-
poetry run schedule
83+
uv run schedule-seed-workflow
84+
```
85+
86+
If using poetry:
87+
88+
```bash
89+
poetry run schedule-seed-workflow
90+
```
91+
92+
If using pip:
93+
94+
```bash
95+
python -c "from src.schedule_workflow import run_schedule_seed_workflow; run_schedule_seed_workflow()"
5996
```
6097

6198
executes `schedule_agent.py` which will connect to Restack and execute the `AgentChat` agent.
@@ -105,10 +142,24 @@ You can send event to the agent workflows with any client connected to Restack,
105142

106143
Modify workflow_id and run_id in event_workflow.py and then run:
107144

145+
If using uv:
146+
147+
```bash
148+
uv run event
149+
```
150+
151+
If using poetry:
152+
108153
```bash
109154
poetry run event
110155
```
111156

157+
If using pip:
158+
159+
```bash
160+
python -c "from src.event_agent import run_event_agent; run_event_agent()"
161+
```
162+
112163
It will connect to Restack and send 2 events to the agent, one to generate another agent and another one to end the conversation.
113164

114165
## Deploy on Restack Cloud

agent_chat/pyproject.toml

+20-19
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
# Project metadata
2-
[tool.poetry]
1+
[project]
32
name = "agent_chat"
43
version = "0.0.1"
54
description = "An agent chat for Restack"
6-
authors = [
7-
"Restack Team <[email protected]>",
8-
]
5+
authors = [{ name = "Restack Team", email = "[email protected]" }]
6+
requires-python = ">=3.10,<4.0"
97
readme = "README.md"
10-
packages = [{include = "src"}]
11-
12-
[tool.poetry.dependencies]
13-
python = ">=3.10,<4.0"
14-
watchfiles = "^1.0.0"
15-
pydantic = "^2.10.4"
16-
openai = "^1.60.2"
17-
restack-ai = "^0.0.57"
18-
19-
[build-system]
20-
requires = ["poetry-core"]
21-
build-backend = "poetry.core.masonry.api"
8+
dependencies = [
9+
"watchfiles>=1.0.0,<2",
10+
"pydantic>=2.10.4,<3",
11+
"openai>=1.60.2,<2",
12+
"restack-ai>=0.0.57,<0.0.58",
13+
]
2214

23-
# CLI command configuration
24-
[tool.poetry.scripts]
15+
[project.scripts]
2516
dev = "src.services:watch_services"
2617
services = "src.services:run_services"
2718
schedule = "schedule_agent:run_schedule_agent"
2819
event = "event_agent:run_event_agent"
20+
21+
[tool.hatch.build.targets.sdist]
22+
include = ["src"]
23+
24+
[tool.hatch.build.targets.wheel]
25+
include = ["src"]
26+
27+
[build-system]
28+
requires = ["hatchling"]
29+
build-backend = "hatchling.build"

agent_chat/requirements.txt

+666
Large diffs are not rendered by default.

agent_tool/Dockerfile

+3-8
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,14 @@ WORKDIR /app
44

55
RUN apt-get update && apt-get install -y
66

7-
RUN pip install poetry
8-
9-
COPY pyproject.toml ./
7+
COPY pyproject.toml requirements.txt ./
108

119
COPY . .
1210

13-
# Configure poetry to not create virtual environment
14-
RUN poetry config virtualenvs.create false
15-
1611
# Install dependencies
17-
RUN poetry install --no-interaction --no-ansi
12+
RUN pip install -e .
1813

1914
# Expose port 80
2015
EXPOSE 80
2116

22-
CMD poetry run python -m src.services
17+
CMD ["python", "-m", "src.services"]

agent_tool/README.md

+27-4
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,47 @@ docker run -d --pull always --name restack -p 5233:5233 -p 6233:6233 -p 7233:723
2020

2121
## Start python shell
2222

23+
If using uv:
24+
2325
```bash
24-
poetry env use 3.10 && poetry shell
26+
uv venv && source .venv/bin/activate
2527
```
2628

27-
## Install dependencies
29+
If using poetry:
2830

2931
```bash
30-
poetry install
32+
poetry env use 3.12 && poetry shell
33+
```
34+
35+
If using pip:
36+
37+
```bash
38+
python -m venv .venv && source .venv/bin/activate
3139
```
3240

41+
## Install dependencies
42+
43+
If using uv:
44+
3345
```bash
34-
poetry env info # Optional: copy the interpreter path to use in your IDE (e.g. Cursor, VSCode, etc.)
46+
uv sync
47+
uv run dev
3548
```
3649

50+
If using poetry:
51+
3752
```bash
53+
poetry install
3854
poetry run dev
3955
```
4056

57+
If using pip:
58+
59+
```bash
60+
pip install -e .
61+
python -c "from src.services import watch_services; watch_services()"
62+
```
63+
4164
## Configure Your Environment Variables
4265

4366
Duplicate the `env.example` file and rename it to `.env`.

agent_tool/pyproject.toml

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
# Project metadata
2-
[tool.poetry]
1+
[project]
32
name = "agent_tool"
43
version = "0.0.1"
54
description = "A tool for an AI agent"
6-
authors = [
7-
"Restack Team <[email protected]>",
8-
]
5+
authors = [{ name = "Restack Team", email = "[email protected]" }]
6+
requires-python = ">=3.10,<4.0"
97
readme = "README.md"
10-
packages = [{include = "src"}]
8+
dependencies = [
9+
"watchfiles>=1.0.0,<2",
10+
"pydantic>=2.10.4,<3",
11+
"requests==2.32.3",
12+
"openai>=1.60.2,<2",
13+
"restack-ai>=0.0.57,<0.0.58",
14+
]
1115

12-
[tool.poetry.dependencies]
13-
python = ">=3.10,<4.0"
14-
watchfiles = "^1.0.0"
15-
pydantic = "^2.10.4"
16-
requests = "2.32.3"
16+
[project.scripts]
17+
dev = "src.services:watch_services"
18+
services = "src.services:run_services"
1719

18-
# Build system configuration
19-
openai = "^1.60.2"
20-
restack-ai = "^0.0.57"
21-
[build-system]
22-
requires = ["poetry-core"]
23-
build-backend = "poetry.core.masonry.api"
20+
[tool.hatch.build.targets.sdist]
21+
include = ["src"]
2422

25-
# CLI command configuration
26-
[tool.poetry.scripts]
27-
dev = "src.services:watch_services"
28-
services = "src.services:run_services"
23+
[tool.hatch.build.targets.wheel]
24+
include = ["src"]
25+
26+
[build-system]
27+
requires = ["hatchling"]
28+
build-backend = "hatchling.build"

0 commit comments

Comments
 (0)