From b6cb9b2c056994e530b5954d5ec58ba3b435b6d5 Mon Sep 17 00:00:00 2001 From: zhangqianze Date: Sat, 1 Feb 2025 00:36:23 +0800 Subject: [PATCH 1/3] feat: support deploy doc --- en/SUMMARY.md | 1 + en/ten_agent/deploy_agent_service.md | 46 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 en/ten_agent/deploy_agent_service.md diff --git a/en/SUMMARY.md b/en/SUMMARY.md index f1d9ecf..2a8efdc 100644 --- a/en/SUMMARY.md +++ b/en/SUMMARY.md @@ -28,6 +28,7 @@ * [Story Teller](ten_agent/playground/run_story_telling.md) * [Change Language](ten_agent/playground/change_language.md) * [Customize TEN Agent](ten_agent/customize_your_agent.md) +* [Deploy TEN Agent Service](ten_agent/deploy_agent_service.md) * [Create a Hello World Extension](ten_agent/create_a_hello_world_extension.md) * [How does interrupt work in TEN-Agent](ten_agent/how_does_interrupt_work.md) * [Create an Extension with Predefined Type](ten_agent/create_an_extension_with_predefined_type/overview.md) diff --git a/en/ten_agent/deploy_agent_service.md b/en/ten_agent/deploy_agent_service.md new file mode 100644 index 0000000..9a6242a --- /dev/null +++ b/en/ten_agent/deploy_agent_service.md @@ -0,0 +1,46 @@ +# Deploy your agent service + +Once you have customized your agent (either by using the playground or editing property.json directly), you can deploy it by creating a release docker image for your service. + +## Make your agent service into a docker image + +The Dockerfile has been prepared in project root folder. You can build the docker image by running the following command: + +```shell +docker build -t ten-agent-server . +``` + +In case you are using `demo` or `experimental` folder, you can build the docker image by running the following command: + +```shell +docker build --build-arg USE_AGENT=agents/examples/demo -t ten-agent-server . +``` + +```shell +docker build --build-arg USE_AGENT=agents/examples/experimental -t ten-agent-server . +``` + +> Note: The `USE_AGENT` argument is optional. If you don't specify it, the default agent will be used. + +## Run the docker image + +After building the docker image, you can run it by running the following command: + +```shell +docker run -itd -p 8083:8080 --env-file .env --name ten-agent-server ten-agent-server +``` + +The agent service will be running on port 8083 now. + +## Test the agent service + +The service exposes a list of apis that you can use to interact with the agent. The api reference can be found [here](https://github.com/TEN-framework/TEN-Agent/tree/main/server). + +You can also test the agent service by running the following command in playground client: + +```shell +EDIT_GRAPH_MODE=false AGENT_SERVER_URL=http://localhost:8083 pnpm dev +``` + +> Note: The `AGENT_SERVER_URL` should be the url where your agent service is running. If you are running the agent service on your server, replace `localhost` with your server ip. +> Note: The `EDIT_GRAPH_MODE` should be set to `false` to use the agent service, as the released docker image has no dev server packaged. From ca6a4c31692399192228a8580c3134e7008d9c7d Mon Sep 17 00:00:00 2001 From: zhangqianze Date: Wed, 5 Feb 2025 14:48:25 +0800 Subject: [PATCH 2/3] fix: update env param --- en/ten_agent/deploy_agent_service.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en/ten_agent/deploy_agent_service.md b/en/ten_agent/deploy_agent_service.md index 9a6242a..a8a2a04 100644 --- a/en/ten_agent/deploy_agent_service.md +++ b/en/ten_agent/deploy_agent_service.md @@ -39,8 +39,8 @@ The service exposes a list of apis that you can use to interact with the agent. You can also test the agent service by running the following command in playground client: ```shell -EDIT_GRAPH_MODE=false AGENT_SERVER_URL=http://localhost:8083 pnpm dev +NEXT_PUBLIC_EDIT_GRAPH_MODE=false AGENT_SERVER_URL=http://localhost:8083 pnpm dev ``` > Note: The `AGENT_SERVER_URL` should be the url where your agent service is running. If you are running the agent service on your server, replace `localhost` with your server ip. -> Note: The `EDIT_GRAPH_MODE` should be set to `false` to use the agent service, as the released docker image has no dev server packaged. +> Note: The `NEXT_PUBLIC_EDIT_GRAPH_MODE` should be set to `false` to use the agent service, as the released docker image has no dev server packaged. From b2ec18bb0a2b01a41a078d02e1fa45091f4a4638 Mon Sep 17 00:00:00 2001 From: zhangqianze Date: Wed, 5 Feb 2025 20:25:04 +0800 Subject: [PATCH 3/3] feat: add playground ui part --- en/SUMMARY.md | 3 ++- .../deploy_agent_service.md | 20 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) rename en/ten_agent/{ => deploy_ten_agent}/deploy_agent_service.md (58%) diff --git a/en/SUMMARY.md b/en/SUMMARY.md index 2a8efdc..1968619 100644 --- a/en/SUMMARY.md +++ b/en/SUMMARY.md @@ -28,7 +28,8 @@ * [Story Teller](ten_agent/playground/run_story_telling.md) * [Change Language](ten_agent/playground/change_language.md) * [Customize TEN Agent](ten_agent/customize_your_agent.md) -* [Deploy TEN Agent Service](ten_agent/deploy_agent_service.md) +* Deployment + * [Deploy TEN Agent Service](ten_agent/deploy_agent_service.md) * [Create a Hello World Extension](ten_agent/create_a_hello_world_extension.md) * [How does interrupt work in TEN-Agent](ten_agent/how_does_interrupt_work.md) * [Create an Extension with Predefined Type](ten_agent/create_an_extension_with_predefined_type/overview.md) diff --git a/en/ten_agent/deploy_agent_service.md b/en/ten_agent/deploy_ten_agent/deploy_agent_service.md similarity index 58% rename from en/ten_agent/deploy_agent_service.md rename to en/ten_agent/deploy_ten_agent/deploy_agent_service.md index a8a2a04..edd9d7d 100644 --- a/en/ten_agent/deploy_agent_service.md +++ b/en/ten_agent/deploy_ten_agent/deploy_agent_service.md @@ -34,7 +34,7 @@ The agent service will be running on port 8083 now. ## Test the agent service -The service exposes a list of apis that you can use to interact with the agent. The api reference can be found [here](https://github.com/TEN-framework/TEN-Agent/tree/main/server). +The service exposes a list of apis that you can use to interact with the agent. The api reference can be found [https://github.com/TEN-framework/TEN-Agent/tree/main/server](https://github.com/TEN-framework/TEN-Agent/tree/main/server). You can also test the agent service by running the following command in playground client: @@ -44,3 +44,21 @@ NEXT_PUBLIC_EDIT_GRAPH_MODE=false AGENT_SERVER_URL=http://localhost:8083 pnpm de > Note: The `AGENT_SERVER_URL` should be the url where your agent service is running. If you are running the agent service on your server, replace `localhost` with your server ip. > Note: The `NEXT_PUBLIC_EDIT_GRAPH_MODE` should be set to `false` to use the agent service, as the released docker image has no dev server packaged. + +## Test the agent service using playground docker image + +Sometimes you may want to deploy the playground along with the agent service. You can do this by running the following command to build your own playground UI into docker image: + +```shell +cd playground +docker build --build-arg EDIT_GRAPH_MODE=false -t ten-agent-playground . +``` + +Then you can run the playground docker image by running the following command: + +```shell +docker run -itd -p 4000:3000 -e AGENT_SERVER_URL=http://host.docker.internal:8083 --name ten-agent-playground ten-agent-playground +``` + +> Note: The `AGENT_SERVER_URL` should be the url where your agent service is running. Since you are running the agent service in another docker container, you can use `host.docker.internal` to access the host machine. If you are running the agent service on your server, replace `host.docker.internal` with your server ip. +> Note: If you are connecting to a released version of agent service, you should set `EDIT_GRAPH_MODE` to `false` when building the playground docker image.