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
(dev server)
• ten_agent_playground
at http://localhost:3000
(TEN Agent playground)
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
:
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
Congratulations! You’ve successfully created your first hello_world
extension.
Last updated