Skip to main content
Version: 🚧 Alpha 🚧

The platform agent (gama)

GAMA runs exactly one agent of the built-in species platform, whose instance is named gama. It represents the running platform itself rather than a simulated world: the interactive console says so when no experiment is running, by announcing Interacting with platform gama. Its role in models is to give GAML code access to the preferences of the platform and to forward messages to the clients of the headless server.

Preferences as variables of the species​

Every preference that is declared accessible from GAML becomes an attribute of the platform species, under its own key (pref_...). Such an attribute can be read and written from GAML:

write gama.pref_parallel_simulations;
gama.pref_parallel_simulations <- false;

Two consequences are worth knowing when a page of this documentation shows such an assignment:

  • Only preferences declared with the inGaml flag are exposed; the key of a preference is given by the contextual menu of its line in the preference view, and a key that is not exposed there simply does not exist as a variable.
  • Both forms (gama.pref_... and platform.pref_...) designate the same attribute of the same agent. Assigning it changes the value used by the running platform; a value can also be imposed from outside, at launch, since a JVM system property of the same name takes precedence over every other source (see Using GAMA flags).

Read-only attributes​

The attributes below are declared by the species (as getters of PlatformAgent) and are the reason the agent is used in models: they give GAML code access to the machine and to the installation.

AttributeValue
machine_timecurrent system time, in milliseconds since the UNIX epoch. The way to measure the wall-clock duration of a simulation
workspace_pathabsolute path of the workspace
versionversion of the GAMA bundle (e.g. 2026.11.0)
platformname of the operating system
infocomplete system information, the block to paste in a bug report
pluginslist of the symbolic names of every installed bundle
free_memorymemory still available to the JVM, in bytes
max_memorymaximum memory the JVM may allocate, in bytes
global {
float start_time;
init {
start_time <- gama.machine_time;
write gama.version + " on " + gama.platform;
}
reflex measure_time {
write "elapsed: " + (gama.machine_time - start_time) + " ms";
}
}

machine_time is read from the system, so it moves even when the cycle of the experiment is frozen: a model that uses it (directly or through machine_time-based dates) is not reproducible on its own. The class documentation of the agent also advertises a workspace attribute (a file) and a die action; neither is declared in the class, which is worth reporting to the developers rather than documenting here.

The only action of the species​

platform declares a single action, send, which takes one mandatory argument (message) and forwards its value to the clients connected to the headless server as a simulation output. It is meant for the remote drivers of a simulation (the Python and TypeScript clients), not for communication between agents: for that, agents exchange messages through the network or FIPA skills.

It only works while the experiment is driven by a server (started with -socket, see HeadlessServer): the action looks up the socket of the current server configuration and, when there is none, prints No socket found, maybe the client is already disconnected. Unable to send message: … as a debug trace and returns without raising an error, so calling it from an ordinary GUI experiment appears to do nothing. The Java method behind it also takes a message type (MessageType, defaulting to SimulationOutput), but that argument is not exposed to GAML: message is the only one the action declares.

What is not part of GAML​

The names get_preferences, set_preference, validate, load, reload, play, pause, step, stepBack, describe, upload and download are commands of the headless server, sent over a socket by an external client, and are not callable from a model or from the console. They are listed and described in HeadlessServer; the vocabulary itself is declared in gama.api/src/gama/api/utils/server/ISocketCommand.java.

Similarly, the console does not become a platform shell: without an active experiment it still answers ?keyword requests (the documentation comes from the compiler), but evaluating an expression replies that no experiment is running.