Hi,
Editor offers "Get Reporting statistics" step, which can be used to pull out the real time data. You can use this step to determine the agent state and store the same in the database.
Its usage is as follows
Step : Get Reporting Statistic
Set the properties as follows
1.Contact : Triggering Contact
2. Report Object : Resource ICD
3. Field : State
4. Row Identifier : String variable that holds the value of ResourceID
5. Statistic Variable : String variable that holds the value of the agent state.
http://www.cisco.com/univercd/cc/td/doc/product/voice/sw_ap_to/apps_3_5/english/admn_app/step.pdf
Also have a look into Cisco CRA Database Schema
http://www.cisco.com/univercd/cc/td/doc/product/voice/sw_ap_to/apps_3_1/english/admn_app/schema/index.htm
Regards
Yogi