Install Agentlang
To run Agentlang locally, you need to install the Agentlang CLI tool.
npm install -g agentlangcliOr install locally:
npm install agentlangcliYou may also use pnpm if you prefer:
pnpm install -g agentlangclihello, world
Now we shall proceed to create a very simple Agentlang app. To create the app, please type the following command:
agent init helloThis will create a directory called hello with the basic files required by an Agentlang project. Our first Agentlang app is going to be very simple - it returns the message “hello, world”. It’s overkill to use a powerful language like Agentlang to write a hello-world app, but that’s good enough to test our installation and to familiarize ourselves with the basic developer workflow.
An Agentlang app is made-up of modules. The hello app also has one module called hello.core in the file src/core.al. Open this file in your favorite text editor and update it to look like,
module hello.core
record Message {
content String
}
@public workflow sayHello {
{
Message {
content "hello, world"
}
}
} You can now run the model as,
agent runUse the following HTTP POST request to test the application:
curl --location --request POST 'http://localhost:8080/hello.core/sayHello' \
--header 'Content-Type: application/json' \
--data-raw '{}'You should see the following response:
{"Message": {"content":"hello, world"}}With Agentlang setup and working properly, you can now explore the language further by proceeding to the quick start guide on Agents.