2 releases
0.1.1 | Sep 27, 2024 |
---|---|
0.1.0 | Jun 26, 2024 |
#5 in #decentralized-applications
203 downloads per month
Used in 3 crates
2.5MB
69K
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
~198K SLoC