Skip to content

Commit 53a5fa5

Browse files
feat!: separate agents (#433)
* feat: update build image * feat: seperate agents * feat: use task instead of make, keep minimum compatibility for a while * feat: allow 'task use' to switch agent directly * feat: remove makefile * fix: typo * fix: run server and gd-server in parallel * doc: use `task run` to run both server and gd-server
1 parent a7987ff commit 53a5fa5

18 files changed

+1565
-1674
lines changed

.devcontainer/devcontainer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
33
{
44
"name": "ten_agent_dev",
5-
"image": "ghcr.io/ten-framework/ten_agent_build:0.2.3",
5+
"image": "ghcr.io/ten-framework/ten_agent_build:0.2.4",
66
"customizations": {
77
"vscode": {
88
"extensions": [

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/ten-framework/ten_agent_build:0.2.3 AS builder
1+
FROM ghcr.io/ten-framework/ten_agent_build:0.2.4 AS builder
22

33
ARG SESSION_CONTROL_CONF=session_control.conf
44

@@ -7,7 +7,7 @@ WORKDIR /app
77
COPY . .
88
COPY agents/${SESSION_CONTROL_CONF} agents/session_control.conf
99

10-
RUN make clean && make build && \
10+
RUN task clean && task use && \
1111
cd agents && ./scripts/package.sh
1212

1313
FROM ubuntu:22.04

Makefile

-49
This file was deleted.

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ You will need to uncheck "Use Rosetta for x86_64/amd64 emulation on Apple Silico
101101
![Docker Setting](https://github.com/TEN-framework/docs/blob/main/assets/gif/docker_setting.gif?raw=true)
102102

103103
#### Windows: Configuring Git to handle line endings
104-
To avoid problems in `make run-server` later, you can configure Git to properly handle line endings on Windows.([more here](https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings?platform=windows))
104+
To avoid problems in `task run` later, you can configure Git to properly handle line endings on Windows.([more here](https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings?platform=windows))
105105

106106
```bash
107107
git config --global core.autocrlf true
@@ -148,13 +148,13 @@ Open up a separate terminal window, enter the container and build the agent:
148148
```bash
149149
docker exec -it ten_agent_dev bash
150150

151-
make build
151+
task use AGENT=agents/examples/demo
152152
```
153153

154154
#### 5. Start the server
155-
Once the build is done, `make run-server` on port `8080`:
155+
Once the build is done, `task run` on port `8080/49483`:
156156
```bash
157-
make run-server
157+
task run
158158
```
159159

160160
### Finish and verify

Taskfile.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
version: '3'
2+
3+
tasks:
4+
clean:
5+
desc: clean up
6+
cmds:
7+
- task: clean-agents
8+
- task: clean-server
9+
10+
build:
11+
desc: build
12+
cmds:
13+
- task: build-agent
14+
- task: build-server
15+
16+
use:
17+
desc: use agent, default 'agents/examples/demo'
18+
vars:
19+
AGENT: '{{.AGENT| default "agents/examples/demo"}}'
20+
cmds:
21+
- ln -sf {{.USER_WORKING_DIR}}/{{.AGENT}}/manifest.json ./agents/
22+
- ln -sf {{.USER_WORKING_DIR}}/{{.AGENT}}/property.json ./agents/
23+
- task: build
24+
25+
run-server:
26+
desc: run backend http server
27+
cmds:
28+
- /app/server/bin/api
29+
30+
run-gd-server:
31+
desc: run tman dev http server for graph designer
32+
dir: ./agents
33+
cmds:
34+
- tman dev-server
35+
36+
run:
37+
desc: run servers
38+
deps:
39+
- task: run-server
40+
- task: run-gd-server
41+
42+
build-agent:
43+
desc: build agent
44+
dir: ./agents
45+
internal: true
46+
cmds:
47+
- ./scripts/install_deps_and_build.sh linux x64 && mv bin/main bin/worker
48+
49+
build-server:
50+
desc: build server
51+
dir: ./server
52+
internal: true
53+
cmds:
54+
- go mod tidy && go mod download && go build -o bin/api main.go
55+
56+
clean-agents:
57+
desc: clean up agents
58+
dir: ./agents
59+
internal: true
60+
cmds:
61+
- rm -rf manifest.json property.json manifest-lock.json bin/main bin/worker out .release ten_packages/system/ten_runtime* ten_packages/system/agora_rtc_sdk ten_packages/system/azure_speech_sdk ten_packages/system/nlohmann_json ten_packages/extension/agora_rtc ten_packages/extension/agora_rtm ten_packages/extension/agora_sess_ctrl ten_packages/extension/azure_tts ten_packages/extension/py_init_extension_cpp
62+
63+
clean-server:
64+
desc: clean up server
65+
dir: ./server
66+
internal: true
67+
cmds:
68+
- rm -rf bin

agents/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ xdump_config
3434
.vscode
3535
*.pyc
3636
*.pyc.*
37+
/manifest.json
38+
/manifest-lock.json
39+
/property.json

agents/manifest.json renamed to agents/examples/demo/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"type": "app",
3-
"name": "ten_agent",
3+
"name": "agent_demo",
44
"version": "0.4.0",
55
"dependencies": [
66
{

0 commit comments

Comments
 (0)