Skip to main content
Version: 8.1


This function is used in Python Scripting.


Returns a list of the most recent agent events. This function should only be called from the Controller.

Changed in 8.1.11
If called from an Agent on 8.1.11+, this function will return an exception.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.


system.eam.queryAgentHistory(groupIds, agentIds, startDate, endDate, limit)


ListgroupIdsA list of groups to restrict the results to. If not specified, all groups will be included.
ListagentIdsA list of agent names to restrict the results to. If not specified, all agents will be allowed.
DatestartDateThe starting time for history events. If null, defaults to 8 hours previous to now.
DateendDateThe ending time for the query range. If null, defaults to "now".
intlimitThe limit of results to return. Defaults to 100. A value of 0 means "no limit".


Dataset - A dataset with columns id, agent_name, agent_role, event_time, event_category, event_type, event_source, event_level, event_level_int, and message, where each row is a new agent event.


Gateway, Vision Client, Perspective Session

Code Examples

Example #1 -Querying for Agent Task History
# This script will loop through each row of the dataset and grab out every value from that row and assign it to a matching variable. Those variables can then be used in some way.
for row in range(results.rowCount):
eventId=results.getValueAt(row, "id")
agentName=results.getValueAt(row, "agent_name")
agentRole=results.getValueAt(row, "agent_role")
eventTime=results.getValueAt(row, "event_time")
eventCategory=results.getValueAt(row, "event_category")
eventType=results.getValueAt(row, "event_type")
eventSource=results.getValueAt(row, "event_source")
eventLevel=results.getValueAt(row, "event_level")
eventLevelInt=results.getValueAt(row, "event_level_int")
message=results.getValueAt(row, "message")
#Can include some code here to use the variables in some way for each row.
Example #2 - Querying for Agent Task History
# This script grabs the agent event history from agents called Agent1, Agent2, Agent3, and will then place the data into a table on the same window.
results=system.eam.queryAgentHistory(agentIds=["Agent1", "Agent2", "Agent3"])
event.source.parent.getComponent('Table').data = results