module Agents class EventFormattingAgent < Agent cannot_be_scheduled! description <<-MD An Event Formatting Agent allows you to format incoming Events, adding new fields as needed. For example, here is a possible Event: { "high": { "celsius": "18", "fahreinheit": "64" }, "date": { "epoch": "1357959600", "pretty": "10:00 PM EST on January 11, 2013" }, "conditions": "Rain showers", "data": "This is some data" } You may want to send this event to another Agent, for example a Twilio Agent, which expects a `message` key. You can use an Event Formatting Agent's `instructions` setting to do this in the following way: "instructions": { "message": "Today's conditions look like <$.conditions> with a high temperature of <$.high.celsius> degrees Celsius.", "subject": "$.data" } JSONPaths must be between < and > . Make sure that you don't use these symbols anywhere else. Events generated by this possible Event Formatting Agent will look like: { "message": "Today's conditions look like Rain showers with a high temperature of 18 degrees Celsius.", "subject": "This is some data" } In `matchers` setting you can perform regular expression matching against contents of events and expand the match data for use in `instructions` setting. Here is an example: { "matchers": [ { "path": "$.date.pretty", "regexp": "\\A(?