Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/GMLC-TDC/HELICS/llms.txt

Use this file to discover all available pages before exploring further.

HELICS includes a built-in HTTP webserver that allows external tools to query the state of a running federation over standard HTTP. The webserver is available starting in HELICS 2.4 and is hosted by the helics_broker_server process. It enables real-time inspection of federation topology, current times, publications, subscriptions, endpoints, and federate states without requiring modification of the federate source code. The webserver requires Boost 1.70 or newer. It can be disabled at build time with HELICS_DISABLE_BOOST=ON or HELICS_DISABLE_WEBSERVER=ON.

Enabling the webserver

Start a broker server with the --http flag to enable the REST API:
helics_broker_server --http --zmq --duration 30minutes
By default the server listens on localhost:43542. To customize the port and interface:
{
  "http": {
    "port": 8080,
    "interface": "0.0.0.0"
  }
}
helics_broker_server --http --zmq --config broker_server_config.json
Or pass port settings directly on the command line:
helics_broker_server --http --zmq --http_server_args="--http_port=8080 --external"
The HELICS_HTTP_PORT environment variable is also recognized for setting the HTTP port. To make the server accessible from outside localhost, add --external to the http_server_args.

Websocket API

Start the broker server with --web instead of --http to enable a WebSocket interface on the same queries:
helics_broker_server --web --zmq --config broker_server_config.json
The WebSocket server defaults to port 43543 and acknowledges HELICS_WEBSOCKET_PORT as an environment variable. Responses are always JSON packets:
{ "status": 0, "value": "<query result>" }
Error responses:
{ "status": 404, "error": "target not found" }

HTTP actions

HTTP verbPurpose
GETExecute a query; target and query string specified in the URL or as query parameters
PUTCreate a new broker
DELETERemove a broker
POSTGeneral command; action controlled by the command field
SEARCHExecute a query with parameters in the request body

URL structure

Queries follow a predictable URL pattern:
http://<host>:<port>/<broker>/<target>/<query>
The following forms are all equivalent and execute the publications query against the root target of brokerA:
# Positional in URL
curl http://localhost:43542/brokerA/publications

# Query parameters
curl "http://localhost:43542?broker=brokerA&query=publications&target=root"

# JSON body (POST or SEARCH)
curl -X SEARCH http://localhost:43542 \
  -H "Content-Type: application/json" \
  -d '{"broker": "brokerA", "target": "root", "query": "publications"}'

Query request parameters

ParameterDescription
brokerThe broker to target. Also used as the name when creating or deleting a broker.
targetThe specific object to query (federate name, broker, core, root, federation).
queryThe query string to execute on the target.
commandExplicit command override for POST requests: query, search, create, delete.
typeBroker type when creating a broker with command=create.
argsCommand-line arguments to pass when creating a broker.

Query targets

Each query must specify a target. Targets can be referenced by their role in the federation hierarchy or by their explicit name.
TargetDescription
brokerThe first broker encountered going up from the calling context
root, federation, rootbrokerThe root broker of the entire federation
coreThe core of a federate (not valid from a broker)
federateThe local federate or the first federate of a core
parentThe parent of the calling object
globalRetrieve the value of a named global variable
<object name>Any named broker, core, or federate in the federation
If a broker is named broker or a federate is named root, those names will shadow the reserved target names. Use explicit object names to avoid ambiguity.

Available queries by target

Federate queries

These queries are answered by any named federate:
QueryReturn typeDescription
namestringIdentifier of the federate
existsbooleanWhether the federate exists in the federation
isinitbooleanWhether the federate has entered initialization mode
statestringCurrent operational state of the federate
global_statestructureState of the federate and all connected components
publicationsstring vectorCurrent publications registered by the federate
publication_detailsstructureDetailed metadata for each publication
subscriptionsstring vectorCurrent subscriptions of the federate
inputsstring vectorCurrent named inputs of the federate
input_detailsstructureDetailed metadata for each input
endpointsstring vectorCurrent endpoints of the federate
endpoint_detailsstructureDetailed metadata for each endpoint
current_timestructureCurrent granted time and related timing info
dependenciesstring vectorObjects this federate depends on
dependentsstring vectorObjects that depend on this federate
dependency_graphstructureFull dependency graph for the federation
data_flow_graphstructureAll data connections involving this federate
endpoint_filtersstructureFilter configuration for each endpoint
versionstringHELICS library version string
queriesstring vectorList of all supported query strings
tagsstructureAll user-defined tags (key-value pairs) as JSON
tag/<tagname>stringValue of a specific tag by name
logsstructureRecent log messages from the log buffer (requires logbuffer > 0)
barriersstructureCurrent time barriers

Core queries

