« Return to Thread: Agents in Prova rule language wrapped by UMO

Agents in Prova rule language wrapped by UMO

by alex.kozlenkov :: Rate this Message:

Reply to Author | View in Thread

It took me a Sunday's work to wrap agents written in Prova rule language by a Mule UMO. Prova has rich built-in message-processing functionality based on reaction rules. Originally, we used local, JADE, and JMS protocols but it made perfect sense to use Mule now.

Prova is now approaching release 2.0 and in the new beta 2f, this functionality will be enabled. This is an example of two agents:
Agent001

:- eval(agent001()).

card('Mastercard').
card('Visa').

agent001() :-
        card(Card),
        sendMsg(XID, esb, "Agent002", request, card(Card)).

Agent002

rcvMsg(XID, Protocol, From, request, card(Card)) :-
        iam(Me),
        println(["Request received by ",Me," on protocol ",Protocol," from ",From," about card ",Card]).

The above starts Agent001 by running the goal "agent001()" then sends two messages for either of the two cards on the "esb" protocol. The second agent has a reaction rule that accepts messages matching the specified pattern and prints the main data.

This is, of course, a toy example, but we could easily extrapolate this to useful rule-based decison making nodes. For example, the decision logic in the Mule Loanbroker example can be easily extermalised as rules. Prova is also good for various intelligent routing stuff based on Petri nets or state machines.

 « Return to Thread: Agents in Prova rule language wrapped by UMO