langgoap.run_sensors_async

langgoap.run_sensors_async#

async run_sensors_async(sensors, world_state)[source]#

Run all sensors asynchronously and return (name, updates) pairs.

Falls back to sense() in a thread executor for sensors that only implement the sync Sensor protocol. Exceptions from individual sensors are caught and logged so a single failing sensor never halts the rest.

Execution order: sensors are awaited sequentially (one at a time). This is intentional — each sensor receives the cumulative world_state that includes all updates from sensors that ran before it, enabling dependent sensor chains (e.g. sensor B reads the value written by sensor A). If your sensors are fully independent and latency is critical, run them concurrently yourself with asyncio.gather() and merge the result dicts manually.

Parameters:
Return type:

list[tuple[str, dict[str, Any]]]