Agents
Agents define the routing logic between events and entities, the binding logic that determines which entity to target, and the function logic that defines how to process the event. An agent detects incoming events, and can also send new events.
Agents relate events to entities, and detect situations such as risks or opportunities by using correlation, aggregation, rules, predictive models, and time logic. The Decision Server Insights solution routes events to agents based on the data in the incoming events (payload), binds an entity to the agent, and runs the business logic that is defined in the agent.
An agent is bound to only one entity, although several agents can be bound to the same entity. The binding to the entity is defined at the agent level, in an agent descriptor. If an event is dispatched to several agents that target the same entity (entity with the same identifier), the runtime invocation order of the agents is based on the priority that is defined in the agents.
Java™ agents can also operate over single events or a sequence of events independent of any entity.
Agents can be triggered by the arrival of events, and can also be scheduled for execution. Agents can update their internal state, update the state of their bound entity, or emit new events. An agent can create, update, or remove its bound entity. An agent has read-only access to other non-bound entities.
- Emit a derived event that is based on the data in the incoming event.
- Emit a derived event that is based on events that are already received.
- Emit a derived event that is based on the state of the entity, or state accessible from the entity, which can include some temporal filtering of the attributes of the entity.
- Update the attributes of the bound entity.
- Read attributes of an entity that is resolved through a relationship from the bound entity or event.
- Create the bound entity of the agent from data in the incoming event.
- Remove the entity that is bound to the agent.
A developer of an agent is responsible for writing the business logic that updates the state of an entity that is based on incoming events. Decision Server Insights does automatically and transparently maintain the state that is required for temporal and stateful computations.
The following figure shows a solution with four different agents; all of which listen for a situation or closely related situations. Situations are detected by the arrival of an event, which can arrive from the outside world or from an event that is emitted by an agent. Agents decide what they must do as a result of receiving the event, and does something based on the event itself and the conditions in the rules or Java code. In the figure, both a rule agent and a Java agent emit an event when event3 occurs, and update the lifecycle of the agent's bound entity when event1 and event2 occur and all of the conditions are true.

An agent that is bound to a single entity instance, processes an event with one of the following outcomes:
- The processing of the event succeeds, and the actions that are defined are executed.
- The processing of the event fails and the agent is available again to process another event.
- The processing of the event succeeds. The agent is either ended or remains active if it is waiting to correlate data from another future event.
Agent types
An agent can be rule-based, written in Java, or call a predictive scoring model.
- Rule agent
- Rule agents act on entities through rules. Rules can generate
events and emit them into and out of the system.
The vocabulary within the rule agent has the following access rights:
- Read and write on all attributes of the bound entity.
- Read-only on attributes of entities that are referenced through relationships (remote entities).
- Read-only on event attributes.
- Java agent
- A Java agent processes events
by using Java code. The agent
has access to the entity model and can establish a Java coded logic.
A Java agent does not have to be bound to an entity.
- Predictive scoring agent
- A predictive scoring agent is a Java agent that can use an SPSS® scoring configuration hosted externally to Decision Server Insights.
Agent descriptors
An agent is represented as a rule agent project, a Java agent project, or a predictive scoring agent. An agent project contains an agent descriptor that defines the agent signature. A signature includes the events that the agent wants to process, the event field that is the key for the entity, and the routing logic.
A rule agent signature induces an authoring context. The authoring context provides predefined variables (main entity is implicit) to help authors of the business logic to write rules.
The agent signature also defines the applicability condition. Decision Server Insights routes events to specific agents, and loads the data to execute the business logic.