ASTRA Syntax at a Glance

This page is a quick map of the main forms in an ASTRA agent. Follow the links for explanations and examples.

Agent structure

An agent is declared in a .astra file whose name matches the agent class. Its body can contain module declarations, type declarations, initial beliefs and goals, plans, inference rules, and teleo-reactive functions:

agent Hello {
    module Console console;

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

The keyword rule can be used in place of plan; the two are equivalent. The ASTRA archetype and the LLM libraries use rule.

See AgentSpeak(L) and ASTRA for the agent model and Declaring Variables for variable forms.

Common plan triggers

Form

Meaning

+belief(...)

A belief was added.

-belief(...)

A belief was removed.

+!goal(...)

A goal was adopted.

^!goal(...)

An adopted goal failed.

+?formula(...)

A test goal needs a plan to find an answer.

@message(performative, sender, content)

A message arrived.

Plans may include a context after : and a body in braces. See Beliefs and Inference, Encapsulated Goals, Test Goals, Failure Handling, and Agent Communication.

Types and expressions

Declare formula signatures in a types block. Common types include int, long, float, double, char, boolean, string, list, and funct. See Types and Operators for the full table, expression precedence, and examples.

Statements

Common statements include sub-goals (!goal(...)), test goals (?formula(...)), belief updates (+belief(...) and -belief(...)), queries (query(...)), conditionals (if (...) { ... }), loops (while (...) { ... }), and module actions (module.action(...)). See Variables, Choice and Repetition for control flow and Failure Handling for try/recover.

The statements activate function(...); and deactivate; start and stop a teleo-reactive function. See Teleo-Reactive Functions.