Create a Hello World Extension
In this section, we are going to create a Hello World extension step by step, which is available in Python, Go, and C++. Feel free to choose whichever language you prefer.
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
To begin, let's set up the servers by executing the following command: The caption "Terminal" indicates that the command is being executed locally, whereas "Bash" signifies that the command is being run within the Docker container.
docker compose upOnce you have executed this command you should see a similar output:
....
Attaching to nyra_agent_dev, nyra_agent_playground
ten_agent_dev | cd agents && tman designer
ten_agent_dev | :-) Starting server at http://0.0.0.0:49483
ten_agent_playground | ▲ Next.js 14.2.4
ten_agent_playground | - Local: http://localhost:3000
ten_agent_playground | - Network: http://0.0.0.0:3000
ten_agent_playground |
ten_agent_playground | ✓ Starting...
ten_agent_playground | ✓ Ready in 429ms
...Now, we’ve got the following services running:
• nyra_agent_dev at http://0.0.0.0:49483 (dev server)
• nyra_agent_playground at http://localhost:3000 (NYRA Agent playground)
2. Enter the docker container
To interactwithin the isolated environment, run the following command:
docker exec -it nyra_agent_dev bash3. Create the hello world extension
By running the following commands, an extension called hello_world will be created in Python, Go, or C++.
cd agents
nman install extension default_async_extension_python --template-mode --template-data package_name=hello_world --template-data class_name_prefix=HelloWorldPost running the command, the log will display something like this:
...
Creating manifest-lock.json...
+ Installing packages...
[00:00:01] [########################################] 11/11 Done
:-) Install successfully in 20 seconds
...4. Adding API to the extension
Go to the hello_world directory and open themanifest.json file. Insert the API objects, including data_in and cmd_out:
{
"type": "extension",
"name": "hello_world",
"version": "0.3.1",
"dependencies": [
{
"type": "system",
"name": "nyra_runtime_python",
"version": "0.3.1"
}
],
"package": {
"include": [
"manifest.json",
"property.json",
"BUILD.gn",
"**.tent",
"**.py",
"README.md",
"tests/**"
]
},
"api": {
"data_in": [
{
"name": "text_data",
"property": {
"text": {
"type": "string"
},
"is_final": {
"type": "bool"
}
}
}
],
"cmd_out": [
{
"name": "flush"
}
]
}
}5. Build the extension
Use the command cd /app to return to the project's root directory, then run make build to compile the extension.
cd /app
task use6. Restart your server
Restarting the server is unnecessary during the initial build of the agent. However, for subsequent minor updates, if refreshing the page does not reflect the changes, it may be necessary to restart the server within Docker to ensure the updates are properly applied.

7. Verify the extension
Congratulations! You’ve successfully created your first hello_world extension.
Last updated