1. Getting Started with ASTRA

This section gets you from nothing to a running ASTRA agent in a few minutes. Once you have a working project, Section 2 explains the concepts behind the language.

1.1 What you’ll need

ASTRA requires no direct installation. ASTRA code is compiled and run using Apache Maven, and the entire ASTRA codebase is available through Maven Central. You will need:

  • A Java Development Kit (JDK 1.8 or later)

  • Apache Maven (3.3 or later)

  • A text editor or IDE

The source code for ASTRA is available through gitlab.com.

1.2 Create your first project

The quickest way to create an ASTRA project is to use the ASTRA Maven archetype. In a folder of your choice, type:

mvn archetype:generate \
	-DarchetypeGroupId=com.astralanguage \
	-DarchetypeArtifactId=astra-archetype \
	-DarchetypeVersion=2.0.13 \
	-DgroupId=examples \
	-DartifactId=hello \
	-Dversion=0.1.0

You should change the groupId and artifactId to reflect your own project. This creates a hello folder containing a Maven build file (pom.xml) and a single agent program, src/main/astra/Main.astra:

agent Main {
    module Console console;

    plan +!main(list args) {
        console.println("Hello World, ASTRA");
    }
}

1.3 Run it

From inside the hello folder, type:

mvn

This compiles the agent program and deploys it. While there will be a lot of output, at the end you should see:

[INFO] --- astra:2.0.13:deploy (default-cli) @ hello ---
[main] Hello World, ASTRA

The text in square brackets is the name of the agent that generated the output (main by default). The ASTRA platform keeps running after the agent has finished, so press Ctrl+C to stop it. To make an agent end the program itself, see the Terminal Hello World example.

The Building & Deploying ASTRA Programs guide explains what is going on in more detail, including how to create a project without the archetype and how to choose which agent program is run.

1.4 ASTRA and IDE Integration

While ASTRA can be used with any IDE that supports Maven, we have chosen to provide support for syntax highlighting for the Visual Studio Code platform. This support is delivered through a custom extension. To install the extension, simply click on the extensions tab and type astra.

A step-by-step guide to Using IntelliJ with ASTRA is also available. If you wish to use another IDE, then you may be able to take advantage of the following extensions:

1.5 Where next?