Create a Hello World Extension
In this chapter, we are going to create a Hello World
extension step by step, available in Python, Go, and C++. Feel free to choose whichever language you prefer. So buckle up.
Prerequisites
Before diving into this chapter, you’ll need to be familiar with the basics covered earlier. Specifically, ensure you understand how to use docker compose up
and are aware of the services running in the background.
1. Compose up the servers
First things first, let’s start by composing the servers. Run the following command:
If the caption says Terminal
, it means you are running the command locally. If the caption says Bash
, it means you are running the command in the Docker container.
Once the command is entered, you should see output similar to this:
Now, we’ve got the following services running:
• ten_agent_dev
at http://0.0.0.0:49483
(the backend server)
• ten_agent_playground
at http://localhost:3000
(the playground of TEN Agent)
• ten_graph_designer
at http://localhost:3001
(the frontend of Graph Designer)
• ten_agent_demo
at http://localhost:3002
(the frontend of TEN Agent, where the OpenAI Realtime API magic is)
2. Enter the docker container
To work within the isolated environment, run the following command:
3. Create the hello world extension
By running the following commands, an extension called hello_world
will be created in Python, Go, or C++.
After running the command, the log will display something like this:
4. Adding API to the extension
Navigate into the hello_world
directory and open manifest.json. Add the API objects with data_in
and cmd_out
, which we will use shortly within the Graph Designer:
5. Build the extension
Let's use cd /app
command to go back to the root of the project, and run make build
to build the extension.
6. Restart the server
You don’t need to restart the server when you first build the agent. However, after making minor updates, if refreshing the page doesn’t apply the changes, you’ll need to restart the server in Docker to ensure the updates take effect.
7. Verify the extension
Open http://localhost:3001
in your browser. You should see hello_world
in the left menu. Drag it to the canvas, and connect it to the text_data
input and flash
output.
You see the green and red color indicting the possible routes of node connecting.
Congratulations! You’ve successfully created your first hello_world
extension, and it’s working seamlessly within the Graph Designer canvas.
Last updated