These queries are answered by a HELICS core:
QueryReturn typeDescription
namestringIdentifier of the core
addressstringNetwork address of the core
isinitbooleanWhether the core has entered initialization mode
isconnectedbooleanWhether the core is connected to the network
federatesstring vectorFederates currently connected to this core
publicationsstring vectorAll publications defined in this core
inputsstring vectorAll named inputs defined in this core
endpointsstring vectorAll endpoints defined in this core
filtersstring vectorAll filters registered in this core
publication_detailsstructureDetailed publication metadata
input_detailsstructureDetailed input metadata
endpoint_detailsstructureDetailed endpoint metadata
filter_detailsstructureDetailed filter metadata
current_timestructureLocal time state of the core
global_timestructureTime status of all federates and cores
current_statestructureState of all components as known locally
global_statestructureState gathered from all components
federate_mapstructureHierarchical map of federates in this core
dependency_graphstructureDependency representation for this core
data_flow_graphstructureAll data connections in this core
federation_statestructureStatus of all brokers and federates
dependenciesstructureFull dependency information
versionstringHELICS library version string
version_allstructureVersion strings for all components
counterstringChange counter (increments on federation changes)
logsstructureBuffered log messages
tagsstructureAll tag key-value pairs
global_time_debuggingstructureDetailed time debugging state
global_flushstructureFlush ordered messages and return object IDs

Broker queries

These queries are answered by a HELICS broker:
QueryReturn typeDescription
namestringIdentifier of the broker
addressstringNetwork address of the broker
isinitbooleanWhether the broker has entered initialization mode
isconnectedbooleanWhether the broker is connected
federatesstring vectorAll federates under this broker’s hierarchy
brokersstring vectorConnected sub-brokers and cores
publicationsstring vectorAll publications known to this broker
inputsstring vectorAll named inputs known to this broker
endpointsstring vectorAll endpoints known to this broker
filtersstring vectorAll filters known to this broker
publication_detailsstructureDetailed publication metadata
input_detailsstructureDetailed input metadata
endpoint_detailsstructureDetailed endpoint metadata
filter_detailsstructureDetailed filter metadata
current_statestructureStatus of all known brokers and federates
global_statestructureState gathered from all system components
global_statusstructureCombined global_time + current_state
current_timestringLocal time, or #na if not computed
global_timestructureTime status of all federates and cores
statusstructureConnected status of the broker
countsstructureCount of brokers, federates, and interfaces
federate_mapstructureHierarchical map of the entire federation
dependency_graphstructureAll dependency connections in the federation
data_flow_graphstructureAll data connections in the federation
versionstringHELICS library version string
version_allstructureVersion strings of all broker components
counterstringChange counter
barriersstructureCurrent time barriers
logsstructureBuffered log messages
time_monitorstructureCurrent time from the designated monitor federate
monitorstringName of the current time monitor object
global_time_debuggingstructureDetailed time debugging state
global_flushstructureFlush all ordered messages and return IDs

JSON response format

Queries that return structures produce JSON responses. String vectors (sv) use a semicolon-delimited string format rather than a JSON array.

Broker list

curl http://localhost:43542/brokers
{
  "brokers": [
    {
      "address": "tcp://127.0.0.1:23408",
      "isConnected": true,
      "isOpen": false,
      "isRoot": true,
      "name": "brokerA"
    }
  ]
}

Federate map

curl http://localhost:43542/brokerA/federate_map
{
  "brokers": [],
  "cores": [
    {
      "federates": [
        {
          "id": 131072,
          "name": "fedA_1",
          "parent": 1879048192
        }
      ],
      "id": 1879048192,
      "name": "core-auto-1",
      "parent": 1
    }
  ],
  "id": 1,
  "name": "brokerA"
}

Current time

curl http://localhost:43542/brokerA/fedA_1/current_time
{
  "allow": 1.0,
  "granted": 0.5,
  "requested": 1.0
}

Publications list

curl http://localhost:43542/brokerA/publications
Returns a semicolon-delimited string vector:
fedA_1/voltage;fedA_2/current

Global state

curl http://localhost:43542/brokerA/global_state
{
  "brokers": [
    {
      "name": "brokerA",
      "state": "connected"
    }
  ],
  "federates": [
    {
      "name": "fedA_1",
      "state": "executing"
    },
    {
      "name": "fedA_2",
      "state": "executing"
    }
  ]
}

Error response

Querying a nonexistent target or using an invalid query string returns a JSON error:
curl http://localhost:43542/brokerA/nonexistent_federate/publications
{
  "error": {
    "code": 404,
    "message": "target not found"
  }
}

Query timeouts

Queries travel along priority message paths and do not block time advancement. They do have a default timeout of 15 seconds. If a query cannot be completed within the timeout (due to a federate failure or network issue), the string #timeout is returned. The timeout can be changed via the --querytimeout option on cores and brokers:
helics_broker_server --http --zmq --querytimeout=30s

Using queries from the C API

Queries are also available programmatically through the HELICS C API without the webserver:
// Create a query
HelicsQuery q = helicsCreateQuery("brokerA", "publications");

// Execute against a broker object
const char* result = helicsQueryBrokerExecute(q, broker, &err);
printf("Publications: %s\n", result);

// Or execute in the context of a federate
const char* result2 = helicsQueryExecute(q, fed, &err);

// Always free the query
helicsQueryFree(q);
Async queries are also supported:
helicsQueryExecuteAsync(q, fed, &err);
// ... do other work ...
while (!helicsQueryIsCompleted(q)) { /* wait */ }
const char* result = helicsQueryExecuteComplete(q, &err);
The global_flush query forces all messages in the ordered channel to be processed before returning. Use it when you need a guaranteed consistent snapshot of the federation state.

C API reference

Programmatic query API using helicsCreateQuery

C++ API reference

Query functions in the C++ Application API

Configuration options

logbuffer option to enable log retrieval via queries

Language bindings

Use queries from Python, Julia, Java, and MATLAB

Build docs developers (and LLMs) love