1 unstable release

0.1.0 Jun 26, 2024

#18 in #event-handling


Used in swimos

Apache-2.0

2.5MB
65K SLoC

Agent Model and Lifecycle Definition API

This crate provides a framework for building agent implementations that are executed by the SwimOS runtime. Typically, the proc macros defined in the swimos_agent_derive crate will be used to generate agent specifications and agent lifecycles.

An agent specification defines the structure of the agent in terms of lanes and stores. A specification is sufficient, on its own, to define an agent route for the runtime. However, it will have only state with no associated behaviour.

An agent lifecycle is tied to a specific type of agent (any implementation of agent_model::AgentSpec). It adds behaviour to the agent by attaching event handlers to various lifecycle events defined for the agent and its lanes and stores. As the agent is executed by the runtime, each time one of these events is encountered, the appropriate event handler will be selected by the lifecycle and then executed.

Multiple lifecycle implementations maybe defined for the same agent specification, allowing the same structure to be used with different behaviour on separate agent routes.

Dependencies

~9–16MB
~197K SLoC