Expand description
§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.
Modules§
- agent_
lifecycle - Defines the agent lifecycle trait, use to specify lifecycles that can be associated with an agent specification.
- agent_
model - Defines the agent specification trait used to specify the structure of an agent it terms of lanes and stores.
- commander
- config
- Configuration types for downlinks that are started from agent lifecycles.
- downlink_
lifecycle - Traits and builders for constructing downlink lifecycles for downlinks started from agent lifecycles.
- event_
handler - Defines the
event_handler::HandlerActionandevent_handler::EventHandlertraits used to specify event handlers in agent lifecycle. - lanes
- Defines the lane types that can be included in agent specifications. Lanes are exposed externally by the runtime, using the WARP protocol (or HTTP in the case of HTTP lanes). The states of lanes may be stored persistently by the runtime.
- state
- Utility types for building stateful agent lifecycles.
- stores
- Defines the store types that can be included in agent specifications. These are not exposed externally but their states may be stored persistently by the runtime.
Traits§
- Agent
Item - Base trait for all agent items (lanes and stores).